Mesa (master): nvfx: move check for NOUVEAU_SWTNL

Luca Barbieri lb at kemper.freedesktop.org
Mon Apr 12 16:21:53 UTC 2010


Module: Mesa
Branch: master
Commit: 8f0d5382e3aa38852be28e89993cb540293b9272
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f0d5382e3aa38852be28e89993cb540293b9272

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Mon Apr 12 18:06:06 2010 +0200

nvfx: move check for NOUVEAU_SWTNL

---

 src/gallium/drivers/nvfx/nvfx_screen.c |    2 ++
 src/gallium/drivers/nvfx/nvfx_screen.h |    1 +
 src/gallium/drivers/nvfx/nvfx_vbo.c    |   13 ++-----------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 893086c..cf619f2 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -371,6 +371,8 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 		return NULL;
 	}
 
+	screen->force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", FALSE);
+
 	nvfx_screen_init_resource_functions(pscreen);
 	nvfx_screen_init_buffer_functions(screen);
 
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h
index 14bd633..ba9a699 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -14,6 +14,7 @@ struct nvfx_screen {
 
 	unsigned is_nv4x; /* either 0 or ~0 */
 	int vertex_buffer_flags;
+	boolean force_swtnl;
 
 	/* HW graphics objects */
 	struct nv04_surface_2d *eng2d;
diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c
index 74de3a7..8c71aa3 100644
--- a/src/gallium/drivers/nvfx/nvfx_vbo.c
+++ b/src/gallium/drivers/nvfx/nvfx_vbo.c
@@ -11,15 +11,6 @@
 #include "nouveau/nouveau_pushbuf.h"
 #include "nouveau/nouveau_util.h"
 
-static boolean
-nvfx_force_swtnl(struct nvfx_context *nvfx)
-{
-	static int force_swtnl = -1;
-	if(force_swtnl < 0)
-		force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", 0);
-	return force_swtnl;
-}
-
 static INLINE int
 nvfx_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
 {
@@ -166,7 +157,7 @@ nvfx_draw_arrays(struct pipe_context *pipe,
 	unsigned restart = 0;
 
 	nvfx_vbo_set_idxbuf(nvfx, NULL, 0);
-	if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+	if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
 		nvfx_draw_elements_swtnl(pipe, NULL, 0,
                                            mode, start, count);
                 return;
@@ -467,7 +458,7 @@ nvfx_draw_elements(struct pipe_context *pipe,
 	boolean idxbuf;
 
 	idxbuf = nvfx_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
-	if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+	if (nvfx->screen->force_swtnl || !nvfx_state_validate(nvfx)) {
 		nvfx_draw_elements_swtnl(pipe, indexBuffer, indexSize,
                                            mode, start, count);
 		return;




More information about the mesa-commit mailing list