summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_mode.c13
-rw-r--r--src/mesa/drivers/ggi/default/genkgi_visual.c14
-rw-r--r--src/mesa/drivers/ggi/default/stubs.c6
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_mode.c11
-rw-r--r--src/mesa/drivers/ggi/display/fbdev_visual.c10
-rw-r--r--src/mesa/drivers/ggi/ggimesa.c129
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/debug.h258
-rw-r--r--src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h2
8 files changed, 376 insertions, 67 deletions
diff --git a/src/mesa/drivers/ggi/default/genkgi_mode.c b/src/mesa/drivers/ggi/default/genkgi_mode.c
index b11b641499..938024789f 100644
--- a/src/mesa/drivers/ggi/default/genkgi_mode.c
+++ b/src/mesa/drivers/ggi/default/genkgi_mode.c
@@ -1,4 +1,4 @@
-/* $Id: genkgi_mode.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $
+/* $Id: genkgi_mode.c,v 1.4 2000/01/07 08:34:44 jtaylor Exp $
******************************************************************************
display-fbdev-kgicon-generic-mesa
@@ -33,17 +33,16 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-//#include <linux/fb.h>
-
#include <ggi/internal/ggi-dl.h>
#include <ggi/mesa/ggimesa_int.h>
+#include <ggi/mesa/debug.h>
#include "genkgi.h"
int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
{
struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
- gl_ggiDEBUG("Entered mesa_genkgi_getapi, num=%d\n", num);
+ GGIMESADPRINT_CORE("Entered mesa_genkgi_getapi, num=%d\n", num);
strcpy(arguments, "");
@@ -63,7 +62,7 @@ int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *argumen
int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryflag)
{
struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
- int junkval; // There must be a better way to do this
+ int junkval;
priv->oldpriv->kgicommand_ptr += getpagesize();
(kgiu32)(priv->oldpriv->kgicommand_ptr) &= 0xfffff000;
@@ -81,9 +80,7 @@ int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryfla
if ((priv->oldpriv->kgicommand_ptr - priv->oldpriv->mapped_kgicommand)
>= (priv->oldpriv->kgicommand_buffersize - getpagesize()))
{
- gl_ggiDEBUG("Hit end of FIFO, attempting remap");
munmap(priv->oldpriv->mapped_kgicommand, priv->oldpriv->kgicommand_buffersize);
- gl_ggiDEBUG("Passed munmap");
if ((priv->oldpriv->mapped_kgicommand =
mmap(NULL,
priv->oldpriv->kgicommand_buffersize,
@@ -94,9 +91,7 @@ int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryfla
{
ggiPanic("Failed to remap kgicommand!");
}
- gl_ggiDEBUG("Passed mmap");
priv->oldpriv->kgicommand_ptr = priv->oldpriv->mapped_kgicommand;
- gl_ggiDEBUG("Passed kgicommand_ptr reset");
}
return 0;
}
diff --git a/src/mesa/drivers/ggi/default/genkgi_visual.c b/src/mesa/drivers/ggi/default/genkgi_visual.c
index 43d79e4a64..c30f15fdb0 100644
--- a/src/mesa/drivers/ggi/default/genkgi_visual.c
+++ b/src/mesa/drivers/ggi/default/genkgi_visual.c
@@ -1,4 +1,4 @@
-/* $Id: genkgi_visual.c,v 1.5 1999/09/21 00:46:26 jtaylor Exp $
+/* $Id: genkgi_visual.c,v 1.6 2000/01/07 08:34:44 jtaylor Exp $
******************************************************************************
genkgi_visual.c: visual handling for the generic KGI helper
@@ -28,6 +28,7 @@
#include <ggi/internal/ggi-dl.h>
#include <ggi/mesa/ggimesa_int.h>
#include <ggi/mesa/display_fbdev.h>
+#include <ggi/mesa/debug.h>
#include "genkgi.h"
#include <stdio.h>
@@ -74,7 +75,8 @@ char *conffile = confstub;
static int changed(ggi_visual_t vis, int whatchanged)
{
- gl_ggiDEBUG("Entered ggimesa_genkgi_changed\n");
+ GGIMESADPRINT_CORE("Entered ggimesa_genkgi_changed\n");
+
switch (whatchanged)
{
case GGI_CHG_APILIST:
@@ -88,7 +90,7 @@ static int changed(ggi_visual_t vis, int whatchanged)
for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++)
{
strcat(api, "-mesa");
- gl_ggiDEBUG("ggimesa_genkgi_changed: api=%s, i=%d\n", api, i);
+ GGIMESADPRINT_CORE("ggimesa_genkgi_changed: api=%s, i=%d\n", api, i);
fname = ggMatchConfig(_configHandle, api, NULL);
if (fname == NULL)
{
@@ -112,7 +114,7 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
struct stat junk;
ggifunc_getapi *oldgetapi;
- gl_ggiDEBUG("display-fbdev-kgicon-mesa: GGIdlinit start\n");
+ GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit start\n");
GENKGI_PRIV_MESA(vis) = priv = malloc(sizeof(struct genkgi_priv_mesa));
if (priv == NULL)
@@ -139,7 +141,7 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
{
sprintf(priv->accel, "%s%s", accel_prefix, "d3dim");
priv->have_accel = 1;
- gl_ggiDEBUG("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel);
+ GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel);
}
/* Mode management */
@@ -162,7 +164,7 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
LIBGGI_MESAEXT(vis)->update_state = genkgi_update_state;
LIBGGI_MESAEXT(vis)->setup_driver = genkgi_setup_driver;
#endif
- gl_ggiDEBUG("display-fbdev-kgicon-mesa: GGIdlinit finished\n");
+ GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit finished\n");
return 0;
}
diff --git a/src/mesa/drivers/ggi/default/stubs.c b/src/mesa/drivers/ggi/default/stubs.c
index aa3e6c98b8..5c7a0ff592 100644
--- a/src/mesa/drivers/ggi/default/stubs.c
+++ b/src/mesa/drivers/ggi/default/stubs.c
@@ -325,6 +325,10 @@ void GGIupdate_state(GLcontext *ctx)
void GGItriangle_flat(GLcontext *ctx,GLuint v0,GLuint v1,GLuint v2,GLuint pv)
{
+#define INTERP_Z 1
+#define INTERP_RGB 1
+#define INTERP_ALPHA 1
+
#define SETUP_CODE \
GLubyte r = VB->ColorPtr->data[pv][0]; \
GLubyte g = VB->ColorPtr->data[pv][1]; \
@@ -335,7 +339,7 @@ void GGItriangle_flat(GLcontext *ctx,GLuint v0,GLuint v1,GLuint v2,GLuint pv)
#define INNER_LOOP(LEFT,RIGHT,Y) \
ggiDrawHLine(VIS,LEFT,FLIP(Y),RIGHT-LEFT);
-#include "tritemp.h"
+#include "tritemp.h"
}
diff --git a/src/mesa/drivers/ggi/display/fbdev_mode.c b/src/mesa/drivers/ggi/display/fbdev_mode.c
index 6815e5f198..f7f8f0b7fe 100644
--- a/src/mesa/drivers/ggi/display/fbdev_mode.c
+++ b/src/mesa/drivers/ggi/display/fbdev_mode.c
@@ -1,4 +1,4 @@
-/* $Id: fbdev_mode.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $
+/* $Id: fbdev_mode.c,v 1.4 2000/01/07 08:34:44 jtaylor Exp $
******************************************************************************
display-fbdev-mesa
@@ -38,6 +38,7 @@
#include <ggi/internal/ggi-dl.h>
#include <ggi/mesa/ggimesa_int.h>
#include <ggi/mesa/display_fbdev.h>
+#include <ggi/mesa/debug.h>
#ifndef MAP_FAILED
#define MAP_FAILED ((void*)-1)
@@ -86,7 +87,7 @@ static int do_setmode(ggi_visual *vis)
return GGI_EFATAL;
}
- gl_ggiDEBUG("Success in loading %s (%s)\n", libname, libargs);
+ GGIMESADPRINT_CORE("Success in loading %s (%s)\n", libname, libargs);
}
if (priv->oldpriv->accel &&
@@ -101,7 +102,7 @@ static int do_setmode(ggi_visual *vis)
ggiIndicateChange(vis, GGI_CHG_APILIST);
- gl_ggiDEBUG("display-fbdev-mesa: do_setmode SUCCESS\n");
+ GGIMESADPRINT_CORE("display-fbdev-mesa: do_setmode SUCCESS\n");
return 0;
}
@@ -115,7 +116,7 @@ int GGIMesa_fbdev_setmode(ggi_visual *vis, ggi_mode *mode)
return err;
}
- gl_ggiDEBUG("display-fbdev-mesa: setmode %dx%d#%dx%dF%d[0x%02x]\n",
+ GGIMESADPRINT_CORE("display-fbdev-mesa: setmode %dx%d#%dx%dF%d[0x%02x]\n",
mode->visible.x, mode->visible.y,
mode->virt.x, mode->virt.y,
mode->frames, mode->graphtype);
@@ -128,7 +129,7 @@ int GGIMesa_fbdev_setmode(ggi_visual *vis, ggi_mode *mode)
return err;
}
- gl_ggiDEBUG("display-fbdev-mesa: setmode success.\n");
+ GGIMESADPRINT_CORE("display-fbdev-mesa: setmode success.\n");
return 0;
}
diff --git a/src/mesa/drivers/ggi/display/fbdev_visual.c b/src/mesa/drivers/ggi/display/fbdev_visual.c
index 3723dc6a45..8a375da66b 100644
--- a/src/mesa/drivers/ggi/display/fbdev_visual.c
+++ b/src/mesa/drivers/ggi/display/fbdev_visual.c
@@ -1,4 +1,4 @@
-/* $Id: fbdev_visual.c,v 1.4 1999/08/24 02:03:34 jtaylor Exp $
+/* $Id: fbdev_visual.c,v 1.5 2000/01/07 08:34:44 jtaylor Exp $
******************************************************************************
display-fbdev-mesa: visual handling
@@ -28,6 +28,7 @@
#include <ggi/internal/ggi-dl.h>
#include <ggi/mesa/ggimesa_int.h>
#include <ggi/mesa/display_fbdev.h>
+#include <ggi/mesa/debug.h>
#include <stdio.h>
#include <stdlib.h>
@@ -105,8 +106,7 @@ static int changed(ggi_visual_t vis, int whatchanged)
int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
{
struct fbdev_priv_mesa *priv;
- char libname[256], libargs[256];
- int id, err;
+ int err;
ggifunc_getapi *oldgetapi;
GGIMESA_PRIVATE(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa));
@@ -115,12 +115,12 @@ int GGIdlinit(ggi_visual *vis, const char *args, void *argptr)
return GGI_DL_ERROR;
}
- priv->oldpriv = LIBGGI_PRIVATE(vis); // Hook back
+ priv->oldpriv = LIBGGI_PRIVATE(vis); /* Hook back */
err = ggLoadConfig(conffile, &_configHandle);
if (err != GGI_OK)
{
- gl_ggiPrint("display-fbdev: Couldn't open %s\n", conffile);
+ GGIMESADPRINT_CORE("display-fbdev: Couldn't open %s\n", conffile);
return err;
}
diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c
index 7983c930c8..be79216bae 100644
--- a/src/mesa/drivers/ggi/ggimesa.c
+++ b/src/mesa/drivers/ggi/ggimesa.c
@@ -29,6 +29,7 @@
#ifdef GGI
#include <ggi/mesa/ggimesa_int.h>
+#include <ggi/mesa/debug.h>
#undef VIS
#undef FLIP
@@ -53,6 +54,7 @@ int gl_ggi_debug = GL_FALSE;
static void gl_ggiUpdateState(GLcontext *ctx);
static int changed(ggi_visual_t vis, int whatchanged);
+#if 0
/* FIXME: Move this debugging stuff to include/ggi/mesa/internal/ */
void gl_ggiPrint(char *format,...)
{
@@ -74,6 +76,7 @@ void gl_ggiDEBUG(char *format,...)
va_end(args);
}
}
+#endif
static void gl_ggiGetSize(GLcontext *ctx, GLuint *width, GLuint *height)
{
@@ -143,6 +146,7 @@ static GLbitfield gl_ggiClear(GLcontext *ctx,GLbitfield mask, GLboolean all,
return mask & (~GL_COLOR_BUFFER_BIT);
}
+#if 0
static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLenum mode)
{
if (mode == GL_FRONT)
@@ -152,6 +156,42 @@ static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLenum mode)
return GL_TRUE;
}
+#endif
+
+/* Set the buffer used for drawing */
+static GLboolean gl_ggiSetDrawBuffer(GLcontext *ctx, GLenum mode)
+{
+ if (mode == GL_FRONT_LEFT)
+ {
+ GGICTX->active_buffer = 1;
+ return GL_TRUE;
+ }
+ else if (mode == GL_BACK_LEFT)
+ {
+ GGICTX->active_buffer = 0;
+ return GL_TRUE;
+ }
+ else
+ {
+ return GL_FALSE;
+ }
+}
+
+
+/* Set the buffer used for reading */
+/* XXX support for separate read/draw buffers hasn't been tested */
+static void gl_ggiSetReadBuffer(GLcontext *ctx, GLframebuffer *buffer, GLenum mode)
+{
+ if (mode == GL_FRONT_LEFT)
+ {
+ GGICTX->active_buffer = 1;
+ }
+ else if (mode == GL_BACK_LEFT)
+ {
+ GGICTX->active_buffer = 0;
+ }
+}
+
static const char * gl_ggiRendererString(void)
{
@@ -176,7 +216,10 @@ static void gl_ggiSetupPointers( GLcontext *ctx )
ctx->Driver.Clear = gl_ggiClear;
ctx->Driver.Index = gl_ggiSetIndex;
ctx->Driver.Color = gl_ggiSetColor;
- ctx->Driver.SetBuffer = gl_ggiSetBuffer;
+
+ ctx->Driver.SetDrawBuffer = gl_ggiSetDrawBuffer;
+ ctx->Driver.SetReadBuffer = gl_ggiSetReadBuffer;
+
ctx->Driver.GetBufferSize = gl_ggiGetSize;
ctx->Driver.Finish = gl_ggiFlush;
ctx->Driver.Flush = gl_ggiFlush;
@@ -185,7 +228,6 @@ static void gl_ggiSetupPointers( GLcontext *ctx )
static int gl_ggiInitInfo(GGIMesaContext ctx, struct ggi_mesa_info *info)
{
- int virty,visy,err;
ggi_mode mode;
ggiGetMode(ctx->ggi_vis, &mode);
@@ -218,6 +260,36 @@ static int gl_ggiInitInfo(GGIMesaContext ctx, struct ggi_mesa_info *info)
return 0;
}
+int ggiMesaInit()
+{
+ int err;
+
+ _ggimesaLibIsUp++;
+ if (_ggimesaLibIsUp > 1)
+ return 0; /* Initialize only at first call */
+
+ err = ggLoadConfig(ggimesaconffile, &_ggimesaConfigHandle);
+ if (err != GGI_OK)
+ {
+ fprintf(stderr, "GGIMesa: Couldn't open %s\n", ggimesaconffile);
+ _ggimesaLibIsUp--;
+ return err;
+ }
+
+ ggiMesaID = ggiExtensionRegister("GGIMesa", sizeof(struct mesa_ext), changed);
+
+ if (ggiMesaID < 0)
+ {
+ fprintf(stderr, "GGIMesa: failed to register as extension\n");
+ _ggimesaLibIsUp--;
+ ggFreeConfig(_ggimesaConfigHandle);
+ return ggiMesaID;
+ }
+
+ return 0;
+}
+
+
GGIMesaContext GGIMesaCreateContext(void)
{
GGIMesaContext ctx;
@@ -310,8 +382,8 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
if (!func)
{
- gl_ggiPrint("setup_driver==NULL !\n");
- gl_ggiPrint("Please check your config files!\n");
+ fprintf(stderr, "setup_driver==NULL!\n");
+ fprintf(stderr, "Please check your config files!\n");
return -1;
}
@@ -331,15 +403,20 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
info.blue_bits, info.alpha_bits);
if (!ctx->gl_vis)
{
- gl_ggiPrint("Can't create gl_visual!\n");
+ fprintf(stderr, "Can't create gl_visual!\n");
return -1;
}
- ctx->gl_buffer = gl_create_framebuffer(ctx->gl_vis);
+ ctx->gl_buffer = gl_create_framebuffer(ctx->gl_vis,
+ ctx->gl_vis->DepthBits > 0,
+ ctx->gl_vis->StencilBits > 0,
+ ctx->gl_vis->AccumBits > 0,
+ ctx->gl_vis->AlphaBits > 0);
+
if (!ctx->gl_buffer)
{
- gl_ggiPrint("Can't create gl_buffer!\n");
+ fprintf(stderr, "Can't create gl_buffer!\n");
return -1;
}
@@ -368,7 +445,7 @@ int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
if (ctx->lfb[0] == NULL)
{
- gl_ggiPrint("No linear frame buffer!\n");
+ fprintf(stderr, "No linear frame buffer!\n");
return -1;
}
@@ -425,9 +502,11 @@ GGIMesaContext GGIMesaGetCurrentContext(void)
*/
void GGIMesaSwapBuffers(void)
{
- gl_ggiDEBUG("GGIMesaSwapBuffers\n");
+ GGIMESADPRINT_CORE("GGIMesaSwapBuffers\n");
+
FLUSH_VB(GGIMesa->gl_ctx, "swap buffers");
gl_ggiFlush(GGIMesa->gl_ctx);
+
if (GGIMesa->gl_vis->DBflag)
{
memcpy(GGIMesa->lfb[0], GGIMesa->lfb[1], GGIMesa->bufsize);
@@ -441,8 +520,8 @@ static void gl_ggiUpdateState(GLcontext *ctx)
func = (void *)CTX_OPMESA(ctx)->update_state;
if (!func) {
- gl_ggiPrint("update_state==NULL !\n");
- gl_ggiPrint("Please check your config files!\n");
+ fprintf(stderr, "update_state == NULL!\n");
+ fprintf(stderr, "Please check your config files!\n");
ggiPanic("");
}
@@ -478,34 +557,6 @@ static int changed(ggi_visual_t vis, int whatchanged)
return 0;
}
-int ggiMesaInit()
-{
- int err;
-
- _ggimesaLibIsUp++;
- if (_ggimesaLibIsUp > 1)
- return 0; /* Initialize only at first call */
-
- err = ggLoadConfig(ggimesaconffile, &_ggimesaConfigHandle);
- if (err != GGI_OK)
- {
- fprintf(stderr, "GGIMesa: Couldn't open %s\n", ggimesaconffile);
- _ggimesaLibIsUp--;
- return err;
- }
-
- ggiMesaID = ggiExtensionRegister("GGIMesa", sizeof(struct mesa_ext), changed);
-
- if (ggiMesaID < 0)
- {
- fprintf(stderr, "GGIMesa: failed to register as extension\n");
- _ggimesaLibIsUp--;
- ggFreeConfig(_ggimesaConfigHandle);
- return ggiMesaID;
- }
-
- return 0;
-}
int ggiMesaExit(void)
{
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h
index d14c6e4a1d..b07a8ad9a7 100644
--- a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h
+++ b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h
@@ -1 +1,257 @@
-/* Nothing here yet */
+/* $Id: debug.h,v 1.2 2000/01/07 08:34:44 jtaylor Exp $
+******************************************************************************
+
+ GGIMesa debugging macros
+
+ Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org]
+ Copyright (C) 1999-2000 Jon Taylor [taylorj@ggi-project.org]
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************
+*/
+
+#ifndef _GGI_MESA_INTERNAL_DEBUG_H
+#define _GGI_MESA_INTERNAL_DEBUG_H
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <ggi/types.h>
+#include <ggi/gg.h>
+
+
+__BEGIN_DECLS
+
+/* Exported variables */
+#ifdef BUILDING_GGIMESA
+extern uint32 _ggimesaDebugState;
+extern int _ggimesaDebugSync;
+#else
+IMPORTVAR uint32 _ggimesaDebugState;
+IMPORTVAR int _ggimesaDebugSync;
+#endif
+
+__END_DECLS
+
+
+/* Debugging types
+ * bit 0 is reserved! */
+
+#define GGIMESADEBUG_CORE (1<<1) /* 2 */
+#define GGIMESADEBUG_MODE (1<<2) /* 4 */
+#define GGIMESADEBUG_COLOR (1<<3) /* 8 */
+#define GGIMESADEBUG_DRAW (1<<4) /* 16 */
+#define GGIMESADEBUG_MISC (1<<5) /* 32 */
+#define GGIMESADEBUG_LIBS (1<<6) /* 64 */
+#define GGIMESADEBUG_EVENTS (1<<7) /* 128 */
+
+#define GGIMESADEBUG_ALL 0xffffffff
+
+#ifdef __GNUC__
+
+#ifdef DEBUG
+#define GGIMESADPRINT(form,args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",form, ##args); }
+#define GGIMESADPRINT_CORE(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_MODE(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_COLOR(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_DRAW(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_MISC(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_LIBS(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#define GGIMESADPRINT_EVENTS(form,args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",form, ##args); }
+#else /* DEBUG */
+#define GGIMESADPRINT(form,args...) do{}while(0)
+#define GGIMESADPRINT_CORE(form,args...) do{}while(0)
+#define GGIMESADPRINT_MODE(form,args...) do{}while(0)
+#define GGIMESADPRINT_COLOR(form,args...) do{}while(0)
+#define GGIMESADPRINT_DRAW(form,args...) do{}while(0)
+#define GGIMESADPRINT_MISC(form,args...) do{}while(0)
+#define GGIMESADPRINT_LIBS(form,args...) do{}while(0)
+#define GGIMESADPRINT_EVENTS(form,args...) do{}while(0)
+#endif /* DEBUG */
+
+#else /* __GNUC__ */
+
+__BEGIN_DECLS
+
+static inline void GGIMESADPRINT(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_CORE(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_CORE) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_MODE(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_MODE) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_COLOR(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_COLOR) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_DRAW(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_DRAW) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_MISC(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_MISC) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_LIBS(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_LIBS) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+static inline void GGIMESADPRINT_EVENTS(const char *form,...)
+{
+#ifdef DEBUG
+ if (_ggiDebugState & GGIDEBUG_EVENTS) {
+ va_list args;
+
+ fprintf(stderr, "GGIMesa: ");
+ va_start(args, form);
+ vfprintf(stderr, form, args);
+ va_end(args);
+ if (_ggimesaDebugSync) fflush(stderr);
+ }
+#endif
+}
+
+__END_DECLS
+
+#endif /* __GNUC__ */
+
+#ifdef DEBUG
+#define GGIMESA_ASSERT(x,str) \
+{ if (!(x)) { \
+ fprintf(stderr,"GGIMESA:%s:%d: INTERNAL ERROR: %s\n",__FILE__,__LINE__,str); \
+ exit(1); \
+} }
+#define GGIMESA_APPASSERT(x,str) \
+{ if (!(x)) { \
+ fprintf(stderr,"GGIMESA:%s:%d: APPLICATION ERROR: %s\n",__FILE__,__LINE__,str); \
+ exit(1); \
+} }
+#else /* DEBUG */
+#define GGIMESA_ASSERT(x,str) do{}while(0)
+#define GGIMESA_APPASSERT(x,str) do{}while(0)
+#endif /* DEBUG */
+
+#ifdef DEBUG
+# define GGIMESAD0(x) x
+#else
+# define GGIMESAD0(x) /* empty */
+#endif
+
+#ifdef GGIMESADLEV
+# if GGIMESADLEV == 1
+# define GGIMESAD1(x) x
+# define GGIMESAD2(x) /* empty */
+# define GGIMESAD3(x) /* empty */
+# elif GGIMESADLEV == 2
+# define GGIMESAD1(x) x
+# define GGIMESAD2(x) x
+# define GGIMESAD3(x) /* empty */
+# elif GGIMESADLEV > 2
+# define GGIMESAD1(x) x
+# define GGIMESAD2(x) x
+# define GGIMESAD3(x) x
+# endif
+#else
+# define GGIMESAD1(x) /* empty */
+# define GGIMESAD2(x) /* empty */
+# define GGIMESAD3(x) /* empty */
+#endif
+
+#endif /* _GGI_MESA_INTERNAL_DEBUG_H */
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h
index 72d294bb6f..2ee51d1735 100644
--- a/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h
+++ b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h
@@ -14,7 +14,7 @@ struct fbdev_priv_mesa
char *accel;
int have_accel;
void *accelpriv;
- fbdev_hook *oldpriv; // Hooks back to the LibGGI fbdev target's private data
+ fbdev_hook *oldpriv; /* Hooks back to the LibGGI fbdev target's private data */
};
#endif /* _GGIMESA_DISPLAY_FBDEV_H */