[Mesa-dev] [PATCH 1/2] i965: Add a new debug mode for the VUE map

Kenneth Graunke kenneth at whitecape.org
Sun Aug 4 14:43:23 PDT 2013


On 08/03/2013 07:41 PM, Chris Forbes wrote:
> INTEL_DEBUG=vue now emits a listing of each slot in the VUE map,
> and the corresponding interpolation mode.
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>   src/mesa/drivers/dri/i965/brw_interpolation_map.c | 28 +++++++++++++++++++++++
>   src/mesa/drivers/dri/i965/intel_context.c         |  1 +
>   src/mesa/drivers/dri/i965/intel_context.h         |  1 +
>   3 files changed, 30 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_interpolation_map.c b/src/mesa/drivers/dri/i965/brw_interpolation_map.c
> index 7b7dbef..a7df8e6 100644
> --- a/src/mesa/drivers/dri/i965/brw_interpolation_map.c
> +++ b/src/mesa/drivers/dri/i965/brw_interpolation_map.c
> @@ -23,6 +23,18 @@
>
>   #include "brw_state.h"
>
> +static char const *get_qual_name(int mode)
> +{
> +   switch (mode) {
> +      case INTERP_QUALIFIER_NONE: return "none";
> +      case INTERP_QUALIFIER_FLAT: return "flat";
> +      case INTERP_QUALIFIER_SMOOTH: return "smooth";
> +      case INTERP_QUALIFIER_NOPERSPECTIVE: return "nopersp";
> +      default:
> +                                           return "???";

Weird whitespace!  Personally, I'd probably line them all up with 
"nopersp" and combine the default: and return "???" lines like the other 
cases.

> +   }
> +}
> +
>
>   /* Set up interpolation modes for every element in the VUE */
>   static void
> @@ -72,6 +84,22 @@ brw_setup_vue_interpolation(struct brw_context *brw)
>
>         brw->interpolation_mode.mode[i] = mode;
>      }
> +
> +   if (unlikely(INTEL_DEBUG & DEBUG_VUE)) {
> +      printf("VUE map:\n");
> +      for (int i=0; i < vue_map->num_slots; i++) {

Spaces around = please.

Otherwise, looks good to me!  It's nice to have a debug flag for this.

Both patches are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +         int varying = vue_map->slot_to_varying[i];
> +         if (varying == -1) {
> +            printf("%d: --\n", i);
> +            continue;
> +         }
> +
> +         printf("%d: %d %s ofs %d\n",
> +               i, varying,
> +               get_qual_name(brw->interpolation_mode.mode[i]),
> +               brw_vue_slot_to_offset(i));
> +      }
> +   }
>   }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
> index 7860e1f..cf2d02e 100644
> --- a/src/mesa/drivers/dri/i965/intel_context.c
> +++ b/src/mesa/drivers/dri/i965/intel_context.c
> @@ -332,6 +332,7 @@ static const struct dri_debug_control debug_control[] = {
>      { "shader_time", DEBUG_SHADER_TIME },
>      { "no16",  DEBUG_NO16 },
>      { "blorp", DEBUG_BLORP },
> +   { "vue",   DEBUG_VUE },
>      { NULL,    0 }
>   };
>
> diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
> index 188ac89..734c57c 100644
> --- a/src/mesa/drivers/dri/i965/intel_context.h
> +++ b/src/mesa/drivers/dri/i965/intel_context.h
> @@ -190,6 +190,7 @@ extern int INTEL_DEBUG;
>   #define DEBUG_SHADER_TIME 0x8000000
>   #define DEBUG_BLORP     0x10000000
>   #define DEBUG_NO16      0x20000000
> +#define DEBUG_VUE       0x40000000
>
>   #ifdef HAVE_ANDROID_PLATFORM
>   #define LOG_TAG "INTEL-MESA"
>



More information about the mesa-dev mailing list