radeonsi: add and use si_pm4_state_enabled_and_changed

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák 2017-08-04 17:06:24 +02:00
parent 58d062b87d
commit a7b0014d1a
3 changed files with 18 additions and 17 deletions

View File

@ -442,26 +442,24 @@ void cik_prefetch_TC_L2_async(struct si_context *sctx, struct pipe_resource *buf
static void cik_prefetch_shader_async(struct si_context *sctx,
struct si_pm4_state *state)
{
if (state) {
struct pipe_resource *bo = &state->bo[0]->b.b;
assert(state->nbo == 1);
struct pipe_resource *bo = &state->bo[0]->b.b;
assert(state->nbo == 1);
cik_prefetch_TC_L2_async(sctx, bo, 0, bo->width0);
}
cik_prefetch_TC_L2_async(sctx, bo, 0, bo->width0);
}
void cik_emit_prefetch_L2(struct si_context *sctx)
{
/* Prefetch shaders and VBO descriptors to TC L2. */
if (si_pm4_state_changed(sctx, ls))
if (si_pm4_state_enabled_and_changed(sctx, ls))
cik_prefetch_shader_async(sctx, sctx->queued.named.ls);
if (si_pm4_state_changed(sctx, hs))
if (si_pm4_state_enabled_and_changed(sctx, hs))
cik_prefetch_shader_async(sctx, sctx->queued.named.hs);
if (si_pm4_state_changed(sctx, es))
if (si_pm4_state_enabled_and_changed(sctx, es))
cik_prefetch_shader_async(sctx, sctx->queued.named.es);
if (si_pm4_state_changed(sctx, gs))
if (si_pm4_state_enabled_and_changed(sctx, gs))
cik_prefetch_shader_async(sctx, sctx->queued.named.gs);
if (si_pm4_state_changed(sctx, vs))
if (si_pm4_state_enabled_and_changed(sctx, vs))
cik_prefetch_shader_async(sctx, sctx->queued.named.vs);
/* Vertex buffer descriptors are uploaded uncached, so prefetch
@ -471,7 +469,7 @@ void cik_emit_prefetch_L2(struct si_context *sctx)
sctx->vertex_buffers.buffer_offset,
sctx->vertex_elements->desc_list_byte_size);
}
if (si_pm4_state_changed(sctx, ps))
if (si_pm4_state_enabled_and_changed(sctx, ps))
cik_prefetch_shader_async(sctx, sctx->queued.named.ps);
sctx->prefetch_L2 = false;

View File

@ -288,6 +288,9 @@ struct si_buffer_resources {
#define si_pm4_state_changed(sctx, member) \
((sctx)->queued.named.member != (sctx)->emitted.named.member)
#define si_pm4_state_enabled_and_changed(sctx, member) \
((sctx)->queued.named.member && si_pm4_state_changed(sctx, member))
#define si_pm4_bind_state(sctx, member, value) \
do { \
(sctx)->queued.named.member = (value); \

View File

@ -3297,12 +3297,12 @@ bool si_update_shaders(struct si_context *sctx)
}
}
if (si_pm4_state_changed(sctx, ls) ||
si_pm4_state_changed(sctx, hs) ||
si_pm4_state_changed(sctx, es) ||
si_pm4_state_changed(sctx, gs) ||
si_pm4_state_changed(sctx, vs) ||
si_pm4_state_changed(sctx, ps)) {
if (si_pm4_state_enabled_and_changed(sctx, ls) ||
si_pm4_state_enabled_and_changed(sctx, hs) ||
si_pm4_state_enabled_and_changed(sctx, es) ||
si_pm4_state_enabled_and_changed(sctx, gs) ||
si_pm4_state_enabled_and_changed(sctx, vs) ||
si_pm4_state_enabled_and_changed(sctx, ps)) {
if (!si_update_spi_tmpring_size(sctx))
return false;
}