From 316d3ea0ba75bd21743db880d1fe9a8de58f0a07 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Oct 2006 14:56:08 +0000 Subject: patch to increate MaxTextureLevels to 11 (Benno Schulenberg) --- src/mesa/drivers/dri/common/xmlpool/options.h | 5 ++++ src/mesa/drivers/dri/common/xmlpool/t_options.h | 5 ++++ src/mesa/drivers/dri/unichrome/via_context.c | 24 +++++++++---------- src/mesa/drivers/dri/unichrome/via_screen.c | 32 +++++-------------------- src/mesa/drivers/dri/unichrome/via_tex.c | 7 ++++++ 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/mesa/drivers/dri/common/xmlpool/options.h b/src/mesa/drivers/dri/common/xmlpool/options.h index 86d17d0249..1791efda1e 100644 --- a/src/mesa/drivers/dri/common/xmlpool/options.h +++ b/src/mesa/drivers/dri/common/xmlpool/options.h @@ -88,6 +88,11 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(nl,"Beeldkwaliteit") \ DRI_CONF_DESC(fr,"Qualité d'image") +#define DRI_CONF_EXCESS_MIPMAP(def) \ +DRI_CONF_OPT_BEGIN(excess_mipmap,bool,def) \ + DRI_CONF_DESC(en,"Enable extra mipmap level") \ +DRI_CONF_OPT_END + #define DRI_CONF_TEXTURE_DEPTH_FB 0 #define DRI_CONF_TEXTURE_DEPTH_32 1 #define DRI_CONF_TEXTURE_DEPTH_16 2 diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h b/src/mesa/drivers/dri/common/xmlpool/t_options.h index ab9245ee29..82353704c4 100644 --- a/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -68,6 +68,11 @@ DRI_CONF_OPT_END DRI_CONF_SECTION_BEGIN \ DRI_CONF_DESC(en,gettext("Image Quality")) +#define DRI_CONF_EXCESS_MIPMAP(def) \ +DRI_CONF_OPT_BEGIN(excess_mipmap,bool,def) \ + DRI_CONF_DESC(en,"Enable extra mipmap level") \ +DRI_CONF_OPT_END + #define DRI_CONF_TEXTURE_DEPTH_FB 0 #define DRI_CONF_TEXTURE_DEPTH_32 1 #define DRI_CONF_TEXTURE_DEPTH_16 2 diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index a5dee81e57..752f43cbae 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -365,7 +365,7 @@ viaCreateContext(const __GLcontextModes *visual, /* Parse configuration files. */ driParseConfigFiles (&vmesa->optionCache, &viaScreen->optionCache, - sPriv->myNum, "via"); + sPriv->myNum, "unichrome"); /* pick back buffer */ vmesa->hasBack = visual->doubleBufferMode; @@ -441,8 +441,12 @@ viaCreateContext(const __GLcontextModes *visual, driContextPriv->driverPrivate = vmesa; ctx = vmesa->glCtx; - - ctx->Const.MaxTextureLevels = 10; + + if (driQueryOptionb(&vmesa->optionCache, "excess_mipmap")) + ctx->Const.MaxTextureLevels = 11; + else + ctx->Const.MaxTextureLevels = 10; + ctx->Const.MaxTextureUnits = 2; ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits; @@ -541,20 +545,14 @@ viaCreateContext(const __GLcontextModes *visual, VIA_DEBUG = driParseDebugString( getenv( "VIA_DEBUG" ), debug_control ); - if (getenv("VIA_NO_RAST")) + if (getenv("VIA_NO_RAST") || + driQueryOptionb(&vmesa->optionCache, "no_rast")) FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1); - /* I don't understand why this isn't working: - */ vmesa->vblank_flags = vmesa->viaScreen->irqEnabled ? driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - /* Hack this up in its place: - */ - vmesa->vblank_flags = (getenv("VIA_VSYNC") ? - VBLANK_FLAG_SYNC : VBLANK_FLAG_NO_IRQ); - if (getenv("VIA_PAGEFLIP")) vmesa->allowPageFlip = 1; @@ -612,7 +610,9 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv) assert (is_empty_list(&vmesa->tex_image_list[VIA_MEM_SYSTEM])); assert (is_empty_list(&vmesa->freed_tex_buffers)); - FREE(vmesa); + driDestroyOptionCache(&vmesa->optionCache); + + FREE(vmesa); } } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index cf086302e6..30c3248d1b 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -45,16 +45,16 @@ #include "GL/internal/dri_interface.h" -/* Radeon configuration - */ #include "xmlpool.h" const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE - 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_EXCESS_MIPMAP(false) + DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG DRI_CONF_NO_RAST(false) DRI_CONF_SECTION_END @@ -130,7 +130,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->fbOffset = 0; viaScreen->fbSize = gDRIPriv->fbSize; viaScreen->irqEnabled = gDRIPriv->irqEnabled; - viaScreen->irqEnabled = 1; if (VIA_DEBUG & DEBUG_DRI) { fprintf(stderr, "deviceID = %08x\n", viaScreen->deviceID); @@ -200,6 +199,8 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv) via_free_empty_buffers(viaScreen->bufs); + driDestroyOptionInfo(&viaScreen->optionCache); + FREE(viaScreen); sPriv->private = NULL; } @@ -424,38 +425,17 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, VIA_DRIDDX_VERSION_PATCH }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 3, 0 }; - static const __DRIversion drm_compat = {3, 0, 0}; static const char *driver_name = "Unichrome"; dri_interface = interface; - /* - * Check ddx and dri only. - */ - if ( ! driCheckDriDdxDrmVersions2( driver_name, dri_version, & dri_expected, ddx_version, & ddx_expected, - drm_version, drm_version) ) { + drm_version, & drm_expected) ) { return NULL; } - /* - * Check drm version with major versioning span. - */ - - if (((drm_version->major < drm_expected.major) || - (drm_version->major > drm_compat.major)) || - ((drm_version->major == drm_expected.major) && - (drm_version->minor < drm_expected.minor))) { - - fprintf(stderr, "%s DRI driver expected DRM version %d.%d.x - %d.x.x " - "but got version %d.%d.%d\n", driver_name, - drm_expected.major, drm_expected.minor, drm_compat.major, - drm_version->major, drm_version->minor, drm_version->patch); - return NULL; - } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index c308339f2a..aeb3cb3f07 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -512,6 +512,13 @@ static GLboolean viaSetTexImages(GLcontext *ctx, numLevels = lastLevel - firstLevel + 1; + /* The hardware supports only 10 mipmap levels; ignore higher levels. + */ + if ((numLevels > 10) && (ctx->Const.MaxTextureLevels > 10)) { + lastLevel -= numLevels - 10; + numLevels = 10; + } + /* save these values, check if they effect the residency of the * texture: */ -- cgit v1.2.3