[Mesa-dev] [PATCH] i965: Add some missing bits to {mesa, brw, cache}_bits[].

Kenneth Graunke kenneth at whitecape.org
Sat Sep 14 14:22:52 PDT 2013


On 09/14/2013 10:29 AM, Paul Berry wrote:
> These data structures are used for debug output, so it wasn't hurting
> anything that there were missing bits.  But it's good to keep things
> up to date.
> 
> This patch also adds static asserts so that the {brw,cache}_bits[]
> arrays are the proper size, so that we don't forget to add to them in
> the future.  Unfortunately there's no convenient way to assert that
> mesa_bits[] is the proper size.
> ---
>  src/mesa/drivers/dri/i965/brw_context.h      |  2 ++
>  src/mesa/drivers/dri/i965/brw_state_upload.c | 12 ++++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 108e98c..b697bec 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -780,6 +780,8 @@ enum shader_time_shader_type {
>  #define CACHE_NEW_CC_VP                  (1<<BRW_CC_VP)
>  #define CACHE_NEW_CC_UNIT                (1<<BRW_CC_UNIT)
>  #define CACHE_NEW_WM_PROG                (1<<BRW_WM_PROG)
> +#define CACHE_NEW_BLORP_BLIT_PROG        (1<<BRW_BLORP_BLIT_PROG)
> +#define CACHE_NEW_BLORP_CONST_COLOR_PROG (1<<BRW_BLORP_CONST_COLOR_PROG)
>  #define CACHE_NEW_SAMPLER                (1<<BRW_SAMPLER)
>  #define CACHE_NEW_WM_UNIT                (1<<BRW_WM_UNIT)
>  #define CACHE_NEW_SF_PROG                (1<<BRW_SF_PROG)
> diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
> index 8f21f06..d7fe319 100644
> --- a/src/mesa/drivers/dri/i965/brw_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
> @@ -359,6 +359,7 @@ static struct dirty_bit_map mesa_bits[] = {
>     DEFINE_BIT(_NEW_ARRAY),
>     DEFINE_BIT(_NEW_RENDERMODE),
>     DEFINE_BIT(_NEW_BUFFERS),
> +   DEFINE_BIT(_NEW_CURRENT_ATTRIB),
>     DEFINE_BIT(_NEW_MULTISAMPLE),
>     DEFINE_BIT(_NEW_TRACK_MATRIX),
>     DEFINE_BIT(_NEW_PROGRAM),
> @@ -372,6 +373,7 @@ static struct dirty_bit_map mesa_bits[] = {
>  static struct dirty_bit_map brw_bits[] = {
>     DEFINE_BIT(BRW_NEW_URB_FENCE),
>     DEFINE_BIT(BRW_NEW_FRAGMENT_PROGRAM),
> +   DEFINE_BIT(BRW_NEW_GEOMETRY_PROGRAM),
>     DEFINE_BIT(BRW_NEW_VERTEX_PROGRAM),
>     DEFINE_BIT(BRW_NEW_CURBE_OFFSETS),
>     DEFINE_BIT(BRW_NEW_REDUCED_PRIMITIVE),
> @@ -387,14 +389,18 @@ static struct dirty_bit_map brw_bits[] = {
>     DEFINE_BIT(BRW_NEW_BATCH),
>     DEFINE_BIT(BRW_NEW_INDEX_BUFFER),
>     DEFINE_BIT(BRW_NEW_VS_CONSTBUF),
> +   DEFINE_BIT(BRW_NEW_GS_CONSTBUF),
>     DEFINE_BIT(BRW_NEW_PROGRAM_CACHE),
>     DEFINE_BIT(BRW_NEW_STATE_BASE_ADDRESS),
> +   DEFINE_BIT(BRW_NEW_VUE_MAP_VS),
>     DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT),
>     DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK),
>     DEFINE_BIT(BRW_NEW_RASTERIZER_DISCARD),
> +   DEFINE_BIT(BRW_NEW_STATS_WM),
>     DEFINE_BIT(BRW_NEW_UNIFORM_BUFFER),
>     DEFINE_BIT(BRW_NEW_META_IN_PROGRESS),
>     DEFINE_BIT(BRW_NEW_INTERPOLATION_MAP),
> +   DEFINE_BIT(BRW_NEW_PUSH_CONSTANT_ALLOCATION),
>     {0, 0, 0}
>  };
>  
> @@ -402,6 +408,8 @@ static struct dirty_bit_map cache_bits[] = {
>     DEFINE_BIT(CACHE_NEW_CC_VP),
>     DEFINE_BIT(CACHE_NEW_CC_UNIT),
>     DEFINE_BIT(CACHE_NEW_WM_PROG),
> +   DEFINE_BIT(CACHE_NEW_BLORP_BLIT_PROG),
> +   DEFINE_BIT(CACHE_NEW_BLORP_CONST_COLOR_PROG),
>     DEFINE_BIT(CACHE_NEW_SAMPLER),
>     DEFINE_BIT(CACHE_NEW_WM_UNIT),
>     DEFINE_BIT(CACHE_NEW_SF_PROG),
> @@ -411,6 +419,7 @@ static struct dirty_bit_map cache_bits[] = {
>     DEFINE_BIT(CACHE_NEW_VS_PROG),
>     DEFINE_BIT(CACHE_NEW_FF_GS_UNIT),
>     DEFINE_BIT(CACHE_NEW_FF_GS_PROG),
> +   DEFINE_BIT(CACHE_NEW_GS_PROG),
>     DEFINE_BIT(CACHE_NEW_CLIP_VP),
>     DEFINE_BIT(CACHE_NEW_CLIP_UNIT),
>     DEFINE_BIT(CACHE_NEW_CLIP_PROG),
> @@ -532,6 +541,9 @@ void brw_upload_state(struct brw_context *brw)
>     }
>  
>     if (unlikely(INTEL_DEBUG & DEBUG_STATE)) {
> +      STATIC_ASSERT(ARRAY_SIZE(brw_bits) == BRW_NUM_STATE_BITS + 1);
> +      STATIC_ASSERT(ARRAY_SIZE(cache_bits) == BRW_MAX_CACHE + 1);
> +
>        brw_update_dirty_count(mesa_bits, state->mesa);
>        brw_update_dirty_count(brw_bits, state->brw);
>        brw_update_dirty_count(cache_bits, state->cache);
> 

I especially like the assertions.

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


More information about the mesa-dev mailing list