summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-09-10 19:19:24 +0000
committerBrian Paul <[email protected]>2004-09-10 19:19:24 +0000
commit0cabfa68c37041028d634a7697daf6de9fc10c72 (patch)
tree232b3987a199700620ab560063a18217e72367ea /src/mesa
parente14c225597c83994e62c58285cb4a03b5c007ef8 (diff)
assorted updates (bug #1025977)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/ggi/default/linear.c2
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_mode.c23
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_visual.c73
-rw-r--r--src/mesa/drivers/ggi/ggimesa.c85
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h2
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h2
6 files changed, 100 insertions, 87 deletions
diff --git a/src/mesa/drivers/ggi/default/linear.c b/src/mesa/drivers/ggi/default/linear.c
index ffd0acc3d3b..9d29761ad5b 100644
--- a/src/mesa/drivers/ggi/default/linear.c
+++ b/src/mesa/drivers/ggi/default/linear.c
@@ -39,7 +39,7 @@
((color[GCOMP]>>GS) << B) | \
((color[BCOMP]>>BS)))
-#define FLIP(coord) (LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y-(coord) - 1)
+#define FLIP(coord) (LIBGGI_VIRTY(ggi_ctx->ggi_visual) - (coord) - 1)
/**********************************************************************/
diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c
index 6fb952d55c6..eee80eb4b77 100644
--- a/src/mesa/drivers/ggi/display/fbdev_mode.c
+++ b/src/mesa/drivers/ggi/display/fbdev_mode.c
@@ -50,15 +50,13 @@
int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis);
+ struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
- strcpy(arguments, "");
+ arguments = '\0';
- switch(num)
- {
- case 0:
- if (priv->oldpriv->have_accel)
- {
+ switch(num) {
+ case 0:
+ if (priv->oldpriv->have_accel) {
strcpy(apiname, priv->oldpriv->accel);
return 0;
}
@@ -70,17 +68,16 @@ int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *argument
static int do_setmode(ggi_visual *vis)
{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIVATE(vis);
+ struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
int err, id;
- char libname[256], libargs[256];
+ char libname[GGI_API_MAXLEN], libargs[GGI_API_MAXLEN];
ggi_graphtype gt;
_ggiZapMode(vis, ~GGI_DL_OPDISPLAY);
priv->have_accel = 0;
for (id = 1; GGIMesa_fbdev_getapi(vis, id, libname, libargs) == 0; id++)
{
- if (_ggiOpenDL(vis, libname, libargs, NULL) == 0)
- {
+ if (_ggiOpenDL(vis, libname, libargs, NULL) == 0) {
fprintf(stderr, "display-fbdev-mesa: Error opening the "
"%s (%s) library.\n", libname, libargs);
return GGI_EFATAL;
@@ -92,9 +89,7 @@ static int do_setmode(ggi_visual *vis)
if (priv->oldpriv->accel &&
_ggiOpenDL(vis, priv->accel, NULL, NULL) != 0) {
priv->have_accel = 1;
- }
- else
- {
+ } else {
priv->have_accel = 0;
}
vis->accelactive = 0;
diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c
index 0176614ffba..79c16ec7963 100644
--- a/src/mesa/drivers/ggi/display/fbdev_visual.c
+++ b/src/mesa/drivers/ggi/display/fbdev_visual.c
@@ -76,51 +76,47 @@ char *conffile = confstub;
static int changed(ggi_visual_t vis, int whatchanged)
{
- switch (whatchanged)
- {
- case GGI_CHG_APILIST:
- {
- char api[256];
- char args[256];
- int i;
- const char *fname;
- ggi_dlhandle *lib;
+ switch (whatchanged) {
+ case GGI_CHG_APILIST: {
+ char api[GGI_API_MAXLEN], args[GGI_API_MAXLEN];
+ int i;
+ const char *fname;
+ ggi_dlhandle *lib;
- for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++)
- {
- strcat(api, "-mesa");
- fname = ggMatchConfig(_configHandle, api, NULL);
- if (fname == NULL)
- {
- /* No special implementation for this sublib */
- continue;
- }
-
- lib = ggiExtensionLoadDL(vis, fname, args, NULL, GGI_SYMNAME_PREFIX);
+ for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++) {
+ strcat(api, "-mesa");
+ fname = ggMatchConfig(_configHandle, api, NULL);
+ if (fname == NULL) {
+ /* No special implementation for this sublib */
+ continue;
}
+
+ lib = ggiExtensionLoadDL(vis, fname, args, NULL, GGI_SYMNAME_PREFIX);
}
- break;
+ }
+ break;
}
return 0;
}
-int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
+
+static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh,
+ const char *args, void *argptr, uint32 *dlret)
{
struct fbdev_priv_mesa *priv;
int err;
ggifunc_getapi *oldgetapi;
- GGIMESA_PRIVATE(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa));
+ GGIMESA_PRIV(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa));
if (priv == NULL) {
fprintf(stderr, "Failed to allocate fbdev private data\n");
- return GGI_DL_ERROR;
+ return GGI_ENOMEM;
}
priv->oldpriv = LIBGGI_PRIVATE(vis); /* Hook back */
err = ggLoadConfig(conffile, &_configHandle);
- if (err != GGI_OK)
- {
+ if (err != GGI_OK) {
GGIMESADPRINT_CORE("display-fbdev: Couldn't open %s\n", conffile);
return err;
}
@@ -139,12 +135,35 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
vis->opdisplay->getapi = oldgetapi;
}
+ *dlret = GGI_DL_EXTENSION;
return 0;
}
-int GGIdlcleanup(ggi_visual *vis)
+
+static int GGIclose(ggi_visual *vis, struct ggi_dlhandle *dlh)
{
return 0;
}
+
+int MesaGGIdl_fbdev_mesa(int func, void **funcptr)
+{
+ switch (func) {
+ case GGIFUNC_open:
+ *funcptr = GGIopen;
+ return 0;
+ case GGIFUNC_exit:
+ *funcptr = NULL;
+ return 0;
+ case GGIFUNC_close:
+ *funcptr = GGIclose;
+ return 0;
+ default:
+ *funcptr = NULL;
+ }
+
+ return GGI_ENOTFOUND;
+}
+
+
#include <ggi/internal/ggidlinit.h>
diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c
index 8a2f44a558c..6f5189456af 100644
--- a/src/mesa/drivers/ggi/ggimesa.c
+++ b/src/mesa/drivers/ggi/ggimesa.c
@@ -73,8 +73,8 @@ static void gl_ggiGetSize(GLframebuffer *fb, GLuint *width, GLuint *height)
GGIMESADPRINT_CORE("gl_ggiGetSize() called\n");
- *width = LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.x;
- *height = LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y;
+ *width = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
+ *height = LIBGGI_VIRTY(ggi_ctx->ggi_visual);
printf("returning %d, %d\n", *width, *height);
}
@@ -91,9 +91,9 @@ static void gl_ggiSetIndex(GLcontext *ctx, GLuint ci)
static void gl_ggiSetClearIndex(GLcontext *ctx, GLuint ci)
{
ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
+
GGIMESADPRINT_CORE("gl_ggiSetClearIndex() called\n");
-
+
ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
ggi_ctx->clearcolor = (ggi_pixel)ci;
}
@@ -126,19 +126,15 @@ static void gl_ggiClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
GGIMESADPRINT_CORE("gl_ggiClear() called\n");
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT))
- {
+ if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
ggiSetGCForeground(ggi_ctx->ggi_visual, ggi_ctx->clearcolor);
- if (all)
- {
+ if (all) {
int w, h;
- w = LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.x;
- h = LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y;
+ w = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
+ h = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
ggiDrawBox(ggi_ctx->ggi_visual, 0, 0, w, h);
- }
- else
- {
+ } else {
ggiDrawBox(ggi_ctx->ggi_visual, x, y, //FLIP(y),
width, height);
}
@@ -156,7 +152,7 @@ static void gl_ggiClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit)
{
ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
+
printf("set read %d\n", bufferBit);
GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n");
@@ -184,11 +180,12 @@ static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint b
static const GLubyte * gl_ggiGetString(GLcontext *ctx, GLenum name)
{
GGIMESADPRINT_CORE("gl_ggiGetString() called\n");
-
- if (name == GL_RENDERER)
- return (GLubyte *) "Mesa GGI";
- else
+
+ if (name == GL_RENDERER) {
+ return (GLubyte *) "Mesa GGI";
+ } else {
return NULL;
+ }
}
static void gl_ggiFlush(GLcontext *ctx)
@@ -219,7 +216,7 @@ static void gl_ggiEnable(GLcontext *ctx, GLenum pname, GLboolean state)
static void gl_ggiSetupPointers(GLcontext *ctx)
{
TNLcontext *tnl;
-
+
GGIMESADPRINT_CORE("gl_ggiSetupPointers() called\n");
/* General information */
@@ -293,13 +290,13 @@ static void get_mode_info(ggi_visual_t vis, int *r, int *g, int *b,
*g = 0;
*b = 0;
- for(i = 0; i < sizeof(ggi_pixel)*8; ++i){
+ for(i = 0; i < sizeof(ggi_pixel)*8; ++i) {
int mask = 1 << i;
- if(LIBGGI_PIXFMT(vis)->red_mask & mask)
+ if (LIBGGI_PIXFMT(vis)->red_mask & mask)
++(*r);
- if(LIBGGI_PIXFMT(vis)->green_mask & mask)
+ if (LIBGGI_PIXFMT(vis)->green_mask & mask)
++(*g);
- if(LIBGGI_PIXFMT(vis)->blue_mask & mask)
+ if (LIBGGI_PIXFMT(vis)->blue_mask & mask)
++(*b);
}
@@ -317,15 +314,17 @@ int ggiMesaInit()
GGIMESADPRINT_CORE("ggiMesaInit() called\n");
- str = getenv("GGIMESA_DEBUG");
+ str = getenv("GGIMESA_DEBUGSYNC");
if (str != NULL) {
- _ggimesaDebugState = atoi(str);
- GGIMESADPRINT_CORE("Debugging=%d\n", _ggimesaDebugState);
+ _ggimesaDebugSync = 1;
}
- str = getenv("GGIMESA_DEBUGSYNC");
+ str = getenv("GGIMESA_DEBUG");
if (str != NULL) {
- _ggimesaDebugSync = 1;
+ _ggimesaDebugState = atoi(str);
+ GGIMESADPRINT_CORE("%s Debugging=%d\n",
+ _ggimesaDebugSync ? "sync" : "async",
+ _ggimesaDebugState);
}
GGIMESADPRINT_CORE("ggiMesaInit()\n");
@@ -360,12 +359,12 @@ int ggiMesaInit()
int ggiMesaExit(void)
{
int rc;
-
+
GGIMESADPRINT_CORE("ggiMesaExit() called\n");
-
+
if (!_ggimesaLibIsUp)
return -1;
-
+
if (_ggimesaLibIsUp > 1)
{
/* Exit only at last call */
@@ -375,18 +374,18 @@ int ggiMesaExit(void)
rc = ggiExtensionUnregister(ggiMesaID);
ggFreeConfig(_ggimesaConfigHandle);
-
+
_ggimesaLibIsUp = 0;
-
+
return rc;
}
int ggiMesaAttach(ggi_visual_t vis)
{
int rc;
-
+
GGIMESADPRINT_CORE("ggiMesaAttach() called\n");
-
+
rc = ggiExtensionAttach(vis, ggiMesaID);
if (rc == 0)
{
@@ -531,10 +530,10 @@ void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis)
if (ctx->gl_ctx->Viewport.Width == 0)
{
_mesa_Viewport(0, 0,
- LIBGGI_MODE(vis)->visible.x,
- LIBGGI_MODE(vis)->visible.y);
- ctx->gl_ctx->Scissor.Width = LIBGGI_MODE(vis)->visible.x;
- ctx->gl_ctx->Scissor.Height = LIBGGI_MODE(vis)->visible.y;
+ LIBGGI_VIRTX(vis),
+ LIBGGI_VIRTY(vis));
+ ctx->gl_ctx->Scissor.Width = LIBGGI_VIRTX(vis);
+ ctx->gl_ctx->Scissor.Height = LIBGGI_VIRTY(vis);
}
}
@@ -579,6 +578,7 @@ static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state)
_swsetup_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
+ /* XXX: Better use an assertion that bails out here on failure */
if (!LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state) {
GGIMESADPRINT_CORE("update_state == NULL!\n");
GGIMESADPRINT_CORE("Please check your config files!\n");
@@ -595,12 +595,11 @@ static int changed(ggi_visual_t vis, int whatchanged)
GGIMESADPRINT_CORE("changed() called\n");
- switch (whatchanged)
- {
+ switch (whatchanged) {
case GGI_CHG_APILIST:
{
- char api[256];
- char args[256];
+ char api[GGI_API_MAXLEN];
+ char args[GGI_API_MAXLEN];
int i;
const char *fname;
ggi_dlhandle *lib;
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h
index 22e863117be..ecdbe414f8a 100644
--- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h
+++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h
@@ -75,7 +75,7 @@ struct ggi_mesa_context
ggi_pixel color; /* Current color or index*/
ggi_pixel clearcolor;
- void *private;
+ void *priv;
};
#define SHIFT (GGI_COLOR_PRECISION - 8)
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 da8b10f2ff9..edd23ea7986 100644
--- a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h
+++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h
@@ -40,6 +40,6 @@ typedef struct ggi_mesa_ext
} ggi_mesa_ext_t;
#define LIBGGI_MESAEXT(vis) ((ggi_mesa_ext_t *)LIBGGI_EXT(vis,ggiMesaID))
-#define GGIMESA_PRIVATE(vis) ((LIBGGI_MESAEXT(vis)->private))
+#define GGIMESA_PRIV(vis) ((LIBGGI_MESAEXT(vis)->priv))
#endif /* _GGI_MISC_INT_H */