diff options
Diffstat (limited to 'src/mesa/drivers/dri/r128')
-rw-r--r-- | src/mesa/drivers/dri/r128/Makefile.X11 | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_context.c | 37 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_context.h | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_ioctl.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_screen.c | 37 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_screen.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_texmem.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_texstate.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_vb.c | 7 |
10 files changed, 89 insertions, 37 deletions
diff --git a/src/mesa/drivers/dri/r128/Makefile.X11 b/src/mesa/drivers/dri/r128/Makefile.X11 index 7265affcc6c..e8f07a5e3b1 100644 --- a/src/mesa/drivers/dri/r128/Makefile.X11 +++ b/src/mesa/drivers/dri/r128/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.2 2003/10/20 02:17:33 jonsmirl Exp $ +# $Id: Makefile.X11,v 1.3 2003/10/21 06:05:43 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -36,10 +36,11 @@ DRIVER_SOURCES = \ r128_span.c \ r128_texmem.c \ r128_vb.c \ - ../common/mm.c \ - ../common/utils.c \ - ../common/texmem.c \ - ../common/vblank.c + ../common/mm.c \ + ../common/utils.c \ + ../common/texmem.c \ + ../common/vblank.c \ + ../common/xmlconfig.c INCLUDES = $(MINIGLX_INCLUDES) \ $(SHARED_INCLUDES) diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index f7f6d7141d2..e1b003a3587 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -60,6 +60,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "texmem.h" +/* R128 configuration + */ +#include "xmlpool.h" + +const char __driConfigOptions[] = +DRI_CONF_BEGIN +#if ENABLE_PERF_BOXES + DRI_CONF_SECTION_DEBUG + DRI_CONF_PERFORMANCE_BOXES(false) + DRI_CONF_SECTION_END +#endif + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END +DRI_CONF_END; +#if ENABLE_PERF_BOXES +const GLuint __driNConfigOptions = 2; +#else +const GLuint __driNConfigOptions = 1; +#endif + #ifndef R128_DEBUG int R128_DEBUG = 0; #endif @@ -127,6 +148,10 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128scrn = rmesa->r128Screen = (r128ScreenPtr)(sPriv->private); + /* Parse configuration files */ + driParseConfigFiles (&rmesa->optionCache, &r128scrn->optionCache, + r128scrn->driScreen->myNum, "r128"); + rmesa->sarea = (R128SAREAPrivPtr)((char *)sPriv->pSAREA + r128scrn->sarea_priv_offset); @@ -191,7 +216,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, ctx->Const.LineWidthGranularity = 1.0; #if ENABLE_PERF_BOXES - rmesa->boxes = (getenv( "LIBGL_PERFORMANCE_BOXES" ) != NULL); + rmesa->boxes = driQueryOptionb(&rmesa->optionCache, "performance_boxes"); #endif /* Initialize the software rasterizer and helper modules. @@ -224,10 +249,8 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128DDInitTextureFuncs( ctx ); r128DDInitState( rmesa ); - rmesa->do_irqs = (rmesa->r128Screen->irq && !getenv("R128_NO_IRQS")); - - rmesa->vblank_flags = (rmesa->do_irqs) - ? driGetDefaultVBlankFlags() : VBLANK_FLAG_NO_IRQ; + rmesa->vblank_flags = (rmesa->r128Screen->irq != 0) + ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; driContextPriv->driverPrivate = (void *)rmesa; @@ -277,6 +300,9 @@ void r128DestroyContext( __DRIcontextPrivate *driContextPriv ) } } + /* free the option cache */ + driDestroyOptionCache (&rmesa->optionCache); + FREE( rmesa ); } @@ -305,6 +331,7 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv, newR128Ctx->dirty = R128_UPLOAD_ALL; } + driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags ); newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current2( newR128Ctx->glCtx, diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index 9c93012eb0f..453ccb6f537 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -178,10 +178,6 @@ struct r128_context { */ GLuint doPageFlip; - /* Busy waiting - */ - GLuint do_irqs; - /* Drawable, cliprect and scissor information */ GLint drawOffset, drawPitch; @@ -222,6 +218,10 @@ struct r128_context { */ GLuint vbl_seq; GLuint vblank_flags; + + /* Configuration cache + */ + driOptionCache optionCache; }; #define R128_CONTEXT(ctx) ((r128ContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index c5843473e12..2f1e3ad8f9a 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -31,7 +31,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Gareth Hughes <[email protected]> * */ -#include <errno.h> +#include <errno.h> #include "r128_context.h" #include "r128_state.h" diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 8a8fc252177..8eee8bbe068 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.8 2002/12/16 16:18:53 dawes Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_screen.c,v 1.9 2003/03/26 20:43:49 tsi Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -55,7 +55,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PCI_CHIP_RAGE128LE 0x4C45 #define PCI_CHIP_RAGE128LF 0x4C46 -#define PCI_CHIP_RAGE128PD 0x5044 #define PCI_CHIP_RAGE128PF 0x5046 #define PCI_CHIP_RAGE128PR 0x5052 #define PCI_CHIP_RAGE128RE 0x5245 @@ -80,6 +79,9 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen = (r128ScreenPtr) CALLOC( sizeof(*r128Screen) ); if ( !r128Screen ) return NULL; + /* parse information in __driConfigOptions */ + driParseOptionInfo (&r128Screen->optionCache); + /* This is first since which regions we map depends on whether or * not we are using a PCI card. */ @@ -140,7 +142,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) case PCI_CHIP_RAGE128RL: r128Screen->chipset = R128_CARD_TYPE_R128; break; - case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128PF: r128Screen->chipset = R128_CARD_TYPE_R128_PRO; break; @@ -183,7 +184,23 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) } r128Screen->driScreen = sPriv; +#ifndef _SOLO + if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { + PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + void * const psc = sPriv->psc->screenConfigs; + + if ( glx_enable_extension != NULL ) { + if ( r128Screen->irq != 0 ) { + (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + } + (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + } + } +#endif return r128Screen; } @@ -204,6 +221,9 @@ r128DestroyScreen( __DRIscreenPrivate *sPriv ) drmUnmapBufs( r128Screen->buffers ); drmUnmap( (drmAddress)r128Screen->mmio.map, r128Screen->mmio.size ); + /* free all option information */ + driDestroyOptionInfo (&r128Screen->optionCache); + FREE( r128Screen ); sPriv->private = NULL; } @@ -290,10 +310,13 @@ r128InitDriver( __DRIscreenPrivate *sPriv ) return GL_TRUE; } - #ifndef _SOLO -/* This function is called by libGL.so as soon as libGL.so is loaded. +/** + * This function is called by libGL.so as soon as libGL.so is loaded. * This is where we register new extension functions with the dispatcher. + * + * \todo This interface has been deprecated, so we should probably remove + * this function before the next XFree86 release. */ void __driRegisterExtensions( void ) { @@ -301,7 +324,7 @@ void __driRegisterExtensions( void ) if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) { glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC) - glXGetProcAddress( "__glXEnableExtension" ); + glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" ); if ( glx_enable_extension != NULL ) { glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE ); @@ -338,7 +361,7 @@ static struct __DriverAPIRec r128API = { * The __driCreateScreen name is the symbol that libGL.so fetches. * Return: pointer to a __DRIscreenPrivate. */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 4b1a57292d9..affe9e69ef1 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -39,6 +39,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef GLX_DIRECT_RENDERING #include "r128_sarea.h" +#include "xmlconfig.h" typedef struct { drmHandle handle; /* Handle to the DRM region */ @@ -77,6 +78,9 @@ typedef struct { __DRIscreenPrivate *driScreen; unsigned int sarea_priv_offset; + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; + } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 85b3b68402d..110a16a8316 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -706,7 +706,7 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode ) break; } - /* We want to update the s/w rast state too so that r200SetBuffer() + /* We want to update the s/w rast state too so that r128DDSetBuffer() * gets called. */ _swrast_DrawBuffer(ctx, mode); diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index f6a5dfbbcf3..7bffaf46287 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texmem.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 3f4347b02e8..3c43eb45286 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v 1.7 2001/01/08 01:07:21 martin Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_texstate.c,v 1.1 2002/02/22 21:44:58 dawes Exp $ */ /************************************************************************** Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc., @@ -90,17 +90,11 @@ static void r128SetTexImages( r128ContextPtr rmesa, }; /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. */ - firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + firstLevel = t->base.firstLevel; + lastLevel = t->base.lastLevel; log2Pitch = tObj->Image[firstLevel]->WidthLog2; log2Height = tObj->Image[firstLevel]->HeightLog2; diff --git a/src/mesa/drivers/dri/r128/r128_vb.c b/src/mesa/drivers/dri/r128/r128_vb.c index 77389016486..0387e5dc977 100644 --- a/src/mesa/drivers/dri/r128/r128_vb.c +++ b/src/mesa/drivers/dri/r128/r128_vb.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.15 2002/10/30 12:51:43 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r128/r128_vb.c,v 1.16 2003/03/26 20:43:49 tsi Exp $ */ /************************************************************************** Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and @@ -361,6 +361,9 @@ void r128CheckTexSizes( GLcontext *ctx ) tnl->Driver.Render.Interp = setup_tab[rmesa->SetupIndex].interp; tnl->Driver.Render.CopyPV = setup_tab[rmesa->SetupIndex].copy_pv; } + if (rmesa->Fallback) { + tnl->Driver.Render.Start(ctx); + } } } @@ -489,7 +492,7 @@ void r128InitVB( GLcontext *ctx ) r128ContextPtr rmesa = R128_CONTEXT(ctx); GLuint size = TNL_CONTEXT(ctx)->vb.Size; - rmesa->verts = ALIGN_MALLOC(size * 4 * 16, 32); + rmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32); { static int firsttime = 1; |