Mesa (nvfx-next-6): nvfx: new 2D: enable swizzling for all surfaces

Luca Barbieri lb at kemper.freedesktop.org
Sun Apr 18 14:25:33 UTC 2010


Module: Mesa
Branch: nvfx-next-6
Commit: 1aeda5b86c260184a8d2680b13fde7f5f40bfe29
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1aeda5b86c260184a8d2680b13fde7f5f40bfe29

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Mon Jan 18 23:40:22 2010 +0100

nvfx: new 2D: enable swizzling for all surfaces

Now that the new 2D code is in place, swizzling can be safely enabled.

Render temporaries are needed in some cases, so this may degrade nv30
a bit until it gets render temporaries too.

---

 src/gallium/drivers/nvfx/nvfx_miptree.c |   23 +++++------------------
 1 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 3b3fb20..8e7655a 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -18,32 +18,19 @@ nvfx_miptree_choose_format(struct nvfx_miptree *mt)
 	unsigned uniform_pitch = 0;
 	static int no_swizzle = -1;
 	if(no_swizzle < 0)
-		no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE);
+		no_swizzle = debug_get_bool_option("NV40_NO_SWIZZLE", FALSE); /* this will break things on nv30 */
 
-	/* Non-uniform pitch textures must be POT */
-	if (pt->width0 & (pt->width0 - 1) ||
-	    pt->height0 & (pt->height0 - 1) ||
-	    pt->depth0 & (pt->depth0 - 1)
+	if (!util_is_pot(pt->width0) ||
+	    !util_is_pot(pt->height0) ||
+	    !util_is_pot(pt->depth0)
 	    )
 		uniform_pitch = 1;
 
-	/* All texture formats except compressed ones can be swizzled
-	 * Unsure about depth, let's prevent swizzling for now
-	 */
 	if (
-		(pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_DEPTH_STENCIL))
+		(pt->bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET))
 		|| (pt->_usage & PIPE_USAGE_DYNAMIC)
-		|| util_format_is_depth_or_stencil(pt->format)
 		|| util_format_is_s3tc(pt->format)
-		// disable swizzled textures on NV04-NV20 as our current drivers don't fully support that
-		// TODO: hardware should support them, fix the drivers and reenable
-		|| nouveau_screen(pt->screen)->device->chipset < 0x30
 		|| no_swizzle
-
-		// disable swizzling for non-RGBA 2D because our current 2D code can't handle anything
-		// else correctly, and even that is semi-broken
-		|| pt->target != PIPE_TEXTURE_2D
-		|| (pt->format != PIPE_FORMAT_B8G8R8A8_UNORM && pt->format != PIPE_FORMAT_B8G8R8X8_UNORM)
 	)
 		mt->base.base.flags |= NVFX_RESOURCE_FLAG_LINEAR;
 




More information about the mesa-commit mailing list