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>
BRW_STATE_CC_VP,
BRW_STATE_SF_VP,
BRW_STATE_CLIP_VP,
+ BRW_STATE_SAMPLER_STATE_TABLE,
BRW_NUM_STATE_BITS
};
#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 */
enum brw_cache_id {
BRW_WM_PROG,
BRW_BLORP_BLIT_PROG,
- BRW_SAMPLER,
BRW_SF_PROG,
BRW_VS_PROG,
BRW_FF_GS_PROG,
*/
#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)
/* 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;
}
}
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),
/* 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,
.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,
};
}
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 {
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,
};
.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,
};