i965: Move CACHE_NEW_SAMPLER to BRW_NEW_SAMPLER_STATE_TABLE.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 26 Sep 2014 17:49:44 +0000 (10:49 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 29 Nov 2014 10:18:46 +0000 (02:18 -0800)
This flag signifies that we've emitted a new SAMPLER_STATE table.
Given that we haven't cached those in years, CACHE_NEW_SAMPLER isn't
a great name.  Putting it in the BRW_NEW_* hierarchy would make more
sense; BRW_NEW_SAMPLER_STATE_TABLE better reflects its actual purpose.

When this flag is raised, the pointer to the SAMPLER_STATE table has
changed, so we need to re-issue any packets which point to it (unit
state on Gen4-5, 3DSTATE_SAMPLER_STATE_POINTERS on Gen6, and the
per-stage variants on Gen7+).

Saves 2 * sizeof(void *) bytes per context, as we remove useless
aux_compare/aux_free function pointers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_sampler_state.c
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/brw_vs_state.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/gen6_sampler_state.c

index cd1daee606413f41513b3d66ac3dca8582192bd1..fac22dc99a91d3593c96c63c5dc4c56b040eec55 100644 (file)
@@ -187,6 +187,7 @@ enum brw_state_id {
    BRW_STATE_CC_VP,
    BRW_STATE_SF_VP,
    BRW_STATE_CLIP_VP,
+   BRW_STATE_SAMPLER_STATE_TABLE,
    BRW_NUM_STATE_BITS
 };
 
@@ -232,6 +233,7 @@ enum brw_state_id {
 #define BRW_NEW_CC_VP                   (1ull << BRW_STATE_CC_VP)
 #define BRW_NEW_SF_VP                   (1ull << BRW_STATE_SF_VP)
 #define BRW_NEW_CLIP_VP                 (1ull << BRW_STATE_CLIP_VP)
+#define BRW_NEW_SAMPLER_STATE_TABLE     (1ull << BRW_STATE_SAMPLER_STATE_TABLE)
 
 struct brw_state_flags {
    /** State update flags signalled by mesa internals */
@@ -693,7 +695,6 @@ struct brw_gs_prog_data
 enum brw_cache_id {
    BRW_WM_PROG,
    BRW_BLORP_BLIT_PROG,
-   BRW_SAMPLER,
    BRW_SF_PROG,
    BRW_VS_PROG,
    BRW_FF_GS_PROG,
@@ -778,7 +779,6 @@ enum shader_time_shader_type {
  */
 #define CACHE_NEW_WM_PROG                (1<<BRW_WM_PROG)
 #define CACHE_NEW_BLORP_BLIT_PROG        (1<<BRW_BLORP_BLIT_PROG)
-#define CACHE_NEW_SAMPLER                (1<<BRW_SAMPLER)
 #define CACHE_NEW_SF_PROG                (1<<BRW_SF_PROG)
 #define CACHE_NEW_VS_PROG                (1<<BRW_VS_PROG)
 #define CACHE_NEW_FF_GS_PROG             (1<<BRW_FF_GS_PROG)
index 8363a48ef717a330f28f9db70487cc1c13c7a73c..9c5e45c7eb244ed89b0c28bc58cfe02927c22357 100644 (file)
@@ -512,7 +512,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
       /* Flag that the sampler state table pointer has changed; later atoms
        * will handle it.
        */
-      brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
+      brw->state.dirty.brw |= BRW_NEW_SAMPLER_STATE_TABLE;
    }
 }
 
index db0119cde22a459ce11760cd3d00ff2768ac05de..57c451900ee6bc95ab437c4ee7add6df0673cd26 100644 (file)
@@ -523,13 +523,13 @@ static struct dirty_bit_map brw_bits[] = {
    DEFINE_BIT(BRW_NEW_CC_VP),
    DEFINE_BIT(BRW_NEW_SF_VP),
    DEFINE_BIT(BRW_NEW_CLIP_VP),
+   DEFINE_BIT(BRW_NEW_SAMPLER_STATE_TABLE),
    {0, 0, 0}
 };
 
 static struct dirty_bit_map cache_bits[] = {
    DEFINE_BIT(CACHE_NEW_WM_PROG),
    DEFINE_BIT(CACHE_NEW_BLORP_BLIT_PROG),
-   DEFINE_BIT(CACHE_NEW_SAMPLER),
    DEFINE_BIT(CACHE_NEW_SF_PROG),
    DEFINE_BIT(CACHE_NEW_VS_PROG),
    DEFINE_BIT(CACHE_NEW_FF_GS_PROG),
index 351f7ef8cfa0f7dd50bd2fbfd03119910dc9fa4f..f9ee2d04a1d8d3f196823e0134fa337f5d8548ec 100644 (file)
@@ -159,7 +159,7 @@ brw_upload_vs_unit(struct brw_context *brw)
    /* Set the sampler state pointer, and its reloc
     */
    if (stage_state->sampler_count) {
-      /* CACHE_NEW_SAMPLER - reloc */
+      /* BRW_NEW_SAMPLER_STATE_TABLE - reloc */
       vs->vs5.sampler_state_pointer =
          (brw->batch.bo->offset64 + stage_state->sampler_offset) >> 5;
       drm_intel_bo_emit_reloc(brw->batch.bo,
@@ -190,10 +190,10 @@ const struct brw_tracked_state brw_vs_unit = {
       .brw   = BRW_NEW_BATCH |
                BRW_NEW_CURBE_OFFSETS |
                BRW_NEW_PROGRAM_CACHE |
+               BRW_NEW_SAMPLER_STATE_TABLE |
                BRW_NEW_URB_FENCE |
                BRW_NEW_VERTEX_PROGRAM,
-      .cache = CACHE_NEW_SAMPLER |
-               CACHE_NEW_VS_PROG,
+      .cache = CACHE_NEW_VS_PROG,
    },
    .emit = brw_upload_vs_unit,
 };
index 2f315c6996fce9a5bd587e954483151a98df2ae3..763ea5ff4d07a3d48f270eac54fca5682a846ff2 100644 (file)
@@ -154,7 +154,7 @@ brw_upload_wm_unit(struct brw_context *brw)
    }
 
    if (brw->wm.base.sampler_count) {
-      /* CACHE_NEW_SAMPLER - reloc */
+      /* BRW_NEW_SAMPLER_STATE_TABLE - reloc */
       wm->wm4.sampler_state_pointer = (brw->batch.bo->offset64 +
                                       brw->wm.base.sampler_offset) >> 5;
    } else {
@@ -256,9 +256,9 @@ const struct brw_tracked_state brw_wm_unit = {
              BRW_NEW_CURBE_OFFSETS |
              BRW_NEW_FRAGMENT_PROGRAM |
              BRW_NEW_PROGRAM_CACHE |
+             BRW_NEW_SAMPLER_STATE_TABLE |
              BRW_NEW_STATS_WM,
-      .cache = CACHE_NEW_SAMPLER |
-               CACHE_NEW_WM_PROG,
+      .cache = CACHE_NEW_WM_PROG,
    },
    .emit = brw_upload_wm_unit,
 };
index 288470a8826c53e0b7752c6da939291270120c6b..a7402cf64e42044dc4d582fa9ac8b440ec7bb15e 100644 (file)
@@ -49,8 +49,9 @@ const struct brw_tracked_state gen6_sampler_state = {
    .dirty = {
       .mesa = 0,
       .brw = BRW_NEW_BATCH |
+             BRW_NEW_SAMPLER_STATE_TABLE |
              BRW_NEW_STATE_BASE_ADDRESS,
-      .cache = CACHE_NEW_SAMPLER
+      .cache = 0,
    },
    .emit = upload_sampler_state_pointers,
 };