Untitled
unknown
plain_text
a month ago
2.0 kB
2
Indexable
light@light:~$ cat test.c #include <stdio.h> #include <stdlib.h> #include <freerdp2/freerdp/server/rdpgfx.h> #include <wlr/render/allocator.h> #include <wlr/util/log.h> #include "render/allocator/rdprail.h" // Mock FreeRDP callbacks for testing static UINT test_open_pool(GfxRedirServerContext* context, const GFXREDIR_OPEN_POOL_PDU* openPool) { printf("Opening pool with ID: %d\n", openPool->poolId); return 0; } static UINT test_create_buffer(GfxRedirServerContext* context, const GFXREDIR_CREATE_BUFFER_PDU* createBuffer) { printf("Creating buffer: ID %d in pool %d, size %dx%d\n", createBuffer->bufferId, createBuffer->poolId, createBuffer->width, createBuffer->height); return 0; } int main() { // Initialize logging wlr_log_init(WLR_DEBUG, NULL); // Create mock FreeRDP context GfxRedirServerContext *redir_ctx = calloc(1, sizeof(GfxRedirServerContext)); redir_ctx->OpenPool = test_open_pool; redir_ctx->CreateBuffer = test_create_buffer; // Create our allocator struct wlr_allocator *alloc = wlr_rdprail_allocator_create(redir_ctx); if (!alloc) { fprintf(stderr, "Failed to create allocator\n"); return 1; } // Test buffer creation struct wlr_buffer_format_set formats = {0}; // You'll need to set up proper formats struct wlr_buffer *buffer = wlr_allocator_create_buffer(alloc, 640, 480, &formats); if (!buffer) { fprintf(stderr, "Failed to create buffer\n"); return 1; } // Try writing to buffer uint32_t *pixels = buffer->data; for (int i = 0; i < (640 * 480); i++) { pixels[i] = 0xFF0000FF; // Fill with red } printf("Buffer created and filled with red\n"); printf("Memory address: %p\n", buffer->data); // Cleanup wlr_buffer_drop(buffer); wlr_allocator_destroy(alloc); free(redir_ctx); return 0; } light@light:~$
Editor is loading...
Leave a Comment