The ggi_directbuffer structure contains information on target-dependent buffers to allow applications to access them directly.
/* Buffer types */ #define GGI_DB_NORMAL 0x0001 /* "frame" is valid when set */ #define GGI_DB_EXTENDED 0x0002 #define GGI_DB_MULTI_LEFT 0x0004 #define GGI_DB_MULTI_RIGHT 0x0008 /* Flags that may be or'ed with the buffer type */ #define GGI_DB_SIMPLE_PLB 0x01000000 /* GGI_DB_SIMPLE_PLB means that the buffer has the following properties: type == GGI_DB_NORMAL read == write noaccess == 0 align == 0 layout == blPixelLinearBuffer */ typedef struct { uint32 type; /* buffer type */ int frame; /* framenumber (GGI_DB_NORMAL) */ /* access info */ ggi_resource_t resource; /* If non-NULL you must acquire the buffer before using it */ void *read; /* buffer address for reads */ void *write; /* buffer address for writes */ unsigned int page_size; /* zero for true linear buffers */ uint32 noaccess; /* bitfield. bit x set means you may _not_ access this DB at the width of 2^x bytes. Usually 0, but _check_ it. */ uint32 align; /* bitfield. bit x set means you may only access this DB at the width of 2^x bytes, when the access is aligned to a multiple of 2^x. Note that bit 0 is a bit bogus here, but it should be always 0, as then ((noaccess|align)==0) is a quick check for "no restrictions". */ ggi_bufferlayout layout; /* The actual buffer info. Depends on layout. */ union { ggi_pixellinearbuffer plb; ggi_pixelplanarbuffer plan; ggi_samplelinearbuffer slb; ggi_sampleplanarbuffer splan; void *extended; } buffer; } ggi_directbuffer;
is the frame number as used in multiple buffering. Note that each frame can export more than one DirectBuffer.
is an enumeration specifying whether the buffer is pixel-linear, planar, etc.
is a union of all buffer info. Check the layout member to see which member of use.
typedef enum { blPixelLinearBuffer, blPixelPlanarBuffer, blExtended, blSampleLinearBuffer, blSamplePlanarBuffer, blLastBufferLayout } ggi_bufferlayout; typedef struct { int stride; /* bytes per row */ ggi_pixelformat *pixelformat; /* format of the pixels */ } ggi_pixellinearbuffer; typedef struct { int next_line; /* bytes until next line */ int next_plane; /* bytes until next plane */ ggi_pixelformat *pixelformat; /* format of the pixels */ } ggi_pixelplanarbuffer; typedef struct { int num_pixels; /* how many pixelformats */ int stride; /* bytes per row */ ggi_pixelformat *pixelformat[4];/* format of the pixels */ } ggi_samplelinearbuffer; typedef struct { int next_line[3]; /* bytes until next line */ int next_plane[3]; /* bytes until next plane */ ggi_pixelformat *pixelformat[4];/* format of the pixels */ } ggi_sampleplanarbuffer;