diff options
Diffstat (limited to 'src/mesa/drivers/ggi/include')
| -rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/debug.h | 260 | ||||
| -rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h | 20 | ||||
| -rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h | 84 | ||||
| -rw-r--r-- | src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h | 44 |
4 files changed, 408 insertions, 0 deletions
diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/debug.h b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h new file mode 100644 index 0000000..35d1162 --- /dev/null +++ b/src/mesa/drivers/ggi/include/ggi/mesa/debug.h @@ -0,0 +1,260 @@ +/* $Id: debug.h,v 1.5 2003/09/22 15:18:51 brianp 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> + +#ifndef DEBUG +#define DEBUG +#endif + +__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(args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",args); } +#define GGIMESADPRINT_CORE(args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_MODE(args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_COLOR(args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_DRAW(args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_MISC(args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_LIBS(args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#define GGIMESADPRINT_EVENTS(args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); } +#else /* DEBUG */ +#define GGIMESADPRINT(args...) do{}while(0) +#define GGIMESADPRINT_CORE(args...) do{}while(0) +#define GGIMESADPRINT_MODE(args...) do{}while(0) +#define GGIMESADPRINT_COLOR(args...) do{}while(0) +#define GGIMESADPRINT_DRAW(args...) do{}while(0) +#define GGIMESADPRINT_MISC(args...) do{}while(0) +#define GGIMESADPRINT_LIBS(args...) do{}while(0) +#define GGIMESADPRINT_EVENTS(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 new file mode 100644 index 0000000..5c3c1e2 --- /dev/null +++ b/src/mesa/drivers/ggi/include/ggi/mesa/display_fbdev.h @@ -0,0 +1,20 @@ +#ifndef _GGIMESA_DISPLAY_FBDEV_H +#define _GGIMESA_DISPLAY_FBDEV_H + +#include <ggi/internal/ggi-dl.h> +#include <ggi/display/fbdev.h> + +ggifunc_setmode GGIMesa_fbdev_setmode; +ggifunc_getapi GGIMesa_fbdev_getapi; + +#define FBDEV_PRIV_MESA(vis) ((struct fbdev_priv_mesa *)(FBDEV_PRIV(vis)->accelpriv)) + +struct fbdev_priv_mesa +{ + char *accel; + int have_accel; + void *accelpriv; + ggi_fbdev_priv *oldpriv; /* Hooks back to the LibGGI fbdev target's private data */ +}; + +#endif /* _GGIMESA_DISPLAY_FBDEV_H */ diff --git a/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h new file mode 100644 index 0000000..ecdbe41 --- /dev/null +++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa.h @@ -0,0 +1,84 @@ +/* GGI-Driver for MESA + * + * Copyright (C) 1997 Uwe Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * --------------------------------------------------------------------- + * This code was derived from the following source of information: + * + * svgamesa.c and ddsample.c by Brian Paul + * + */ + +#ifndef _GGIMESA_H +#define _GGIMESA_H + +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include "config.h" +#include "context.h" +#include "drawpix.h" +#include "imports.h" +#include "matrix.h" +#include "state.h" +#include "mtypes.h" +#include "macros.h" +#include "depth.h" + +#undef ASSERT /* ASSERT is redefined */ + +#include <ggi/internal/internal.h> +#include <ggi/ggi_ext.h> +#include <ggi/ggi.h> +#include "GL/ggimesa.h" + +/* + * 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; + ggi_visual_t ggi_visual; + + ggi_pixel color; /* Current color or index*/ + ggi_pixel clearcolor; + + void *priv; +}; + +#define SHIFT (GGI_COLOR_PRECISION - 8) + +#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 new file mode 100644 index 0000000..faafc77 --- /dev/null +++ b/src/mesa/drivers/ggi/include/ggi/mesa/ggimesa_int.h @@ -0,0 +1,44 @@ +#ifndef _GGI_MESA_INT_H +#define _GGI_MESA_INT_H + +#include <ggi/internal/internal.h> +#include "ggimesa.h" + + +extern ggi_extid _ggiMesaID; + +ggifunc_setmode GGIMesa_setmode; +ggifunc_getapi GGIMesa_getapi; + +typedef struct ggi_mesa_ext +{ + /* + * 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; +} ggi_mesa_ext_t; + +#define LIBGGI_MESAEXT(vis) ((ggi_mesa_ext_t *)LIBGGI_EXT(vis,_ggiMesaID)) +#define GGIMESA_PRIV(vis) ((LIBGGI_MESAEXT(vis)->priv)) + +#endif /* _GGI_MISC_INT_H */ |
