From b58c5ad7b0a2c3ed3ecf189f284e23118091fa68 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 10 Jun 2002 15:16:44 +0000 Subject: GGI driver updates (Filip Spacek) --- src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h | 58 +++++++++------------- .../drivers/ggi/include/ggi/mesa/ggimesa_int.h | 31 ++++++++++-- 2 files changed, 50 insertions(+), 39 deletions(-) (limited to 'src/mesa/drivers/ggi/include') diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h index a1e67fcbbf..5596e765d4 100644 --- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h +++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h @@ -45,50 +45,40 @@ #include #include "GL/ggimesa.h" -struct ggi_mesa_info; +/* + * GGIMesa visual configuration. + * + * This structure "derives" from Mesa's GLvisual and extends it by + * GGI's visual. Combination of these two structures is enough to fully + * describe the mode the application is currently running in. GGI + * visual provides information about color configuration and buffering + * method, GLvisual fills the rest. + */ +struct ggi_mesa_visual { + GLvisual gl_visual; + ggi_visual_t ggi_visual; +}; +/* + * GGIMesa context. + * + * GGIMesa context expands the Mesa's context (it doesn't actualy derive + * from it, but this ability isn't needed, and it is best if GL context + * creation is left up to Mesa). It also contains a reference to the GGI + * visual it is attached to, which is very useful for all Mesa callbacks. + */ struct ggi_mesa_context { GLcontext *gl_ctx; - GLvisual *gl_vis; - GLframebuffer *gl_buffer; + ggi_visual_t ggi_visual; - ggi_visual_t ggi_vis; - ggi_coord origin; - int flip_y; - int width, height, stride; /* Stride is in pixels */ ggi_pixel color; /* Current color or index*/ ggi_pixel clearcolor; - void *lfb[2]; /* Linear frame buffers */ - int active_buffer; - int bufsize; - int viewport_init; -}; - -struct ggi_mesa_info -{ - GLboolean rgb_flag; - GLboolean db_flag; - GLboolean alpha_flag; - GLint index_bits; - GLint red_bits, green_bits, blue_bits, alpha_bits; - GLint depth_bits, stencil_bits, accum_bits; + + void *private; }; -extern GGIMesaContext GGIMesa; /* The current context */ - #define SHIFT (GGI_COLOR_PRECISION - 8) -#define GGICTX ((GGIMesaContext)ctx->DriverCtx) -#define VIS (GGICTX->ggi_vis) -#define FLIP(y) (GGICTX->flip_y-(y)) - -#define LFB(type,x,y) ((type *)GGICTX->lfb[0] + (x) + (y) * GGICTX->stride) - -#define CTX_OPMESA(ctx) \ -((struct mesa_ext *)LIBGGI_EXT(((GGIMesaContext)ctx->DriverCtx)->ggi_vis, \ - ggiMesaID)) - - #endif diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h index ae4a3c5825..da8b10f2ff 100644 --- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h +++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h @@ -11,14 +11,35 @@ extern ggi_extid ggiMesaID; ggifunc_setmode GGIMesa_setmode; ggifunc_getapi GGIMesa_getapi; -typedef struct mesa_ext +typedef struct ggi_mesa_ext { - void (*update_state)(GLcontext *ctx); - int (*setup_driver)(GGIMesaContext ctx, struct ggi_mesa_info *info); + /* + * How mesa extends this visual; i.e., size of the depth buffer etc. + * + * By default (upon attaching) this structure is initialized to what + * libggi is guaranteed to handle without any help: single buffered + * visual without any ancilary buffers. + */ + struct ggi_mesa_visual mesa_visual; + + /* + * Mesa framebuffer is a collection of all ancilary buffers required. + * + * This structure contains the ancilary buffers provided in in + * software. On each mode change it is loaded with the list of + * required buffers and the target is expected to clear the ones + * it can provide in hw. The remaining ones are then provided in sw. + * + */ + GLframebuffer mesa_buffer; + + void (*update_state)(ggi_mesa_context_t ctx); + int (*setup_driver)(ggi_mesa_context_t ctx); + void *private; -} mesaext; +} ggi_mesa_ext_t; -#define LIBGGI_MESAEXT(vis) ((mesaext *)LIBGGI_EXT(vis,ggiMesaID)) +#define LIBGGI_MESAEXT(vis) ((ggi_mesa_ext_t *)LIBGGI_EXT(vis,ggiMesaID)) #define GGIMESA_PRIVATE(vis) ((LIBGGI_MESAEXT(vis)->private)) #endif /* _GGI_MISC_INT_H */ -- cgit v1.2.3