diff options
author | Alyssa Rosenzweig <alyssa@collabora.com> | 2021-05-20 13:38:57 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-06-01 19:10:28 +0000 |
commit | c34b760b9f99ecbf1218e7b612a32ce43c7283bf (patch) | |
tree | fae100c75d4b14c2d5950d8b63aa5130abe37914 | |
parent | 6e61c54d3072ec9fcd0b4045be06a9071f199093 (diff) | |
download | mesa-c34b760b9f99ecbf1218e7b612a32ce43c7283bf.tar.gz mesa-c34b760b9f99ecbf1218e7b612a32ce43c7283bf.tar.bz2 mesa-c34b760b9f99ecbf1218e7b612a32ce43c7283bf.zip |
panfrost: Dirty track constant buffers
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11074>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 25 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_job.h | 2 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 6fb085e1842..b6f200cc431 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -207,7 +207,8 @@ pan_emit_draw_descs(struct panfrost_batch *batch, d->instance_size = batch->ctx->instance_count > 1 ? batch->ctx->padded_count : 1; - d->uniform_buffers = panfrost_emit_const_buf(batch, st, &d->push_uniforms); + d->uniform_buffers = batch->uniform_buffers[st]; + d->push_uniforms = batch->push_uniforms[st]; d->textures = batch->textures[st]; d->samplers = batch->samplers[st]; } @@ -289,7 +290,11 @@ static inline void panfrost_update_state_tex(struct panfrost_batch *batch, enum pipe_shader_type st) { - unsigned dirty = batch->ctx->dirty_shader[st]; + struct panfrost_context *ctx = batch->ctx; + struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, st); + + unsigned dirty_3d = ctx->dirty; + unsigned dirty = ctx->dirty_shader[st]; if (dirty & PAN_DIRTY_STAGE_TEXTURE) { batch->textures[st] = @@ -300,6 +305,11 @@ panfrost_update_state_tex(struct panfrost_batch *batch, batch->samplers[st] = panfrost_emit_sampler_descriptors(batch, st); } + + if ((dirty & ss->dirty_shader) || (dirty_3d & ss->dirty_3d)) { + batch->uniform_buffers[st] = panfrost_emit_const_buf(batch, st, + &batch->push_uniforms[st]); + } } static inline void @@ -762,6 +772,9 @@ panfrost_draw_vbo(struct pipe_context *pipe, if (unlikely(dev->debug & PAN_DBG_DIRTY)) panfrost_dirty_state_all(ctx); + /* Conservatively assume draw parameters always change */ + ctx->dirty |= PAN_DIRTY_PARAMS | PAN_DIRTY_DRAWID; + panfrost_update_state_3d(batch); panfrost_update_state_vs(batch); panfrost_update_state_fs(batch); @@ -791,8 +804,11 @@ panfrost_draw_vbo(struct pipe_context *pipe, for (unsigned i = 0; i < num_draws; i++) { panfrost_direct_draw(batch, &tmp_info, drawid, &draws[i]); - if (tmp_info.increment_draw_id) - drawid++; + + if (tmp_info.increment_draw_id) { + ctx->dirty |= PAN_DIRTY_DRAWID; + drawid++; + } } } @@ -1259,6 +1275,7 @@ panfrost_set_constant_buffer( pbuf->enabled_mask |= mask; pbuf->dirty_mask |= mask; + ctx->dirty_shader[shader] |= PAN_DIRTY_STAGE_CONST; } static void diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 83fe7b45daf..fa920ecbd0e 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -122,6 +122,8 @@ struct panfrost_batch { mali_ptr samplers[PIPE_SHADER_TYPES]; mali_ptr attribs[PIPE_SHADER_TYPES]; mali_ptr attrib_bufs[PIPE_SHADER_TYPES]; + mali_ptr uniform_buffers[PIPE_SHADER_TYPES]; + mali_ptr push_uniforms[PIPE_SHADER_TYPES]; }; /* Functions for managing the above */ |