From e563c33d57f779b34d885c561b731b3eb8eb25b7 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 26 Sep 2014 10:49:44 -0700 Subject: [PATCH] i965: Move CACHE_NEW_SAMPLER to BRW_NEW_SAMPLER_STATE_TABLE. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Kristian Høgsberg Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_context.h | 4 ++-- src/mesa/drivers/dri/i965/brw_sampler_state.c | 2 +- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_state.c | 6 +++--- src/mesa/drivers/dri/i965/brw_wm_state.c | 6 +++--- src/mesa/drivers/dri/i965/gen6_sampler_state.c | 3 ++- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index cd1daee6064..fac22dc99a9 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -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<state.dirty.cache |= CACHE_NEW_SAMPLER; + brw->state.dirty.brw |= BRW_NEW_SAMPLER_STATE_TABLE; } } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index db0119cde22..57c451900ee 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -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), diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index 351f7ef8cfa..f9ee2d04a1d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -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, }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 2f315c6996f..763ea5ff4d0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -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, }; diff --git a/src/mesa/drivers/dri/i965/gen6_sampler_state.c b/src/mesa/drivers/dri/i965/gen6_sampler_state.c index 288470a8826..a7402cf64e4 100644 --- a/src/mesa/drivers/dri/i965/gen6_sampler_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sampler_state.c @@ -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, }; -- 2.30.2