i965: Move CACHE_NEW_SAMPLER to BRW_NEW_SAMPLER_STATE_TABLE.

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>
This commit is contained in:
Kenneth Graunke
2014-09-26 10:49:44 -07:00
parent 324368b500
commit e563c33d57
6 changed files with 12 additions and 11 deletions
+2 -2
View 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)
@@ -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;
}
}
+1 -1
View 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),
+3 -3
View 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,
};
+3 -3
View 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,
};
@@ -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,
};