diff options
author | Jon Smirl <[email protected]> | 2003-10-21 06:05:39 +0000 |
---|---|---|
committer | Jon Smirl <[email protected]> | 2003-10-21 06:05:39 +0000 |
commit | bcc6eddd335e97d49ed2ef3a1440f94d58dce12d (patch) | |
tree | ff4883dd4da6ce65500940aebe2c268716311fe6 /src/mesa/drivers/dri/r200 | |
parent | 906449753f126f74ad3321d0af897f6609880c17 (diff) |
Update DRI drivers to current DRI CVS and make them work.
Diffstat (limited to 'src/mesa/drivers/dri/r200')
36 files changed, 522 insertions, 438 deletions
diff --git a/src/mesa/drivers/dri/r200/Makefile.X11 b/src/mesa/drivers/dri/r200/Makefile.X11 index eb41e220f57..aad26a70acc 100644 --- a/src/mesa/drivers/dri/r200/Makefile.X11 +++ b/src/mesa/drivers/dri/r200/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.5 2003/10/20 02:17:33 jonsmirl Exp $ +# $Id: Makefile.X11,v 1.6 2003/10/21 06:05:46 jonsmirl Exp $ # Mesa 3-D graphics library # Version: 5.0 @@ -33,6 +33,7 @@ DRIVER_SOURCES = r200_context.c \ ../common/utils.c \ ../common/texmem.c \ ../common/vblank.c \ + ../common/xmlconfig.c \ r200_cmdbuf.c \ r200_pixel.c \ r200_tex.c \ diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index a64b32d9160..3a4fa30bcf6 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_cmdbuf.c,v 1.1 2002/10/30 12:51:51 alanh Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index ec95f05e6ef..b64ee2b1f29 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.c,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -69,7 +68,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. int R200_DEBUG = (0); #endif - +/* R200 configuration + */ +#include "xmlpool.h" + + +const char __driConfigOptions[] = +DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN) + DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_PREFERRED_BPT(0,"0,16,32") + DRI_CONF_SECTION_END + DRI_CONF_SECTION_DEBUG + DRI_CONF_NO_RAST(false) + DRI_CONF_SECTION_END +DRI_CONF_END; +const GLuint __driNConfigOptions = 5; /* Return the width and height of the given buffer. */ @@ -224,7 +242,7 @@ static const struct dri_debug_control debug_control[] = static int -get_ust_nop( int64_t * ust ) +get_ust_nop( uint64_t * ust ) { *ust = 1; return 0; @@ -242,6 +260,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, r200ContextPtr rmesa; GLcontext *ctx, *shareCtx; int i; + int tcl_mode, fthrottle_mode, preferred_bpt; assert(glVisual); assert(driContextPriv); @@ -273,6 +292,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->dri.fd = sPriv->fd; rmesa->dri.drmMinor = sPriv->drmMinor; + /* Parse configuration files */ + driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, + screen->driScreen->myNum, "r200"); rmesa->r200Screen = screen; rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA + screen->sarea_priv_offset); @@ -295,6 +317,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, sizeof( r200TexObj ), (destroy_texture_object_t *) r200DestroyTexObj ); } + preferred_bpt = driQueryOptioni (&rmesa->optionCache, "preferred_bpt"); + rmesa->default32BitTextures = + ( ( preferred_bpt == 0 && screen->cpp == 4 ) || preferred_bpt == 32 ); rmesa->swtcl.RenderIndex = ~0; rmesa->lost_context = 1; @@ -382,36 +407,38 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, r200InitState( rmesa ); r200InitSwtcl( ctx ); + fthrottle_mode = driQueryOptioni(&rmesa->optionCache, "fthrottle_mode"); rmesa->iw.irq_seq = -1; rmesa->irqsEmitted = 0; rmesa->do_irqs = (rmesa->dri.drmMinor >= 6 && - !getenv("R200_NO_IRQS") && + fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && rmesa->r200Screen->irq); + rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); + if (!rmesa->do_irqs) - fprintf(stderr, - "IRQ's not enabled, falling back to busy waits: %d %d %d\n", + fprintf(stderr, + "IRQ's not enabled, falling back to %s: %d %d %d\n", + rmesa->do_usleeps ? "usleeps" : "busy waits", rmesa->dri.drmMinor, - !!getenv("R200_NO_IRQS"), + fthrottle_mode, rmesa->r200Screen->irq); + rmesa->vblank_flags = (rmesa->r200Screen->irq != 0) + ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - rmesa->do_usleeps = !getenv("R200_NO_USLEEPS"); - - rmesa->vblank_flags = (rmesa->do_irqs) - ? driGetDefaultVBlankFlags() : VBLANK_FLAG_NO_IRQ; - - rmesa->prefer_agp_client_texturing = - (getenv("R200_AGP_CLIENT_TEXTURES") != 0); - -#ifndef _SOLO - rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( "__glXGetUST" ); + rmesa->prefer_gart_client_texturing = + (getenv("R200_GART_CLIENT_TEXTURES") != 0); +#ifndef _SOLO + rmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); if ( rmesa->get_ust == NULL ) { rmesa->get_ust = get_ust_nop; } - - (*rmesa->get_ust)( & rmesa->swap_ust ); +#else + rmesa->get_ust = get_ust_nop; #endif + (*rmesa->get_ust)( & rmesa->swap_ust ); + #if DO_DEBUG R200_DEBUG = driParseDebugString( getenv( "R200_DEBUG" ), @@ -420,17 +447,18 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, debug_control ); #endif - if (getenv("R200_NO_RAST")) { + tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (driQueryOptionb(&rmesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); FALLBACK(rmesa, R200_FALLBACK_DISABLE, 1); } - else if (getenv("R200_NO_TCL")) { + else if (tcl_mode == DRI_CONF_TCL_SW) { fprintf(stderr, "disabling TCL support\n"); TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, 1); } else { - if (!getenv("R200_NO_VTXFMT")) { - r200VtxfmtInit( ctx ); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) { + r200VtxfmtInit( ctx, tcl_mode >= DRI_CONF_TCL_CODEGEN ); } _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); } @@ -474,9 +502,11 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) r200FlushCmdBuf( rmesa, __FUNCTION__ ); } - if (!rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE) - if (!getenv("R200_NO_VTXFMT")) + if (!(rmesa->TclFallback & R200_TCL_FALLBACK_TCL_DISABLE)) { + int tcl_mode = driQueryOptioni(&rmesa->optionCache, "tcl_mode"); + if (tcl_mode >= DRI_CONF_TCL_VTXFMT) r200VtxfmtDestroy( rmesa->glCtx ); + } /* free the Mesa context */ rmesa->glCtx->DriverCtx = NULL; @@ -492,7 +522,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) * texture object data. */ int i; - + /* this assert is wrong. The default textures are always on swap list assert( is_empty_list( & rmesa->swapped ) ); */ @@ -502,6 +532,9 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv ) } } + /* free the option cache */ + driDestroyOptionCache (&rmesa->optionCache); + FREE( rmesa ); } } @@ -550,6 +583,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv, fprintf(stderr, "%s ctx %p\n", __FUNCTION__, newCtx->glCtx); if ( newCtx->dri.drawable != driDrawPriv ) { + driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags ); newCtx->dri.drawable = driDrawPriv; r200UpdateWindow( newCtx->glCtx ); r200UpdateViewportOffset( newCtx->glCtx ); diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index 9e00d7a3585..7421db97e6c 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -532,7 +531,7 @@ struct r200_dma_buffer { drmBufPtr buf; }; -#define GET_START(rvb) (rmesa->r200Screen->agp_buffer_offset + \ +#define GET_START(rvb) (rmesa->r200Screen->gart_buffer_offset + \ (rvb)->address - rmesa->dma.buf0_address + \ (rvb)->start) @@ -779,6 +778,7 @@ struct r200_context { unsigned nr_heaps; driTexHeap * texture_heaps[ R200_NR_TEX_HEAPS ]; driTextureObject swapped; + GLboolean default32BitTextures; /* Rasterization and vertex state: @@ -812,7 +812,7 @@ struct r200_context { /* Clientdata textures; */ - GLuint prefer_agp_client_texturing; + GLuint prefer_gart_client_texturing; /* Drawable, cliprect and scissor information */ @@ -863,6 +863,10 @@ struct r200_context { /* Mirrors of some DRI state */ struct r200_dri_mirror dri; + + /* Configuration cache + */ + driOptionCache optionCache; }; #define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx)) diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 480121a094d..af7c3a0e629 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.c,v 1.4 2002/12/17 00:32:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -33,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Authors: * Keith Whitwell <[email protected]> */ - + #include <sched.h> #include <errno.h> @@ -773,7 +772,7 @@ void r200Finish( GLcontext *ctx ) } -/* This version of AllocateMemoryNV allocates only agp memory, and +/* This version of AllocateMemoryMESA allocates only GART memory, and * only does so after the point at which the driver has been * initialized. * @@ -782,8 +781,9 @@ void r200Finish( GLcontext *ctx ) * the kernel data structures, and the current context to get the * device fd. */ -void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, - GLfloat writefreq, GLfloat priority) +void *r200AllocateMemoryMESA(GLsizei size, + GLfloat readfreq, GLfloat writefreq, + GLfloat priority) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -795,7 +795,7 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, fprintf(stderr, "%s sz %d %f/%f/%f\n", __FUNCTION__, size, readfreq, writefreq, priority); - if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || rmesa->r200Screen->IsPCI ) + if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) return NULL; if (getenv("R200_NO_ALLOC")) @@ -804,7 +804,7 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, if (rmesa->dri.drmMinor < 6) return NULL; - alloc.region = RADEON_MEM_REGION_AGP; + alloc.region = RADEON_MEM_REGION_GART; alloc.alignment = 0; alloc.size = size; alloc.region_offset = ®ion_offset; @@ -819,14 +819,14 @@ void *r200AllocateMemoryNV(GLsizei size, GLfloat readfreq, } { - char *region_start = (char *)rmesa->r200Screen->agpTextures.map; + char *region_start = (char *)rmesa->r200Screen->gartTextures.map; return (void *)(region_start + region_offset); } } -/* Called via glXFreeMemoryNV() */ -void r200FreeMemoryNV(GLvoid *pointer) +/* Called via glXFreeMemoryMESA() */ +void r200FreeMemoryMESA(GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -837,7 +837,7 @@ void r200FreeMemoryNV(GLvoid *pointer) if (R200_DEBUG & DEBUG_IOCTL) fprintf(stderr, "%s %p\n", __FUNCTION__, pointer); - if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || rmesa->r200Screen->IsPCI ) { + if (!ctx || !(rmesa = R200_CONTEXT(ctx)) || !rmesa->r200Screen->gartTextures.map) { fprintf(stderr, "%s: no context\n", __FUNCTION__); return; } @@ -845,16 +845,16 @@ void r200FreeMemoryNV(GLvoid *pointer) if (rmesa->dri.drmMinor < 6) return; - region_offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + region_offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; if (region_offset < 0 || - region_offset > rmesa->r200Screen->agpTextures.size) { + region_offset > rmesa->r200Screen->gartTextures.size) { fprintf(stderr, "offset %d outside range 0..%d\n", region_offset, - rmesa->r200Screen->agpTextures.size); + rmesa->r200Screen->gartTextures.size); return; } - memfree.region = RADEON_MEM_REGION_AGP; + memfree.region = RADEON_MEM_REGION_GART; memfree.region_offset = region_offset; ret = drmCommandWrite( rmesa->r200Screen->driScreen->fd, @@ -865,8 +865,8 @@ void r200FreeMemoryNV(GLvoid *pointer) fprintf(stderr, "%s: DRM_RADEON_FREE ret %d\n", __FUNCTION__, ret); } -/* Called via glXGetAGPOffsetMESA() */ -GLuint r200GetAGPOffset(const GLvoid *pointer) +/* Called via glXGetMemoryOffsetMESA() */ +GLuint r200GetMemoryOffsetMESA(const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -877,41 +877,41 @@ GLuint r200GetAGPOffset(const GLvoid *pointer) return ~0; } - if (!r200IsAgpMemory( rmesa, pointer, 0 )) + if (!r200IsGartMemory( rmesa, pointer, 0 )) return ~0; if (rmesa->dri.drmMinor < 6) return ~0; - card_offset = r200AgpOffsetFromVirtual( rmesa, pointer ); + card_offset = r200GartOffsetFromVirtual( rmesa, pointer ); - return card_offset - rmesa->r200Screen->agp_base; + return card_offset - rmesa->r200Screen->gart_base; } -GLboolean r200IsAgpMemory( r200ContextPtr rmesa, const GLvoid *pointer, +GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, GLint size ) { - int offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; int valid = (size >= 0 && offset >= 0 && - offset + size < rmesa->r200Screen->agpTextures.size); + offset + size < rmesa->r200Screen->gartTextures.size); if (R200_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "r200IsAgpMemory( %p ) : %d\n", pointer, valid ); + fprintf(stderr, "r200IsGartMemory( %p ) : %d\n", pointer, valid ); return valid; } -GLuint r200AgpOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer ) +GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, const GLvoid *pointer ) { - int offset = (char *)pointer - (char *)rmesa->r200Screen->agpTextures.map; + int offset = (char *)pointer - (char *)rmesa->r200Screen->gartTextures.map; - if (offset < 0 || offset > rmesa->r200Screen->agpTextures.size) + if (offset < 0 || offset > rmesa->r200Screen->gartTextures.size) return ~0; else - return rmesa->r200Screen->agp_texture_offset + offset; + return rmesa->r200Screen->gart_texture_offset + offset; } diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 5025c1d2304..a76dbd2ad12 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_ioctl.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -106,15 +105,15 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForVBlank( r200ContextPtr rmesa ); extern void r200InitIoctlFuncs( GLcontext *ctx ); -extern void *r200AllocateMemoryNV( GLsizei size, GLfloat readfreq, +extern void *r200AllocateMemoryMESA( GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority ); -extern void r200FreeMemoryNV( GLvoid *pointer ); -extern GLuint r200GetAGPOffset( const GLvoid *pointer ); -extern GLboolean r200IsAgpMemory( r200ContextPtr rmesa, const GLvoid *pointer, - GLint size ); +extern void r200FreeMemoryMESA( GLvoid *pointer ); +extern GLuint r200GetMemoryOffsetMESA( const GLvoid *pointer ); +extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, + GLint size ); -extern GLuint r200AgpOffsetFromVirtual( r200ContextPtr rmesa, - const GLvoid *pointer ); +extern GLuint r200GartOffsetFromVirtual( r200ContextPtr rmesa, + const GLvoid *pointer ); /* ================================================================ * Helper macros: diff --git a/src/mesa/drivers/dri/r200/r200_lock.c b/src/mesa/drivers/dri/r200/r200_lock.c index c2c5d30c582..9d6cff50ae4 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.c +++ b/src/mesa/drivers/dri/r200/r200_lock.c @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -81,6 +81,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa ) void r200GetLock( r200ContextPtr rmesa, GLuint flags ) { __DRIdrawablePrivate *dPriv = rmesa->dri.drawable; + __DRIscreenPrivate *sPriv = rmesa->dri.screen; RADEONSAREAPrivPtr sarea = rmesa->sarea; int i; diff --git a/src/mesa/drivers/dri/r200/r200_lock.h b/src/mesa/drivers/dri/r200/r200_lock.h index 59bc1d656e1..7a4dfcf15cc 100644 --- a/src/mesa/drivers/dri/r200/r200_lock.h +++ b/src/mesa/drivers/dri/r200/r200_lock.h @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_lock.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_maos.h b/src/mesa/drivers/dri/r200/r200_maos.h index 0dfcc5c3ffb..a430497db98 100644 --- a/src/mesa/drivers/dri/r200/r200_maos.h +++ b/src/mesa/drivers/dri/r200/r200_maos.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index f2abaff3afb..7842c0c594f 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -175,6 +175,28 @@ static void emit_ubyte_rgba( GLcontext *ctx, } +static void emit_vec4( GLcontext *ctx, + struct r200_dma_region *rvb, + char *data, + int stride, + int count ) +{ + int i; + int *out = (int *)(rvb->address + rvb->start); + + if (R200_DEBUG & DEBUG_VERTS) + fprintf(stderr, "%s count %d stride %d\n", + __FUNCTION__, count, stride); + + if (stride == 4) + COPY_DWORDS( out, data, count ); + else + for (i = 0; i < count; i++) { + out[0] = *(int *)data; + out++; + data += stride; + } +} static void emit_vec8( GLcontext *ctx, @@ -285,6 +307,9 @@ static void emit_vector( GLcontext *ctx, /* Emit the data */ switch (size) { + case 1: + emit_vec4( ctx, rvb, data, stride, count ); + break; case 2: emit_vec8( ctx, rvb, data, stride, count ); break; @@ -304,7 +329,7 @@ static void emit_vector( GLcontext *ctx, -/* Emit any changed arrays to new agp memory, re-emit a packet to +/* Emit any changed arrays to new GART memory, re-emit a packet to * update the arrays. */ void r200EmitArrays( GLcontext *ctx, GLuint inputs ) diff --git a/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h b/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h index a36be45b275..ce258d7988a 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h +++ b/src/mesa/drivers/dri/r200/r200_maos_vbtmp.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_vbtmp.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_maos_verts.c b/src/mesa/drivers/dri/r200/r200_maos_verts.c index cd866f661f7..872bbd47f5c 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_verts.c +++ b/src/mesa/drivers/dri/r200/r200_maos_verts.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos_verts.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c index 94977efd186..29eab6cd2fb 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.c +++ b/src/mesa/drivers/dri/r200/r200_pixel.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.c,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -160,12 +160,12 @@ r200TryReadPixels( GLcontext *ctx, if (R200_DEBUG & DEBUG_PIXEL) fprintf(stderr, "%s\n", __FUNCTION__); - /* Only accelerate reading to agp buffers. + /* Only accelerate reading to GART buffers. */ - if ( !r200IsAgpMemory(rmesa, pixels, + if ( !r200IsGartMemory(rmesa, pixels, pitch * height * rmesa->r200Screen->cpp ) ) { if (R200_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: dest not agp\n", __FUNCTION__); + fprintf(stderr, "%s: dest not GART\n", __FUNCTION__); return GL_FALSE; } @@ -217,7 +217,7 @@ r200TryReadPixels( GLcontext *ctx, int nbox = dPriv->numClipRects; int src_offset = rmesa->state.color.drawOffset; int src_pitch = rmesa->state.color.drawPitch * rmesa->r200Screen->cpp; - int dst_offset = r200AgpOffsetFromVirtual( rmesa, pixels); + int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels ); int dst_pitch = pitch * rmesa->r200Screen->cpp; XF86DRIClipRectRec *box = dPriv->pClipRects; int i; @@ -297,7 +297,7 @@ static void do_draw_pix( GLcontext *ctx, int i; int blit_format; int size; - int src_offset = r200AgpOffsetFromVirtual( rmesa, pixels); + int src_offset = r200GartOffsetFromVirtual( rmesa, pixels ); int src_pitch = pitch * rmesa->r200Screen->cpp; if (R200_DEBUG & DEBUG_PIXEL) @@ -402,11 +402,11 @@ r200TryDrawPixels( GLcontext *ctx, if (planemask != ~0) return GL_FALSE; /* fix me -- should be possible */ - /* Can't do conversions on agp reads/draws. + /* Can't do conversions on GART reads/draws. */ - if ( !r200IsAgpMemory( rmesa, pixels, size ) ) { + if ( !r200IsGartMemory( rmesa, pixels, size ) ) { if (R200_DEBUG & DEBUG_PIXEL) - fprintf(stderr, "%s: not agp memory\n", __FUNCTION__); + fprintf(stderr, "%s: not GART memory\n", __FUNCTION__); return GL_FALSE; } @@ -426,7 +426,7 @@ r200TryDrawPixels( GLcontext *ctx, return GL_FALSE; } - if ( r200IsAgpMemory(rmesa, pixels, size) ) + if ( r200IsGartMemory(rmesa, pixels, size) ) { do_draw_pix( ctx, x, y, width, height, pitch, pixels, dest, planemask ); diff --git a/src/mesa/drivers/dri/r200/r200_pixel.h b/src/mesa/drivers/dri/r200/r200_pixel.h index 8e7aca1a16e..9282d2b147d 100644 --- a/src/mesa/drivers/dri/r200/r200_pixel.h +++ b/src/mesa/drivers/dri/r200/r200_pixel.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_pixel.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_reg.h b/src/mesa/drivers/dri/r200/r200_reg.h index cc0ae503279..8e9126342f1 100644 --- a/src/mesa/drivers/dri/r200/r200_reg.h +++ b/src/mesa/drivers/dri/r200/r200_reg.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_reg.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -1434,11 +1434,5 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R200_CP_CMD_BITBLT_MULTI 0xC0009B00 #define R200_CP_CMD_TRANS_BITBLT 0xC0009C00 - -#define R200_AGP_TEX_OFFSET 0x02000000 - - - - #endif diff --git a/src/mesa/drivers/dri/r200/r200_sanity.c b/src/mesa/drivers/dri/r200/r200_sanity.c index 11dd36a05cc..291536d5603 100644 --- a/src/mesa/drivers/dri/r200/r200_sanity.c +++ b/src/mesa/drivers/dri/r200/r200_sanity.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_sanity.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ /************************************************************************** Copyright 2002 ATI Technologies Inc., Ontario, Canada, and @@ -32,7 +32,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell <[email protected]> * */ -#include <errno.h> + +#include <errno.h> #include "glheader.h" #include "imports.h" diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index ee52d68a779..4216046d198 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.c,v 1.4 2003/05/08 09:25:35 herrb Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -43,14 +42,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_screen.h" #include "r200_context.h" #include "r200_ioctl.h" +#include "radeon_macros.h" +#include "radeon_reg.h" #include "utils.h" #include "vblank.h" - #ifndef _SOLO #include "glxextensions.h" -#endif - +#endif #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... */ @@ -108,6 +107,8 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) break; } + /* parse information in __driConfigOptions */ + driParseOptionInfo (&screen->optionCache); /* This is first since which regions we map depends on whether or * not we are using a PCI card. @@ -118,30 +119,26 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) int ret; drmRadeonGetParam gp; - gp.param = RADEON_PARAM_AGP_BUFFER_OFFSET; - gp.value = &screen->agp_buffer_offset; + gp.param = RADEON_PARAM_GART_BUFFER_OFFSET; + gp.value = &screen->gart_buffer_offset; ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (ret) { FREE( screen ); - fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_AGP_BUFFER_OFFSET): %d\n", ret); + fprintf(stderr, "drmRadeonGetParam (RADEON_PARAM_GART_BUFFER_OFFSET): %d\n", ret); return NULL; } - screen->agp_texture_offset = - screen->agp_buffer_offset + 2*1024*1024; - - if (sPriv->drmMinor >= 6) { - gp.param = RADEON_PARAM_AGP_BASE; - gp.value = &screen->agp_base; + gp.param = RADEON_PARAM_GART_BASE; + gp.value = &screen->gart_base; ret = drmCommandWriteRead( sPriv->fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); if (ret) { FREE( screen ); - fprintf(stderr, "drmR200GetParam (RADEON_PARAM_AGP_BASE): %d\n", ret); + fprintf(stderr, "drmR200GetParam (RADEON_PARAM_GART_BASE): %d\n", ret); return NULL; } @@ -196,23 +193,27 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } - if ( !screen->IsPCI ) { - screen->agpTextures.handle = dri_priv->agpTexHandle; - screen->agpTextures.size = dri_priv->agpTexMapSize; + if ( dri_priv->gartTexHandle && dri_priv->gartTexMapSize ) { + unsigned char *RADEONMMIO = screen->mmio.map; + + screen->gartTextures.handle = dri_priv->gartTexHandle; + screen->gartTextures.size = dri_priv->gartTexMapSize; if ( drmMap( sPriv->fd, - screen->agpTextures.handle, - screen->agpTextures.size, - (drmAddressPtr)&screen->agpTextures.map ) ) { + screen->gartTextures.handle, + screen->gartTextures.size, + (drmAddressPtr)&screen->gartTextures.map ) ) { drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); FREE( screen ); - __driUtilMessage("%s: IsPCI failed\n", __FUNCTION__); + __driUtilMessage("%s: drmMAP failed for GART texture area\n", __FUNCTION__); return NULL; } - } - + screen->gart_texture_offset = dri_priv->gartTexOffset + ( screen->IsPCI + ? INREG( RADEON_AIC_LO_ADDR ) + : ( ( INREG( RADEON_MC_AGP_LOCATION ) & 0x0ffffU ) << 16 ) ); + } screen->cpp = dri_priv->bpp / 8; screen->AGPMode = dri_priv->AGPMode; @@ -229,22 +230,46 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) screen->logTexGranularity[RADEON_CARD_HEAP] = dri_priv->log2TexGran; - if ( screen->IsPCI ) { + if ( !screen->gartTextures.map ) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; - screen->texOffset[RADEON_AGP_HEAP] = 0; - screen->texSize[RADEON_AGP_HEAP] = 0; - screen->logTexGranularity[RADEON_AGP_HEAP] = 0; + screen->texOffset[RADEON_GART_HEAP] = 0; + screen->texSize[RADEON_GART_HEAP] = 0; + screen->logTexGranularity[RADEON_GART_HEAP] = 0; } else { screen->numTexHeaps = RADEON_NR_TEX_HEAPS; - screen->texOffset[RADEON_AGP_HEAP] = - dri_priv->agpTexOffset + R200_AGP_TEX_OFFSET; - screen->texSize[RADEON_AGP_HEAP] = dri_priv->agpTexMapSize; - screen->logTexGranularity[RADEON_AGP_HEAP] = - dri_priv->log2AGPTexGran; + screen->texOffset[RADEON_GART_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_GART_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_GART_HEAP] = + dri_priv->log2GARTTexGran; } screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; +#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 ( screen->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" ); + + if ( driCompareGLXAPIVersion( 20030818 ) >= 0 ) { + sPriv->psc->allocateMemory = r200AllocateMemoryMESA; + sPriv->psc->freeMemory = r200FreeMemoryMESA; + sPriv->psc->memoryOffset = r200GetMemoryOffsetMESA; + + (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" ); + } + } + } +#endif return screen; } @@ -258,14 +283,16 @@ r200DestroyScreen( __DRIscreenPrivate *sPriv ) if (!screen) return; - if ( !screen->IsPCI ) { - drmUnmap( screen->agpTextures.map, - screen->agpTextures.size ); + if ( screen->gartTextures.map ) { + drmUnmap( screen->gartTextures.map, screen->gartTextures.size ); } drmUnmapBufs( screen->buffers ); drmUnmap( screen->status.map, screen->status.size ); drmUnmap( screen->mmio.map, screen->mmio.size ); + /* free all option information */ + driDestroyOptionInfo (&screen->optionCache); + FREE( screen ); sPriv->private = NULL; } @@ -362,7 +389,7 @@ static struct __DriverAPIRec r200API = { * Return: pointer to a __DRIscreenPrivate. * */ -#ifndef _SOLO +#ifndef _SOLO void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, int numConfigs, __GLXvisualConfig *config) { @@ -380,56 +407,31 @@ void *__driCreateScreen(struct DRIDriverRec *driver, } #endif - - #ifndef _SOLO -/* This function is called by libGL.so to allow the driver to dynamically +/** + * This function is called by libGL.so to allow the driver to dynamically * extend libGL. We can add new GLX functions and/or new GL functions. * Note that _mesa_create_context() will probably add most of the newer * OpenGL extension functions into the dispatcher. + * + * \todo This interface has been deprecated, so we should probably remove + * this function before the next XFree86 release. */ void __driRegisterExtensions( void ) { PFNGLXENABLEEXTENSIONPROC glx_enable_extension; - typedef void *(*registerFunc)(const char *funcName, void *funcAddr); - registerFunc regFunc; 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 ); - glx_enable_extension( "GLX_SGI_video_sync", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_control", GL_FALSE ); - glx_enable_extension( "GLX_MESA_swap_frame_usage", GL_FALSE ); - - - /* Get pointers to libGL's __glXRegisterGLXFunction - * and __glXRegisterGLXExtensionString, if they exist. - */ - regFunc = (registerFunc) glXGetProcAddress( "__glXRegisterGLXFunction" ); - - if (regFunc) { - /* register our GLX extensions with libGL */ - void *p; - p = regFunc("glXAllocateMemoryNV", (void *) r200AllocateMemoryNV); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - p = regFunc("glXFreeMemoryNV", (void *) r200FreeMemoryNV); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - p = regFunc("glXGetAGPOffsetMESA", (void *) r200GetAGPOffset); - if (p) - ; /* XXX already registered - what to do, wrap? */ - - glx_enable_extension( "GLX_NV_vertex_array_range", GL_TRUE ); - glx_enable_extension( "GLX_MESA_agp_offset", GL_TRUE ); - } + (*glx_enable_extension)( "GLX_SGI_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_SGI_video_sync", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_control", GL_FALSE ); + (*glx_enable_extension)( "GLX_MESA_swap_frame_usage", GL_FALSE ); } } } diff --git a/src/mesa/drivers/dri/r200/r200_screen.h b/src/mesa/drivers/dri/r200/r200_screen.h index 1e1f125b0d5..3ed4f550282 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.h +++ b/src/mesa/drivers/dri/r200/r200_screen.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_screen.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -43,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86drm.h" #include "radeon_common.h" #include "radeon_sarea.h" +#include "xmlconfig.h" typedef struct { drmHandle handle; /* Handle to the DRM region */ @@ -80,7 +80,7 @@ typedef struct { r200RegionRec mmio; r200RegionRec status; - r200RegionRec agpTextures; + r200RegionRec gartTextures; drmBufMapPtr buffers; @@ -88,11 +88,14 @@ typedef struct { __DRIscreenPrivate *driScreen; unsigned int sarea_priv_offset; - unsigned int agp_buffer_offset; /* offset in card memory space */ - unsigned int agp_texture_offset; /* offset in card memory space */ - unsigned int agp_base; + unsigned int gart_buffer_offset; /* offset in card memory space */ + unsigned int gart_texture_offset; /* offset in card memory space */ + unsigned int gart_base; GLboolean drmSupportsCubeMaps; /* need radeon kernel module >=1.7 */ + + /* Configuration cache with default values for all contexts */ + driOptionCache optionCache; } r200ScreenRec, *r200ScreenPtr; #endif diff --git a/src/mesa/drivers/dri/r200/r200_span.c b/src/mesa/drivers/dri/r200/r200_span.c index b469aec429b..7e48a9d5afb 100644 --- a/src/mesa/drivers/dri/r200/r200_span.c +++ b/src/mesa/drivers/dri/r200/r200_span.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.c,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_span.h b/src/mesa/drivers/dri/r200/r200_span.h index 269ac0593fd..72911e9455c 100644 --- a/src/mesa/drivers/dri/r200/r200_span.h +++ b/src/mesa/drivers/dri/r200/r200_span.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_span.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index fe2a7dc0970..118712d8410 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state.h,v 1.2 2002/11/05 17:46:08 tsi Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index ba445d5012b..4c9a69f79d2 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_state_init.c,v 1.4 2003/02/22 06:21:11 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -130,28 +130,15 @@ static GLboolean check_##NM( GLcontext *ctx, int idx ) \ CHECK( always, GL_TRUE ) +CHECK( never, GL_FALSE ) CHECK( tex_any, ctx->Texture._EnabledUnits ) CHECK( tex, ctx->Texture.Unit[idx]._ReallyEnabled ) CHECK( fog, ctx->Fog.Enabled ) TCL_CHECK( tcl, GL_TRUE ) -TCL_CHECK( tcl_tex_any, ctx->Texture._EnabledUnits ) TCL_CHECK( tcl_tex, ctx->Texture.Unit[idx]._ReallyEnabled ) TCL_CHECK( tcl_lighting, ctx->Light.Enabled ) -TCL_CHECK( tcl_eyespace_or_lighting, ctx->_NeedEyeCoords || ctx->Light.Enabled ) TCL_CHECK( tcl_light, ctx->Light.Enabled && ctx->Light.Light[idx].Enabled ) TCL_CHECK( tcl_ucp, (ctx->Transform.ClipPlanesEnabled & (1 << idx)) ) -/* TCL_CHECK( tcl_eyespace_or_fog, ctx->_NeedEyeCoords || ctx->Fog.Enabled ) */ - - -static GLboolean check_tcl_eyespace_or_fog( GLcontext *ctx, int idx ) -{ - r200ContextPtr rmesa = R200_CONTEXT(ctx); - int res; - (void) idx; - res = !rmesa->TclFallback && (ctx->_NeedEyeCoords || ctx->Fog.Enabled); - fprintf(stderr, "%s: %d\n", __FUNCTION__, res); - return res; -} /* Initialize the context's hardware state. @@ -244,8 +231,15 @@ void r200InitState( r200ContextPtr rmesa ) ALLOC_STATE( tf, tex_any, TF_STATE_SIZE, "TF/tfactor", 0 ); ALLOC_STATE( tex[0], tex_any, TEX_STATE_SIZE, "TEX/tex-0", 0 ); ALLOC_STATE( tex[1], tex_any, TEX_STATE_SIZE, "TEX/tex-1", 1 ); - ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); - ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + + if (rmesa->r200Screen->drmSupportsCubeMaps) { + ALLOC_STATE( cube[0], tex_any, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); + ALLOC_STATE( cube[1], tex_any, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + } + else { + ALLOC_STATE( cube[0], never, CUBE_STATE_SIZE, "CUBE/tex-0", 0 ); + ALLOC_STATE( cube[1], never, CUBE_STATE_SIZE, "CUBE/tex-1", 1 ); + } ALLOC_STATE( tcl, tcl, TCL_STATE_SIZE, "TCL/tcl", 0 ); ALLOC_STATE( msl, tcl, MSL_STATE_SIZE, "MSL/matrix-select", 0 ); @@ -656,7 +650,7 @@ void r200InitState( r200ContextPtr rmesa ) ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION, &l->LinearAttenuation ); ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION, - &l->QuadraticAttenuation ); + &l->QuadraticAttenuation ); } ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT, diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index dd4025235b6..9d98358d45e 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.c,v 1.5 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -397,7 +396,7 @@ static void flush_last_swtcl_prim( r200ContextPtr rmesa ) if (rmesa->dma.current.buf) { struct r200_dma_region *current = &rmesa->dma.current; - GLuint current_offset = (rmesa->r200Screen->agp_buffer_offset + + GLuint current_offset = (rmesa->r200Screen->gart_buffer_offset + current->buf->buf->idx * RADEON_BUFFER_SIZE + current->start); @@ -446,7 +445,7 @@ static __inline void *r200AllocDmaLowVerts( r200ContextPtr rmesa, { - char *head = rmesa->dma.current.address + rmesa->dma.current.ptr; + GLubyte *head = (GLubyte *) (rmesa->dma.current.address + rmesa->dma.current.ptr); rmesa->dma.current.ptr += bytes; rmesa->swtcl.numverts += nverts; return head; @@ -590,7 +589,7 @@ do { \ \ r200EmitVertexAOS( rmesa, \ rmesa->swtcl.vertex_size, \ - (rmesa->r200Screen->agp_buffer_offset + \ + (rmesa->r200Screen->gart_buffer_offset + \ rmesa->swtcl.indexed_verts.buf->buf->idx * \ RADEON_BUFFER_SIZE + \ rmesa->swtcl.indexed_verts.start)); \ diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.h b/src/mesa/drivers/dri/r200/r200_swtcl.h index 9a36fb68fa9..f183b931c45 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.h +++ b/src/mesa/drivers/dri/r200/r200_swtcl.h @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_swtcl.h,v 1.3 2003/05/06 23:52:08 daenzer Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 9869ad61963..b02a7cc559b 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.c,v 1.2 2002/12/16 16:18:55 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_tcl.h b/src/mesa/drivers/dri/r200/r200_tcl.h index a2db2e18a6e..0fdf9c22c78 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.h +++ b/src/mesa/drivers/dri/r200/r200_tcl.h @@ -1,5 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tcl.h,v 1.2 2002/12/16 16:18:55 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 5f8d06ae62e..f19f877cab5 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -296,7 +296,7 @@ r200ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); - const GLboolean do32bpt = ( rmesa->r200Screen->cpp == 4 ); + const GLboolean do32bpt = rmesa->default32BitTextures; switch ( internalFormat ) { case 4: @@ -495,7 +495,7 @@ r200ValidateClientStorage( GLcontext *ctx, GLenum target, * relaxed, but would need to store the image pitch somewhere, * as packing details might change before image is uploaded: */ - if (!r200IsAgpMemory( rmesa, pixels, srcHeight * srcRowStride ) || + if (!r200IsGartMemory( rmesa, pixels, srcHeight * srcRowStride ) || (srcRowStride & 63)) return 0; @@ -626,8 +626,8 @@ static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level, fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__); /* Normal path: copy (to cached memory) and eventually upload - * via another copy to agp memory and then a blit... Could - * eliminate one copy by going straight to (permanent) agp. + * via another copy to GART memory and then a blit... Could + * eliminate one copy by going straight to (permanent) GART. * * Note, this will call r200ChooseTextureFormat. */ @@ -729,8 +729,8 @@ static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level, fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__); /* Normal path: copy (to cached memory) and eventually upload - * via another copy to agp memory and then a blit... Could - * eliminate one copy by going straight to (permanent) agp. + * via another copy to GART memory and then a blit... Could + * eliminate one copy by going straight to (permanent) GART. * * Note, this will call r200ChooseTextureFormat. */ diff --git a/src/mesa/drivers/dri/r200/r200_tex.h b/src/mesa/drivers/dri/r200/r200_tex.h index 9013de6d795..a4301206ed8 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.h +++ b/src/mesa/drivers/dri/r200/r200_tex.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_texmem.c b/src/mesa/drivers/dri/r200/r200_texmem.c index 34777085ac5..34db1f4421e 100644 --- a/src/mesa/drivers/dri/r200/r200_texmem.c +++ b/src/mesa/drivers/dri/r200/r200_texmem.c @@ -1,4 +1,4 @@ -/* $XFree86$ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */ /************************************************************************** Copyright (C) Tungsten Graphics 2002. All Rights Reserved. @@ -35,6 +35,7 @@ SOFTWARE. * Gareth Hughes <[email protected]> * */ + #include <errno.h> #include "glheader.h" @@ -86,12 +87,12 @@ r200DestroyTexObj( r200ContextPtr rmesa, r200TexObjPtr t ) */ -static void r200UploadAGPClientSubImage( r200ContextPtr rmesa, - r200TexObjPtr t, - struct gl_texture_image *texImage, - GLint hwlevel, - GLint x, GLint y, - GLint width, GLint height ) +static void r200UploadGARTClientSubImage( r200ContextPtr rmesa, + r200TexObjPtr t, + struct gl_texture_image *texImage, + GLint hwlevel, + GLint x, GLint y, + GLint width, GLint height ) { const struct gl_texture_format *texFormat = texImage->TexFormat; GLuint srcPitch, dstPitch; @@ -124,7 +125,7 @@ static void r200UploadAGPClientSubImage( r200ContextPtr rmesa, } t->image[0][hwlevel].data = texImage->Data; - srcOffset = r200AgpOffsetFromVirtual( rmesa, texImage->Data ); + srcOffset = r200GartOffsetFromVirtual( rmesa, texImage->Data ); assert( srcOffset != ~0 ); @@ -181,16 +182,16 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa, height = texImage->Height; dstPitch = t->pp_txpitch + 32; - if (rmesa->prefer_agp_client_texturing && texImage->IsClientData) { - /* In this case, could also use agp texturing. This is + if (rmesa->prefer_gart_client_texturing && texImage->IsClientData) { + /* In this case, could also use GART texturing. This is * currently disabled, but has been tested & works. */ - t->pp_txoffset = r200AgpOffsetFromVirtual( rmesa, texImage->Data ); + t->pp_txoffset = r200GartOffsetFromVirtual( rmesa, texImage->Data ); t->pp_txpitch = texImage->RowStride * texFormat->TexelBytes - 32; if (R200_DEBUG & DEBUG_TEXTURE) fprintf(stderr, - "Using agp texturing for rectangular client texture\n"); + "Using GART texturing for rectangular client texture\n"); /* Release FB memory allocated for this image: */ @@ -202,21 +203,21 @@ static void r200UploadRectSubImage( r200ContextPtr rmesa, } } else if (texImage->IsClientData) { - /* Data already in agp memory, with usable pitch. + /* Data already in GART memory, with usable pitch. */ GLuint srcPitch; srcPitch = texImage->RowStride * texFormat->TexelBytes; r200EmitBlit( rmesa, blit_format, srcPitch, - r200AgpOffsetFromVirtual( rmesa, texImage->Data ), + r200GartOffsetFromVirtual( rmesa, texImage->Data ), dstPitch, t->bufAddr, 0, 0, 0, 0, width, height ); } else { - /* Data not in agp memory, or bad pitch. + /* Data not in GART memory, or bad pitch. */ for (done = 0; done < height ; ) { struct r200_dma_region region; @@ -344,9 +345,9 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, } else if (texImage->IsClientData) { if ( R200_DEBUG & DEBUG_TEXTURE ) - fprintf( stderr, "%s: image data is in agp client storage\n", + fprintf( stderr, "%s: image data is in GART client storage\n", __FUNCTION__); - r200UploadAGPClientSubImage( rmesa, t, texImage, hwlevel, + r200UploadGARTClientSubImage( rmesa, t, texImage, hwlevel, x, y, width, height ); return; } diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index e1dc206d927..3d82aac3234 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -106,7 +105,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, const struct gl_texture_image *baseImage = tObj->Image[tObj->BaseLevel]; GLint curOffset; GLint i; - GLint firstLevel=0, lastLevel=0, numLevels; + GLint numLevels; GLint log2Width, log2Height, log2Depth; /* Set the hardware texture format @@ -126,66 +125,15 @@ static void r200SetTexImages( r200ContextPtr 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. */ - if (R200_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, - "%s: BaseLevel %d MinLod %f MaxLod %f MaxLevel %d\n", - __FUNCTION__, - tObj->BaseLevel, tObj->MinLod, tObj->MaxLod, - tObj->MaxLevel); - - - switch (tObj->Target) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP: - 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 */ - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Depth = 0; - break; - case GL_TEXTURE_3D: - firstLevel = tObj->BaseLevel; - lastLevel = tObj->BaseLevel; - log2Width = tObj->Image[firstLevel]->WidthLog2; - log2Height = tObj->Image[firstLevel]->HeightLog2; - log2Depth = tObj->Image[firstLevel]->DepthLog2; - break; - case GL_TEXTURE_RECTANGLE_NV: - firstLevel = lastLevel = 0; - log2Width = log2Height = 1; /* ? */ - log2Depth = 0; - break; - default: - return; - } - - /* save these values */ - t->base.firstLevel = firstLevel; - t->base.lastLevel = lastLevel; - numLevels = lastLevel - firstLevel + 1; - - if (R200_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, - "%s: firstLevel %d last Level %d w,h: %d,%d log(w,h) %d,%d\n", - __FUNCTION__, firstLevel, lastLevel, - tObj->Image[firstLevel]->Width, - tObj->Image[firstLevel]->Height, - tObj->Image[firstLevel]->WidthLog2, - tObj->Image[firstLevel]->HeightLog2); + driCalculateTextureFirstLastLevel( (driTextureObject *) t ); + log2Width = tObj->Image[t->base.firstLevel]->WidthLog2; + log2Height = tObj->Image[t->base.firstLevel]->HeightLog2; + log2Depth = tObj->Image[t->base.firstLevel]->DepthLog2; + numLevels = t->base.lastLevel - t->base.firstLevel + 1; assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS); @@ -199,7 +147,7 @@ static void r200SetTexImages( r200ContextPtr rmesa, const struct gl_texture_image *texImage; GLuint size; - texImage = tObj->Image[i + firstLevel]; + texImage = tObj->Image[i + t->base.firstLevel]; if ( !texImage ) break; @@ -219,10 +167,12 @@ static void r200SetTexImages( r200ContextPtr rmesa, } assert(size > 0); - if (curOffset & 0x1f) { - /* align to 32-byte offset */ - curOffset = (curOffset + 0x1f) & ~0x1f; - } + + /* Align to 32-byte offset. It is faster to do this unconditionally + * (no branch penalty). + */ + + curOffset = (curOffset + 0x1f) & ~0x1f; t->image[0][i].x = curOffset % BLIT_WIDTH_BYTES; t->image[0][i].y = curOffset / BLIT_WIDTH_BYTES; @@ -305,17 +255,17 @@ static void r200SetTexImages( r200ContextPtr rmesa, (log2Height << R200_FACE_HEIGHT_4_SHIFT)); } - t->pp_txsize = (((tObj->Image[firstLevel]->Width - 1) << 0) | - ((tObj->Image[firstLevel]->Height - 1) << 16)); + t->pp_txsize = (((tObj->Image[t->base.firstLevel]->Width - 1) << 0) | + ((tObj->Image[t->base.firstLevel]->Height - 1) << 16)); /* Only need to round to nearest 32 for textures, but the blitter * requires 64-byte aligned pitches, and we may/may not need the * blitter. NPOT only! */ if (baseImage->IsCompressed) - t->pp_txpitch = (tObj->Image[firstLevel]->Width + 63) & ~(63); + t->pp_txpitch = (tObj->Image[t->base.firstLevel]->Width + 63) & ~(63); else - t->pp_txpitch = ((tObj->Image[firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); + t->pp_txpitch = ((tObj->Image[t->base.firstLevel]->Width * baseImage->TexFormat->TexelBytes) + 63) & ~(63); t->pp_txpitch -= 32; t->dirty_state = TEX_ALL; @@ -1561,6 +1511,12 @@ static GLboolean enable_tex_3d( GLcontext *ctx, int unit ) ASSERT(tObj->Target == GL_TEXTURE_3D); + /* R100 & R200 do not support mipmaps for 3D textures. + */ + if ( (tObj->MinFilter != GL_NEAREST) && (tObj->MinFilter != GL_LINEAR) ) { + return GL_FALSE; + } + if ( t->base.dirty_images[0] ) { R200_FIREVERTICES( rmesa ); r200SetTexImages( rmesa, tObj ); @@ -1633,7 +1589,7 @@ static GLboolean enable_tex_rect( GLcontext *ctx, int unit ) R200_FIREVERTICES( rmesa ); r200SetTexImages( rmesa, tObj ); r200UploadTexImages( rmesa, (r200TexObjPtr) tObj->DriverData, 0 ); - if ( !t->base.memBlock && !rmesa->prefer_agp_client_texturing ) + if ( !t->base.memBlock && !rmesa->prefer_gart_client_texturing ) return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.c b/src/mesa/drivers/dri/r200/r200_vtxfmt.c index 5a4f59d9763..a617d3f0290 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.c,v 1.4 2003/05/06 23:52:08 daenzer Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -970,7 +969,7 @@ static void r200VtxFmtFlushVertices( GLcontext *ctx, GLuint flags ) */ -void r200VtxfmtInit( GLcontext *ctx ) +void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); GLvertexformat *vfmt = &(rmesa->vb.vtxfmt); @@ -1067,7 +1066,7 @@ void r200VtxfmtInit( GLcontext *ctx ) make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fARB ); make_empty_list( &rmesa->vb.dfn_cache.MultiTexCoord1fvARB ); - r200InitCodegen( &rmesa->vb.codegen ); + r200InitCodegen( &rmesa->vb.codegen, useCodegen ); } static void free_funcs( struct dynfn *l ) diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt.h b/src/mesa/drivers/dri/r200/r200_vtxfmt.h index fde3eca4678..39f0a10e4eb 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt.h +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt.h @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -44,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. extern void r200VtxfmtUpdate( GLcontext *ctx ); -extern void r200VtxfmtInit( GLcontext *ctx ); +extern void r200VtxfmtInit( GLcontext *ctx, GLboolean useCodegen ); extern void r200VtxfmtInvalidate( GLcontext *ctx ); extern void r200VtxfmtDestroy( GLcontext *ctx ); extern void r200VtxfmtInitChoosers( GLvertexformat *vfmt ); @@ -87,7 +86,7 @@ do { \ /* */ -void r200InitCodegen( struct dfn_generators *gen ); +void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen ); void r200InitX86Codegen( struct dfn_generators *gen ); void r200InitSSECodegen( struct dfn_generators *gen ); diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c index b7f3fec43e0..efef751a616 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_c.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_c.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the @@ -860,7 +859,7 @@ static struct dynfn *codegen_noop( GLcontext *ctx, const int *key ) return 0; } -void r200InitCodegen( struct dfn_generators *gen ) +void r200InitCodegen( struct dfn_generators *gen, GLboolean useCodegen ) { gen->Vertex3f = codegen_noop; gen->Vertex3fv = codegen_noop; @@ -889,7 +888,7 @@ void r200InitCodegen( struct dfn_generators *gen ) gen->MultiTexCoord1fARB = codegen_noop; gen->MultiTexCoord1fvARB = codegen_noop; - if (!getenv("R200_NO_CODEGEN")) { + if (useCodegen) { #if defined(USE_X86_ASM) r200InitX86Codegen( gen ); #endif diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c index 83eb3e13b78..2245bbcef1b 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_sse.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_sse.c,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c b/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c index a806eca0bb3..c4d8af85e16 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c +++ b/src/mesa/drivers/dri/r200/r200_vtxfmt_x86.c @@ -1,6 +1,5 @@ -/* $XFree86$ */ -/************************************************************************** - +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxfmt_x86.c,v 1.2 2002/12/16 16:18:56 dawes Exp $ */ +/* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S b/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S index 4980ce1bb76..56a4144e8e7 100644 --- a/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S +++ b/src/mesa/drivers/dri/r200/r200_vtxtmp_x86.S @@ -1,4 +1,4 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.1 2002/10/30 12:51:53 alanh Exp $ */ +/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_vtxtmp_x86.S,v 1.2 2002/11/07 18:31:59 tsi Exp $ */ /************************************************************************** Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. @@ -32,16 +32,6 @@ x: .data .align 4 -GLOBL( _x86_Normal3fv) - movl 4(%esp), %eax /* load 'v' off stack */ - movl (%eax), %ecx /* load v[0] */ - movl 4(%eax), %edx /* load v[1] */ - movl 8(%eax), %eax /* load v[2] */ - movl %ecx, 0 /* store v[0] to current vertex */ - movl %edx, 4 /* store v[1] to current vertex */ - movl %eax, 8 /* store v[2] to current vertex */ - ret -GLOBL ( _x86_Normal3fv_end ) /* vertex 3f vertex size 4 @@ -218,19 +208,70 @@ GLOBL ( _x86_Vertex3fv ) .6: jmp *0 GLOBL ( _x86_Vertex3fv_end ) -/* - Normal 3f -*/ -GLOBL ( _x86_Normal3f ) - movl $0x12345678, %edx + +/** + * Generic handler for 2 float format data. This can be used for + * TexCoord2f and possibly other functions. + */ + +GLOBL ( _x86_Attribute2f ) + movl $0x0, %edx movl 4(%esp), %eax + movl 8(%esp), %ecx movl %eax, (%edx) - movl 8(%esp), %eax - movl %eax, 4(%edx) + movl %ecx, 4(%edx) + ret +GLOBL ( _x86_Attribute2f_end ) + + +/** + * Generic handler for 2 float vector format data. This can be used for + * TexCoord2fv and possibly other functions. + */ + +GLOBL( _x86_Attribute2fv) + movl 4(%esp), %eax /* load 'v' off stack */ + movl (%eax), %ecx /* load v[0] */ + movl 4(%eax), %eax /* load v[1] */ + movl %ecx, 0 /* store v[0] to current vertex */ + movl %eax, 4 /* store v[1] to current vertex */ + ret +GLOBL ( _x86_Attribute2fv_end ) + + +/** + * Generic handler for 3 float format data. This can be used for + * Normal3f, Color3f (when the color target is also float), or + * TexCoord3f. + */ + +GLOBL ( _x86_Attribute3f ) + movl 4(%esp), %ecx + movl 8(%esp), %edx movl 12(%esp), %eax - movl %eax, 8(%edx) + movl %ecx, 0 + movl %edx, 4 + movl %eax, 8 ret -GLOBL ( _x86_Normal3f_end ) +GLOBL ( _x86_Attribute3f_end ) + +/** + * Generic handler for 3 float vector format data. This can be used for + * Normal3f, Color3f (when the color target is also float), or + * TexCoord3f. + */ + +GLOBL( _x86_Attribute3fv) + movl 4(%esp), %eax /* load 'v' off stack */ + movl (%eax), %ecx /* load v[0] */ + movl 4(%eax), %edx /* load v[1] */ + movl 8(%eax), %eax /* load v[2] */ + movl %ecx, 0 /* store v[0] to current vertex */ + movl %edx, 4 /* store v[1] to current vertex */ + movl %eax, 8 /* store v[2] to current vertex */ + ret +GLOBL ( _x86_Attribute3fv_end ) + /* Color 4ubv_ub @@ -290,69 +331,13 @@ GLOBL( _x86_Color4ub_ub ) ret GLOBL( _x86_Color4ub_ub_end ) -/* - Color3fv_3f -*/ -GLOBL( _x86_Color3fv_3f ) - movl 4(%esp), %eax - movl $0, %edx - movl (%eax), %ecx - movl %ecx, (%edx) - movl 4(%eax), %ecx - movl %ecx, 4(%edx) - movl 8(%eax), %ecx - movl %ecx, 8(%edx) - ret -GLOBL( _x86_Color3fv_3f_end ) - -/* - Color3f_3f -*/ -GLOBL( _x86_Color3f_3f ) - movl $0x12345678, %edx - movl 4(%esp), %eax - movl %eax, (%edx) - movl 8(%esp,1), %eax - movl %eax, 4(%edx) - movl 12(%esp), %eax - movl %eax, 8(%edx) - ret -GLOBL( _x86_Color3f_3f_end ) /* - TexCoord2fv + MultiTexCoord2fv st0/st1 */ - -GLOBL( _x86_TexCoord2fv ) - movl 4(%esp), %eax - movl $0x12345678, %edx - movl (%eax), %ecx - movl 4(%eax), %eax - movl %ecx, (%edx) - movl %eax, 4(%edx) - ret - -GLOBL( _x86_TexCoord2fv_end ) -/* - TexCoord2f -*/ -GLOBL( _x86_TexCoord2f ) - movl $0x12345678, %edx +GLOBL( _x86_MultiTexCoord2fv ) movl 4(%esp), %eax movl 8(%esp), %ecx - movl %eax, (%edx) - movl %ecx, 4(%edx) - ret -GLOBL( _x86_TexCoord2f_end ) - -/* - MultiTexCoord2fvARB st0/st1 -*/ -GLOBL( _x86_MultiTexCoord2fvARB ) - - movl 4(%esp), %eax - movl 8(%esp), %ecx - sub $0x84c0, %eax and $1, %eax movl (%ecx), %edx shl $3, %eax @@ -360,15 +345,15 @@ GLOBL( _x86_MultiTexCoord2fvARB ) movl %edx, 0xdeadbeef(%eax) movl %ecx, 0xdeadbeef(%eax) ret -GLOBL( _x86_MultiTexCoord2fvARB_end ) +GLOBL( _x86_MultiTexCoord2fv_end ) + /* - MultiTexCoord2fvARB + MultiTexCoord2fv */ -GLOBL( _x86_MultiTexCoord2fvARB_2 ) +GLOBL( _x86_MultiTexCoord2fv_2 ) movl 4(%esp,1), %eax movl 8(%esp,1), %ecx - sub $0x84c0, %eax and $0x1, %eax movl 0(,%eax,4), %edx movl (%ecx), %eax @@ -376,35 +361,132 @@ GLOBL( _x86_MultiTexCoord2fvARB_2 ) movl 4(%ecx), %eax movl %eax, 4(%edx) ret - -GLOBL( _x86_MultiTexCoord2fvARB_2_end ) +GLOBL( _x86_MultiTexCoord2fv_2_end ) /* - MultiTexCoord2fARB st0/st1 + MultiTexCoord2f st0/st1 */ -GLOBL( _x86_MultiTexCoord2fARB ) +GLOBL( _x86_MultiTexCoord2f ) movl 4(%esp), %eax movl 8(%esp), %edx - sub $0x84c0, %eax movl 12(%esp), %ecx and $1, %eax shl $3, %eax movl %edx, 0xdeadbeef(%eax) movl %ecx, 0xdeadbeef(%eax) ret -GLOBL( _x86_MultiTexCoord2fARB_end ) +GLOBL( _x86_MultiTexCoord2f_end ) /* - MultiTexCoord2fARB + MultiTexCoord2f */ -GLOBL( _x86_MultiTexCoord2fARB_2 ) +GLOBL( _x86_MultiTexCoord2f_2 ) movl 4(%esp), %eax movl 8(%esp), %edx - sub $0x84c0, %eax movl 12(%esp,1), %ecx and $1,%eax movl 0(,%eax,4), %eax movl %edx, (%eax) movl %ecx, 4(%eax) ret -GLOBL( _x86_MultiTexCoord2fARB_2_end ) +GLOBL( _x86_MultiTexCoord2f_2_end ) + +/** + * This can be used as a template for either Color3fv (when the color + * target is also a 3f) or Normal3fv. + */ + +GLOBL( _sse_Attribute3fv ) + movl 4(%esp), %eax + movlps (%eax), %xmm0 + movl 8(%eax), %eax + movlps %xmm0, 0 + movl %eax, 8 + ret +GLOBL( _sse_Attribute3fv_end ) + +/** + * This can be used as a template for either Color3f (when the color + * target is also a 3f) or Normal3f. + */ + +GLOBL( _sse_Attribute3f ) + movlps 4(%esp), %xmm0 + movl 12(%esp), %eax + movlps %xmm0, 0 + movl %eax, 8 + ret +GLOBL( _sse_Attribute3f_end ) + + +/** + * Generic handler for 2 float vector format data. This can be used for + * TexCoord2fv and possibly other functions. + */ + +GLOBL( _sse_Attribute2fv ) + movl 4(%esp), %eax + movlps (%eax), %xmm0 + movlps %xmm0, 0 + ret +GLOBL( _sse_Attribute2fv_end ) + + +/** + * Generic handler for 2 float format data. This can be used for + * TexCoord2f and possibly other functions. + */ + +GLOBL( _sse_Attribute2f ) + movlps 4(%esp), %xmm0 + movlps %xmm0, 0 + ret +GLOBL( _sse_Attribute2f_end ) + +/* + MultiTexCoord2fv st0/st1 +*/ +GLOBL( _sse_MultiTexCoord2fv ) + movl 4(%esp), %eax + movl 8(%esp), %ecx + and $1, %eax + movlps (%ecx), %xmm0 + movlps %xmm0, 0xdeadbeef(,%eax,8) + ret +GLOBL( _sse_MultiTexCoord2fv_end ) + +/* + MultiTexCoord2fv +*/ +GLOBL( _sse_MultiTexCoord2fv_2 ) + movl 4(%esp), %eax + movl 8(%esp), %ecx + and $0x1, %eax + movl 0(,%eax,4), %edx + movlps (%ecx), %xmm0 + movlps %xmm0, (%edx) + ret +GLOBL( _sse_MultiTexCoord2fv_2_end ) + +/* + MultiTexCoord2f st0/st1 +*/ +GLOBL( _sse_MultiTexCoord2f ) + movl 4(%esp), %eax + and $1, %eax + movlps 8(%esp), %xmm0 + movlps %xmm0, 0xdeadbeef(,%eax,8) + ret +GLOBL( _sse_MultiTexCoord2f_end ) + +/* + MultiTexCoord2f +*/ +GLOBL( _sse_MultiTexCoord2f_2 ) + movl 4(%esp), %eax + movlps 8(%esp), %xmm0 + and $1,%eax + movl 0(,%eax,4), %eax + movlps %xmm0, (%eax) + ret +GLOBL( _sse_MultiTexCoord2f_2_end ) |