Chapter 5. Mode management

Table of Contents
The ggi_mode struct
ggi_graphtype
GGI_AUTO
Mode negotiation
Functions

After opening the visual, you must set a mode (specifying e.g. the dimensions, how many colors, etc.) before you can do anything useful with it, such as drawing.

The ggi_mode struct

This structure defines a visual's (graphics) mode.

The definition in ggi/ggi.h is:

typedef struct { sint16   x, y; } ggi_coord;

typedef struct		/* requested by user and changed by driver	*/
{
        uint32          frames;         /* frames needed                */
        ggi_coord       visible;        /* vis. pixels, may change slightly */
        ggi_coord       virt;           /* virtual pixels, may change   */
        ggi_coord       size;           /* size of visible in mm        */
        ggi_graphtype   graphtype;      /* which mode ?                 */
        ggi_coord       dpp;            /* dots per pixel               */
} ggi_mode;

You usually don't need to care about the definition, if you want to set a mode, but it is necessary if you want to find out the mode actually being set.

ggi_coord

ggi_coord represents any (x,y) coordinate.

frames

Use of multiple buffering is specified in the frames member of the ggi_mode struct, as the number of screen buffers needed.

Tip: Multiple buffering is the allocation of multiple framebuffers and drawing on/reading/displaying them independently. Applications use double-buffering to prepare a picture offline and switching display to it.

visible

visible area represents the area of the visual that is visible to the user at any time.