DirectBuffer Structures

typedef enum {
        blPixelLinearBuffer,
        blPixelPlanarBuffer,
        blExtended,

        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 ???     */
        /* shouldn't that rather describe the _planes_, then ??? becka  */
} ggi_pixelplanarbuffer;

/* 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       0x00010000
/* GGI_DB_SIMPLE_PLB means that the buffer has the following properties:
      type=GGI_DB_NORMAL
      read=write
      layout=blPixelLinearBuffer
*/


typedef struct {
        uint32          type;           /* buffer type */
        int             frame;          /* framenumber (GGI_DB_NORMAL) */

        /*      access info     */
        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;

                void *extended;
        } buffer;
} ggi_directbuffer;

frame

is the frame number as used in multiple buffering. Note that each frame can export more than one DirectBuffer.

layout

is an enumeration specifying whether the buffer is pixel-linear, planar, etc.

layout

is a union of all buffer info. Check the layout member to see which member of use.

Please see Chapter 8 for information on ggi_pixelformat struct, which describes the format of the pixels for pixel-linear buffers.