nvfx: stop incessantly spewing debug messages on the terminal
authorLuca Barbieri <luca@luca-barbieri.com>
Wed, 17 Mar 2010 19:31:56 +0000 (20:31 +0100)
committerLuca Barbieri <luca@luca-barbieri.com>
Tue, 23 Mar 2010 14:40:41 +0000 (15:40 +0100)
Currently we are continuously spewing messages about these variables
since we call debug_get_bool_option everytime we want to check their value.

This is annoying, slows things down due to terminal rerendering
and obscures useful messages.

This patch only calls debug_get_bool_option once and caches the result in a
static variable.

src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_transfer.c

index 0f5ed61aab74002c6569179108c32829404d50f0..9de25175e78add1dc25f1ed28bf2a3996b7c5b10 100644 (file)
@@ -67,6 +67,9 @@ nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
        struct nvfx_miptree *mt;
        unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
                             NOUVEAU_BUFFER_USAGE_TEXTURE;
+       static int no_swizzle = -1;
+       if(no_swizzle < 0)
+               no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE);
 
        mt = MALLOC(sizeof(struct nvfx_miptree));
        if (!mt)
@@ -106,7 +109,7 @@ nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
                case PIPE_FORMAT_B8G8R8X8_UNORM:
                case PIPE_FORMAT_R16_SNORM:
                {
-                       if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE))
+                       if (no_swizzle)
                                mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
                        break;
                }
index 409b354d5823f6dde7370297ec08a34f44ad8533..c81b44a789b68fa14e0603cb1e7583d45926b19f 100644 (file)
@@ -42,6 +42,9 @@ nvfx_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
        struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
        struct nvfx_transfer *tx;
        struct pipe_texture tx_tex_template, *tx_tex;
+       static int no_transfer = -1;
+       if(no_transfer < 0)
+               no_transfer = debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/);
 
        tx = CALLOC_STRUCT(nvfx_transfer);
        if (!tx)
@@ -59,8 +62,7 @@ nvfx_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
        tx->base.zslice = zslice;
 
        /* Direct access to texture */
-       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
-            debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+       if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || no_transfer) &&
            pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
        {
                tx->direct = true;