Added an option texture_heaps that allows selecting which texture heaps
authorFelix Kuehling <fxkuehl@gmx.de>
Fri, 4 Feb 2005 00:25:41 +0000 (00:25 +0000)
committerFelix Kuehling <fxkuehl@gmx.de>
Fri, 4 Feb 2005 00:25:41 +0000 (00:25 +0000)
will be used. Implemented this option in the Savage driver. On my
ProSavageDDR uploads to AGP memory are about 1.5 times as fast as
uploads to card memory. On non-IGP hardware the difference may be even
bigger. Now mplayer -gl is getting really usable.

src/mesa/drivers/dri/common/xmlpool.h
src/mesa/drivers/dri/savage/savage_xmesa.c

index 789d14fe2a113a7c1e4a6ef855057b522938c4e7..29b5bf597d99e4bbf90ac7951713f6ba62d97453 100644 (file)
@@ -293,6 +293,23 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
         DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
 DRI_CONF_OPT_END
 
+#define DRI_CONF_TEXTURE_HEAPS_ALL 0
+#define DRI_CONF_TEXTURE_HEAPS_CARD 1
+#define DRI_CONF_TEXTURE_HEAPS_GART 2
+#define DRI_CONF_TEXTURE_HEAPS(def) \
+DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
+       DRI_CONF_DESC_BEGIN(en,"Used types of texture memory") \
+               DRI_CONF_ENUM(0,"All available") \
+               DRI_CONF_ENUM(1,"Only card memory (if available)") \
+               DRI_CONF_ENUM(2,"Only GART (AGP/PCIE) memory (if available)") \
+       DRI_CONF_DESC_END \
+       DRI_CONF_DESC_BEGIN(de,"Verwendete Texturspeicherarten") \
+               DRI_CONF_ENUM(0,"Alle verfügbaren") \
+               DRI_CONF_ENUM(1,"Nur Grafikspeicher (falls vorhanden)") \
+               DRI_CONF_ENUM(2,"Nur GART (AGP/PCIE) Speicher (falls vorhanden)") \
+       DRI_CONF_DESC_END \
+DRI_CONF_OPT_END
+
 /* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
    On cards where there is no documentation (r200) or on rasterization-only hardware). */
 #define DRI_CONF_SECTION_SOFTWARE \
index 1ce8a4b88fd422e35a8fb859f1c8de67ed155a3d..9abb5584714b01fe657bece0233e45a5730d829c 100644 (file)
@@ -83,12 +83,13 @@ DRI_CONF_BEGIN
         DRI_CONF_MAX_TEXTURE_UNITS(2,1,2)
         SAVAGE_ENABLE_VDMA(true)
         SAVAGE_ENABLE_FASTPATH(true)
+       DRI_CONF_TEXTURE_HEAPS(DRI_CONF_TEXTURE_HEAPS_ALL)
     DRI_CONF_SECTION_END
     DRI_CONF_SECTION_DEBUG
         DRI_CONF_NO_RAST(false)
     DRI_CONF_SECTION_END
 DRI_CONF_END;
-static const GLuint __driNConfigOptions = 7;
+static const GLuint __driNConfigOptions = 8;
 
 #ifdef USE_NEW_INTERFACE
 static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
@@ -295,6 +296,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
    savageScreenPrivate *savageScreen = (savageScreenPrivate *)sPriv->private;
    drm_savage_sarea_t *saPriv=(drm_savage_sarea_t *)(((char*)sPriv->pSAREA)+
                                                 savageScreen->sarea_priv_offset);
+   int textureSize[SAVAGE_NR_TEX_HEAPS];
    int i;
    imesa = (savageContextPtr)Xcalloc(sizeof(savageContext), 1);
    if (!imesa) {
@@ -367,11 +369,25 @@ savageCreateContext( const __GLcontextModes *mesaVis,
    (void) memset( imesa->textureHeaps, 0, sizeof( imesa->textureHeaps ) );
    make_empty_list( & imesa->swapped );
 
+   textureSize[SAVAGE_CARD_HEAP] = savageScreen->textureSize[SAVAGE_CARD_HEAP];
+   textureSize[SAVAGE_AGP_HEAP] = savageScreen->textureSize[SAVAGE_AGP_HEAP];
    imesa->lastTexHeap = savageScreen->texVirtual[SAVAGE_AGP_HEAP] ? 2 : 1;
+   switch(driQueryOptioni (&imesa->optionCache, "texture_heaps")) {
+   case DRI_CONF_TEXTURE_HEAPS_CARD: /* only use card memory, if available */
+       if (textureSize[SAVAGE_CARD_HEAP])
+          imesa->lastTexHeap = 1;
+       break;
+   case DRI_CONF_TEXTURE_HEAPS_GART: /* only use gart memory, if available */
+       if (imesa->lastTexHeap == 2 && textureSize[SAVAGE_AGP_HEAP])
+          textureSize[SAVAGE_CARD_HEAP] = 0;
+       break;
+   /*default: Nothing to do, use all available memory. */
+   }
+   
    for (i = 0; i < imesa->lastTexHeap; i++) {
        imesa->textureHeaps[i] = driCreateTextureHeap(
           i, imesa,
-          savageScreen->textureSize[i],
+          textureSize[i],
           11,                                  /* 2^11 = 2k alignment */
           SAVAGE_NR_TEX_REGIONS,
           (drmTextureRegionPtr)imesa->sarea->texList[i],