From: Rob Clark Date: Mon, 11 Jun 2018 18:05:19 +0000 (-0400) Subject: freedreno: remove per-stateobj dirty_mask's X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ced14f1c7a821dbb3fdb3c76b50a256c6568c714;p=mesa.git freedreno: remove per-stateobj dirty_mask's These never got updated in fd_context_all_dirty() so actually trying to rely on them (in the case of fd5_emit_images()) ends up in some cases where state is not emitted but should be. Best to just rip this out. Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index a787b71e379..d749eb0324a 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -58,10 +58,6 @@ emit_constants(struct fd_ringbuffer *ring, uint32_t base, uint32_t start_base = base; unsigned i; - // XXX TODO only emit dirty consts.. but we need to keep track if - // they are clobbered by a clear, gmem2mem, or mem2gmem.. - constbuf->dirty_mask = enabled_mask; - /* emit user constants: */ while (enabled_mask) { unsigned index = ffs(enabled_mask) - 1; @@ -79,25 +75,21 @@ emit_constants(struct fd_ringbuffer *ring, uint32_t base, if (shader && ((base - start_base) >= (shader->first_immediate * 4))) break; - if (constbuf->dirty_mask & (1 << index)) { - const uint32_t *dwords; - - if (cb->user_buffer) { - dwords = cb->user_buffer; - } else { - struct fd_resource *rsc = fd_resource(cb->buffer); - dwords = fd_bo_map(rsc->bo); - } + const uint32_t *dwords; - dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset); + if (cb->user_buffer) { + dwords = cb->user_buffer; + } else { + struct fd_resource *rsc = fd_resource(cb->buffer); + dwords = fd_bo_map(rsc->bo); + } - OUT_PKT3(ring, CP_SET_CONSTANT, size + 1); - OUT_RING(ring, base); - for (i = 0; i < size; i++) - OUT_RING(ring, *(dwords++)); + dwords = (uint32_t *)(((uint8_t *)dwords) + cb->buffer_offset); - constbuf->dirty_mask &= ~(1 << index); - } + OUT_PKT3(ring, CP_SET_CONSTANT, size + 1); + OUT_RING(ring, base); + for (i = 0; i < size; i++) + OUT_RING(ring, *(dwords++)); base += size; enabled_mask &= ~(1 << index); diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_image.c b/src/gallium/drivers/freedreno/a5xx/fd5_image.c index f5d25ff8a69..028497f3a10 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_image.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_image.c @@ -219,11 +219,10 @@ fd5_emit_images(struct fd_context *ctx, struct fd_ringbuffer *ring, enum pipe_shader_type shader) { struct fd_shaderimg_stateobj *so = &ctx->shaderimg[shader]; + unsigned enabled_mask = so->enabled_mask; - so->dirty_mask &= so->enabled_mask; - - while (so->dirty_mask) { - unsigned index = u_bit_scan(&so->dirty_mask); + while (enabled_mask) { + unsigned index = u_bit_scan(&enabled_mask); unsigned slot = get_image_slot(index); struct fd5_image img; @@ -233,4 +232,3 @@ fd5_emit_images(struct fd_context *ctx, struct fd_ringbuffer *ring, emit_image_ssbo(ring, slot, &img, shader); } } - diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h index af564bd8760..b81cbd052f5 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.h +++ b/src/gallium/drivers/freedreno/freedreno_context.h @@ -69,26 +69,22 @@ struct fd_program_stateobj { struct fd_constbuf_stateobj { struct pipe_constant_buffer cb[PIPE_MAX_CONSTANT_BUFFERS]; uint32_t enabled_mask; - uint32_t dirty_mask; }; struct fd_shaderbuf_stateobj { struct pipe_shader_buffer sb[PIPE_MAX_SHADER_BUFFERS]; uint32_t enabled_mask; - uint32_t dirty_mask; }; struct fd_shaderimg_stateobj { struct pipe_image_view si[PIPE_MAX_SHADER_IMAGES]; uint32_t enabled_mask; - uint32_t dirty_mask; }; struct fd_vertexbuf_stateobj { struct pipe_vertex_buffer vb[PIPE_MAX_ATTRIBS]; unsigned count; uint32_t enabled_mask; - uint32_t dirty_mask; }; struct fd_vertex_stateobj { diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c index 05717da9599..7f9d19aa526 100644 --- a/src/gallium/drivers/freedreno/freedreno_state.c +++ b/src/gallium/drivers/freedreno/freedreno_state.c @@ -103,12 +103,10 @@ fd_set_constant_buffer(struct pipe_context *pctx, */ if (unlikely(!cb)) { so->enabled_mask &= ~(1 << index); - so->dirty_mask &= ~(1 << index); return; } so->enabled_mask |= 1 << index; - so->dirty_mask |= 1 << index; ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_CONST; ctx->dirty |= FD_DIRTY_CONST; } @@ -157,7 +155,6 @@ fd_set_shader_buffers(struct pipe_context *pctx, so->enabled_mask &= ~mask; } - so->dirty_mask |= mask; ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_SSBO; } @@ -204,7 +201,6 @@ fd_set_shader_images(struct pipe_context *pctx, so->enabled_mask &= ~mask; } - so->dirty_mask |= mask; ctx->dirty_shader[shader] |= FD_DIRTY_SHADER_IMAGE; } diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c index ff1ce4d0535..7205fb0d274 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c @@ -559,10 +559,8 @@ emit_user_consts(struct fd_context *ctx, const struct ir3_shader_variant *v, struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf) { const unsigned index = 0; /* user consts are index 0 */ - /* TODO save/restore dirty_mask for binning pass instead: */ - uint32_t dirty_mask = constbuf->enabled_mask; - if (dirty_mask & (1 << index)) { + if (constbuf->enabled_mask & (1 << index)) { struct pipe_constant_buffer *cb = &constbuf->cb[index]; unsigned size = align(cb->buffer_size, 4) / 4; /* size in dwords */ @@ -587,7 +585,6 @@ emit_user_consts(struct fd_context *ctx, const struct ir3_shader_variant *v, ctx->emit_const(ring, v->type, 0, cb->buffer_offset, size, cb->user_buffer, cb->buffer); - constbuf->dirty_mask &= ~(1 << index); } } }