rdprail.h

 avatar
unknown
plain_text
a month ago
1.5 kB
1
Indexable
/* rdprail.h */
#ifndef WLR_RENDER_ALLOCATOR_RDPRAIL_H
#define WLR_RENDER_ALLOCATOR_RDPRAIL_H

#define _GNU_SOURCE  // For memfd_create

#include <stdint.h>
#include <wlr/render/allocator.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/interfaces/wlr_buffer.h>

// Placeholder for RDP-specific PDU structures
typedef struct {
    uint32_t poolId;
} GFXREDIR_OPEN_POOL_PDU;

typedef struct {
    uint32_t poolId;
    uint32_t bufferId;
    int width;
    int height;
    int format;
} GFXREDIR_CREATE_BUFFER_PDU;

// Full definition of the context structure
struct _GfxRedirServerContext {
    int (*OpenPool)(struct _GfxRedirServerContext *ctx, GFXREDIR_OPEN_POOL_PDU *open_pool);
    int (*CreateBuffer)(struct _GfxRedirServerContext *ctx, GFXREDIR_CREATE_BUFFER_PDU *create_buffer);
};

typedef struct _GfxRedirServerContext GfxRedirServerContext;

struct wlr_rdp_allocator {
    struct wlr_allocator base;
    GfxRedirServerContext *redir_ctx;
};

struct wlr_rdp_buffer {
    struct wlr_buffer buffer;
    uint32_t pool_id;
    uint32_t buffer_id;
    void *rdp_memory;
    size_t rdp_memory_size;
    int width;
    int height;
    int fd;  // File descriptor for shared memory
    bool data_access_in_progress;
};

// Function to get shared memory
void* rdp_get_shared_memory(uint32_t pool_id, size_t *size, int *fd);

// Function to create the RDP allocator
struct wlr_allocator *wlr_rdp_allocator_create(GfxRedirServerContext *redir_ctx);

#endif // WLR_RENDER_ALLOCATOR_RDPRAIL_H
Leave a Comment