Hi,

Attached patch adds a new DRI configuration option to the unichrome 
3D driver.  It allows the users to turn on 1024x1024 textures in 
driconf, enabling them to run some programs that require these 
bigger textures, for example 'slune'.

The patch also changes the name under which it looks up the 
configuration settings from "via" to "unichrome", as that is what 
driconf calls the driver.  It removes the vertical sync hack, as 
probably the config lookup wasn't working because of the wrong name.  
And it removes the throttle_mode setting as this is now handled on 
the kernel level, says Thomas.

The patch solves https://bugs.freedesktop.org/show_bug.cgi?id=3130 .
It is based on a patch by Boris DuĊĦek, who started from Thomas' 
patch in that bug, plus some corrections by John Nettleton.

There are other settings in the 3D unichrome driver that could be 
added to the options cache, but as they don't seem to do anything 
useful or noticeable, I've left them out.

If applied, please also apply to the Mesa 6.4 branch, as that is the 
only branch that works reliably on a unichrome.

Benno

diff -ur Mesa.head.orig/src/mesa/drivers/dri/common/xmlpool/t_options.h Mesa.head/src/mesa/drivers/dri/common/xmlpool/t_options.h
--- Mesa.head.orig/src/mesa/drivers/dri/common/xmlpool/t_options.h	2006-09-13 22:36:38.000000000 +0200
+++ Mesa.head/src/mesa/drivers/dri/common/xmlpool/t_options.h	2006-10-08 16:02:06.000000000 +0200
@@ -68,6 +68,11 @@
 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 -ur Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_context.c Mesa.head/src/mesa/drivers/dri/unichrome/via_context.c
--- Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_context.c	2006-09-30 19:42:03.000000000 +0200
+++ Mesa.head/src/mesa/drivers/dri/unichrome/via_context.c	2006-10-08 16:02:06.000000000 +0200
@@ -481,7 +481,7 @@
     /* Parse configuration files.
      */
     driParseConfigFiles (&vmesa->optionCache, &viaScreen->optionCache,
-			 sPriv->myNum, "via");
+			 sPriv->myNum, "unichrome");
 
     /* pick back buffer */
     vmesa->hasBack = visual->doubleBufferMode;
@@ -557,8 +557,12 @@
     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;
@@ -657,20 +661,14 @@
        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;
 
@@ -728,7 +726,9 @@
 	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 -ur Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_screen.c Mesa.head/src/mesa/drivers/dri/unichrome/via_screen.c
--- Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_screen.c	2006-09-13 22:36:42.000000000 +0200
+++ Mesa.head/src/mesa/drivers/dri/unichrome/via_screen.c	2006-10-08 16:02:06.000000000 +0200
@@ -46,16 +46,16 @@
 #include "GL/internal/dri_interface.h"
 #include "drirenderbuffer.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
@@ -131,7 +131,6 @@
     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);
@@ -201,6 +200,8 @@
 
     via_free_empty_buffers(viaScreen->bufs);
 
+    driDestroyOptionInfo(&viaScreen->optionCache);
+
     FREE(viaScreen);
     sPriv->private = NULL;
 }
diff -ur Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_tex.c Mesa.head/src/mesa/drivers/dri/unichrome/via_tex.c
--- Mesa.head.orig/src/mesa/drivers/dri/unichrome/via_tex.c	2006-09-30 19:42:03.000000000 +0200
+++ Mesa.head/src/mesa/drivers/dri/unichrome/via_tex.c	2006-10-08 16:02:06.000000000 +0200
@@ -513,6 +513,13 @@
 
    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:
     */

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to