Mesa (nvfx-next-7h): [HACK] nvfx: limit texture size if program is tuxracer

Luca Barbieri lb at kemper.freedesktop.org
Thu Aug 19 15:07:05 UTC 2010


Module: Mesa
Branch: nvfx-next-7h
Commit: d0d27a10dbe9aca2cf82022c315d775909534d1f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0d27a10dbe9aca2cf82022c315d775909534d1f

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Tue Aug 17 01:02:06 2010 +0200

[HACK] nvfx: limit texture size if program is tuxracer

Otherwise, it runs out of memory on 128MB GART + 128MB VRAM machines.

---

 src/gallium/drivers/nvfx/nvfx_buffer.c |    3 ++-
 src/gallium/drivers/nvfx/nvfx_screen.c |    5 +++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c
index 89bb857..94cf3c0 100644
--- a/src/gallium/drivers/nvfx/nvfx_buffer.c
+++ b/src/gallium/drivers/nvfx/nvfx_buffer.c
@@ -15,7 +15,8 @@ void nvfx_buffer_destroy(struct pipe_screen *pscreen,
 
 	if(!(buffer->base.base.flags & NVFX_RESOURCE_FLAG_USER))
 		align_free(buffer->data);
-	nouveau_screen_bo_release(pscreen, buffer->base.bo);
+	if(buffer->base.bo)
+		nouveau_screen_bo_release(pscreen, buffer->base.bo);
 	FREE(buffer);
 }
 
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 72cb523..a81a898 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -30,6 +30,8 @@ struct nouveau_winsys {
 #define NV4X_GRCLASS4497_CHIPSETS 0x00005450
 #define NV6X_GRCLASS4497_CHIPSETS 0x00000088
 
+extern const char* program_invocation_short_name;
+
 static int
 nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 {
@@ -60,6 +62,9 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 	case PIPE_CAP_TEXTURE_SWIZZLE:
 		return 1;
 	case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+		/* nudge this thing to consume a sensible amount  vram */
+		if(!strcmp(program_invocation_short_name, "etracer") || !strcmp(program_invocation_short_name, "ppracer") || !strcmp(program_invocation_short_name, "tuxracer"))
+			return 10;
 		return 13;
 	case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
 		return 10;




More information about the mesa-commit mailing list