Mesa (mesa_7_7_branch): st/xorg: speculatively round textures up to nearest POT

Keith Whitwell keithw at kemper.freedesktop.org
Fri Nov 27 12:26:28 UTC 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: cf3cdda5cc413093126c7ba42248c3b175a2d126
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf3cdda5cc413093126c7ba42248c3b175a2d126

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Nov 27 12:24:42 2009 +0000

st/xorg: speculatively round textures up to nearest POT

I'm not sure if this is a great change, but helps with caching.
Probably we want to turn this on/off on a driver-by-driver basis.

---

 src/gallium/state_trackers/xorg/xorg_exa.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 9a7384d..a22f15f 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -44,6 +44,8 @@
 #include "pipe/p_inlines.h"
 
 #include "util/u_rect.h"
+#include "util/u_math.h"
+#include "util/u_debug.h"
 
 #define DEBUG_PRINT 0
 
@@ -831,6 +833,17 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
     if (!priv || pPixData)
 	return FALSE;
 
+    if (0) {
+       debug_printf("%s pixmap %p sz %dx%dx%d devKind %d\n",
+                    __FUNCTION__, pPixmap, width, height, bitsPerPixel, devKind);
+       
+       if (priv->tex)
+          debug_printf("  ==> old texture %dx%d\n",
+                       priv->tex->width[0], 
+                       priv->tex->height[0]);
+    }
+
+
     if (depth <= 0)
 	depth = pPixmap->drawable.depth;
 
@@ -862,8 +875,13 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
 	template.target = PIPE_TEXTURE_2D;
 	exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format);
 	pf_get_block(template.format, &template.block);
+#if 1
+	template.width[0] = util_next_power_of_two(width);
+	template.height[0] = util_next_power_of_two(height);
+#else
 	template.width[0] = width;
 	template.height[0] = height;
+#endif
 	template.depth[0] = 1;
 	template.last_level = 0;
 	template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags;




More information about the mesa-commit mailing list