diff options
Diffstat (limited to 'src/mesa/drivers/dri/radeon')
-rw-r--r-- | src/mesa/drivers/dri/radeon/Makefile.solo | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_context.c | 46 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_context.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_tex.c | 92 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_tex.h | 2 |
5 files changed, 75 insertions, 68 deletions
diff --git a/src/mesa/drivers/dri/radeon/Makefile.solo b/src/mesa/drivers/dri/radeon/Makefile.solo index 508b476967b..a5430b23b21 100644 --- a/src/mesa/drivers/dri/radeon/Makefile.solo +++ b/src/mesa/drivers/dri/radeon/Makefile.solo @@ -45,6 +45,7 @@ DRIVER_SOURCES = radeon_context.c \ radeon_screen.c \ radeon_state.c \ radeon_state_init.c \ + ../../common/driverfuncs.c \ ../common/mm.c \ ../common/utils.c \ ../common/texmem.c \ diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 9fc012b2e73..492f80f597a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -50,6 +50,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/tnl.h" #include "tnl/t_pipeline.h" +#include "drivers/common/driverfuncs.h" + #include "radeon_context.h" #include "radeon_ioctl.h" #include "radeon_state.h" @@ -175,15 +177,11 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = { /* Initialize the driver's misc functions. */ -static void radeonInitDriverFuncs( GLcontext *ctx ) +static void radeonInitDriverFuncs( struct dd_function_table *functions ) { - ctx->Driver.GetBufferSize = radeonGetBufferSize; - ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; - ctx->Driver.GetString = radeonGetString; - - ctx->Driver.Error = NULL; - ctx->Driver.DrawPixels = NULL; - ctx->Driver.Bitmap = NULL; + functions->GetBufferSize = radeonGetBufferSize; + functions->ResizeBuffers = _swrast_alloc_buffers; + functions->GetString = radeonGetString; } static const struct dri_debug_control debug_control[] = @@ -222,6 +220,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, { __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); + struct dd_function_table functions; radeonContextPtr rmesa; GLcontext *ctx, *shareCtx; int i; @@ -236,12 +235,29 @@ radeonCreateContext( const __GLcontextModes *glVisual, if ( !rmesa ) return GL_FALSE; + /* Parse configuration files. + * Do this here so that initialMaxAnisotropy is set before we create + * the default textures. + */ + driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, + screen->driScreen->myNum, "r200"); + rmesa->initialMaxAnisotropy = driQueryOptionf(&rmesa->optionCache, + "def_max_anisotropy"); + + /* Init default driver functions then plug in our Radeon-specific functions + * (the texture functions are especially important) + */ + _mesa_init_driver_functions( &functions ); + radeonInitDriverFuncs( &functions ); + radeonInitTextureFuncs( &functions ); + /* Allocate the Mesa context */ if (sharedContextPrivate) shareCtx = ((radeonContextPtr) sharedContextPrivate)->glCtx; else shareCtx = NULL; - rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, (void *) rmesa, GL_TRUE); + rmesa->glCtx = _mesa_create_context(glVisual, shareCtx, + &functions, (void *) rmesa); if (!rmesa->glCtx) { FREE(rmesa); return GL_FALSE; @@ -257,10 +273,6 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->dri.fd = sPriv->fd; rmesa->dri.drmMinor = sPriv->drmMinor; - /* Parse configuration files */ - driParseConfigFiles (&rmesa->optionCache, &screen->optionCache, - screen->driScreen->myNum, "radeon"); - rmesa->radeonScreen = screen; rmesa->sarea = (RADEONSAREAPrivPtr)((GLubyte *)sPriv->pSAREA + screen->sarea_priv_offset); @@ -342,6 +354,11 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->boxes = 0; + /* formerly in radeon_tex.c */ + driInitTextureObjects( ctx, & rmesa->swapped, + DRI_TEXMGR_DO_TEXTURE_1D + | DRI_TEXMGR_DO_TEXTURE_2D ); + /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); @@ -386,11 +403,10 @@ radeonCreateContext( const __GLcontextModes *glVisual, if (rmesa->dri.drmMinor >= 9) _mesa_enable_extension( ctx, "GL_NV_texture_rectangle"); - radeonInitDriverFuncs( ctx ); + /* XXX these should really go right after _mesa_init_driver_functions() */ radeonInitIoctlFuncs( ctx ); radeonInitStateFuncs( ctx ); radeonInitSpanFuncs( ctx ); - radeonInitTextureFuncs( ctx ); radeonInitState( rmesa ); radeonInitSwtcl( ctx ); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index e5deadb41e5..4860d404e20 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -700,7 +700,7 @@ struct radeon_context { driTexHeap * texture_heaps[ RADEON_NR_TEX_HEAPS ]; driTextureObject swapped; int texture_depth; - + float initialMaxAnisotropy; /* Rasterization and vertex state: */ diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index cea0ca2bfc6..ca6acba16af 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -401,6 +401,7 @@ static void radeonTexImage1D( GLcontext *ctx, GLenum target, GLint level, { driTextureObject * t = (driTextureObject *) texObj->DriverData; + assert(t); if ( t ) { driSwapOutTextureObject( t ); } @@ -463,6 +464,8 @@ static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level, driTextureObject * t = (driTextureObject *) texObj->DriverData; GLuint face; + assert(t); + /* which cube face or ordinary 2D image */ switch (target) { case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -510,7 +513,6 @@ static void radeonTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, driTextureObject * t = (driTextureObject *) texObj->DriverData; GLuint face; - /* which cube face or ordinary 2D image */ switch (target) { case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -667,7 +669,8 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, } - +#if 00 +/* not needed anymore */ static void radeonBindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *texObj ) { @@ -682,6 +685,7 @@ static void radeonBindTexture( GLcontext *ctx, GLenum target, } } } +#endif static void radeonDeleteTexture( GLcontext *ctx, struct gl_texture_object *texObj ) @@ -694,6 +698,7 @@ static void radeonDeleteTexture( GLcontext *ctx, _mesa_lookup_enum_by_nr( texObj->Target ) ); } + assert(t); if ( t != NULL ) { if ( rmesa ) { RADEON_FIREVERTICES( rmesa ); @@ -726,58 +731,43 @@ static void radeonTexGen( GLcontext *ctx, rmesa->recheck_texgen[unit] = GL_TRUE; } -/* Fixup MaxAnisotropy according to user preference. +/** + * Allocate a new texture object. + * Called via ctx->Driver.NewTextureObject. */ -static struct gl_texture_object *radeonNewTextureObject ( GLcontext *ctx, - GLuint name, - GLenum target ) { - struct gl_texture_object *obj; - obj = _mesa_new_texture_object (ctx, name, target); - obj->MaxAnisotropy = driQueryOptionf (&RADEON_CONTEXT(ctx)->optionCache, - "def_max_anisotropy"); - return obj; -} - - -void radeonInitTextureFuncs( GLcontext *ctx ) +static struct gl_texture_object * +radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + struct gl_texture_object *obj; + driTextureObject *t; + obj = _mesa_new_texture_object(ctx, name, target); + if (!obj) + return NULL; + obj->MaxAnisotropy = rmesa->initialMaxAnisotropy; + t = (driTextureObject *) radeonAllocTexObj(obj); + if (!t) { + _mesa_delete_texture_object(ctx, obj); + return NULL; + } + return obj; +} - ctx->Driver.ChooseTextureFormat = radeonChooseTextureFormat; - ctx->Driver.TexImage1D = radeonTexImage1D; - ctx->Driver.TexImage2D = radeonTexImage2D; - ctx->Driver.TexImage3D = _mesa_store_teximage3d; - ctx->Driver.TexSubImage1D = radeonTexSubImage1D; - ctx->Driver.TexSubImage2D = radeonTexSubImage2D; - ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; - ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; - ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; - ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; - ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; - ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - - ctx->Driver.NewTextureObject = radeonNewTextureObject; - ctx->Driver.BindTexture = radeonBindTexture; - ctx->Driver.CreateTexture = NULL; /* FIXME: Is this used??? */ - ctx->Driver.DeleteTexture = radeonDeleteTexture; - ctx->Driver.IsTextureResident = driIsTextureResident; - ctx->Driver.PrioritizeTexture = NULL; - ctx->Driver.ActiveTexture = NULL; - ctx->Driver.UpdateTexturePalette = NULL; - - ctx->Driver.TexEnv = radeonTexEnv; - ctx->Driver.TexParameter = radeonTexParameter; - ctx->Driver.TexGen = radeonTexGen; - - driInitTextureObjects( ctx, & rmesa->swapped, - DRI_TEXMGR_DO_TEXTURE_1D - | DRI_TEXMGR_DO_TEXTURE_2D ); - - /* Hack: radeonNewTextureObject is not yet installed when the - * default textures are created. Therefore set MaxAnisotropy of the - * default 2D texture now. */ - ctx->Shared->Default2D->MaxAnisotropy = driQueryOptionf (&rmesa->optionCache, - "def_max_anisotropy"); +void radeonInitTextureFuncs( struct dd_function_table *functions ) +{ + functions->ChooseTextureFormat = radeonChooseTextureFormat; + functions->TexImage1D = radeonTexImage1D; + functions->TexImage2D = radeonTexImage2D; + functions->TexSubImage1D = radeonTexSubImage1D; + functions->TexSubImage2D = radeonTexSubImage2D; + + functions->NewTextureObject = radeonNewTextureObject; + /*functions->BindTexture = radeonBindTexture;*/ + functions->DeleteTexture = radeonDeleteTexture; + functions->IsTextureResident = driIsTextureResident; + + functions->TexEnv = radeonTexEnv; + functions->TexParameter = radeonTexParameter; + functions->TexGen = radeonTexGen; } diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.h b/src/mesa/drivers/dri/radeon/radeon_tex.h index ce079baec2e..9d9285e530a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.h +++ b/src/mesa/drivers/dri/radeon/radeon_tex.h @@ -47,7 +47,7 @@ extern int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t, extern void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t ); -extern void radeonInitTextureFuncs( GLcontext *ctx ); +extern void radeonInitTextureFuncs( struct dd_function_table *functions ); #endif #endif /* __RADEON_TEX_H__ */ |