Print NOUVEAU_NO_SWIZZLE and NOUVEAU_NO_TRANSFER messages only once
PATCH 1/1 Print NOUVEAU_NO_SWIZZLE and NOUVEAU_NO_TRANSFER messages only once
Currently we are continuously spewing messages 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/nv04/nv04_transfer.c | 6 ++++-- src/gallium/drivers/nv10/nv10_transfer.c | 6 ++++-- src/gallium/drivers/nv20/nv20_miptree.c | 5 ++++- src/gallium/drivers/nv20/nv20_transfer.c | 6 ++++-- src/gallium/drivers/nv30/nv30_miptree.c | 5 ++++- src/gallium/drivers/nv30/nv30_transfer.c | 6 ++++-- src/gallium/drivers/nv40/nv40_miptree.c | 5 ++++- src/gallium/drivers/nv40/nv40_transfer.c | 6 ++++-- 8 files changed, 32 insertions(+), 13 deletions(-)
src/gallium/drivers/nv04/nv04_transfer.c +4 -2
@@ -41,6 +41,9 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv04_miptree *mt = (struct nv04_miptree *)pt;struct nv04_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 (nv04_transfer);if (!tx)
@@ -58,8 +61,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, 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;
src/gallium/drivers/nv10/nv10_transfer.c +4 -2
@@ -41,6 +41,9 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv10_miptree *mt = (struct nv10_miptree *)pt;struct nv10_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 (nv10_transfer);if (!tx)
@@ -58,8 +61,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, 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;
src/gallium/drivers/nv20/nv20_miptree.c +4 -1
@@ -89,6 +89,9 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)struct nv20_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 nv20_miptree ));if (!mt)
@@ -116,7 +119,7 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)case PIPE_FORMAT_X8R8G8B8_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 ; }
src/gallium/drivers/nv20/nv20_transfer.c +4 -2
@@ -41,6 +41,9 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv20_miptree *mt = (struct nv20_miptree *)pt;struct nv20_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 (nv20_transfer);if (!tx)
@@ -58,8 +61,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, 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;
src/gallium/drivers/nv30/nv30_miptree.c +4 -1
@@ -65,6 +65,9 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)struct nv30_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 nv30_miptree ));if (!mt)
@@ -97,7 +100,7 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)case PIPE_FORMAT_L8_UNORM :case PIPE_FORMAT_I8_UNORM : { -if (debug_get_bool_option ("NOUVEAU_NO_SWIZZLE" , FALSE)) +if (no_swizzle) mt->base.tex_usage |=NOUVEAU_TEXTURE_USAGE_LINEAR ;break ; }
src/gallium/drivers/nv30/nv30_transfer.c +4 -2
@@ -41,6 +41,9 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv30_miptree *mt = (struct nv30_miptree *)pt;struct nv30_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 (nv30_transfer);if (!tx)
@@ -58,8 +61,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, 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;
src/gallium/drivers/nv40/nv40_miptree.c +4 -1
@@ -67,6 +67,9 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)struct nv40_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 nv40_miptree ));if (!mt)
@@ -94,7 +97,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)case PIPE_FORMAT_X8R8G8B8_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 ; }
src/gallium/drivers/nv40/nv40_transfer.c +4 -2
@@ -41,6 +41,9 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,struct nv40_miptree *mt = (struct nv40_miptree *)pt;struct nv40_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 (nv40_transfer);if (!tx)
@@ -58,8 +61,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, 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;
Signature · 1 line
1.6.3.3
A message that is not in the archive (sent off-list or not yet received): 1262262260-3526-1-git-send-email-luca-Ukmtq+NC3rhBHFWNQifrYwC/[email protected]
Quoted 4 lines · Luca Barbieri
Currently we are continuously spewing messages messages about these variables since we call
debug_get_bool_optioneverytime we want to check their value This is annoying, slows things down due to terminal rerendering and obscures useful messages.
This patch only callsdebug_get_bool_optiononce and caches the result in a static variable.
---
I found this annoying too, on the nv30 that I don't use much. Thanks for the patch, it works nicely :)