From 8c093246e4c764ca7aac5c6e6a5f8360198506bc Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 16 Apr 2020 08:48:22 +0200 Subject: [PATCH] v3dv: reset all state to dirty when we start a new job for a command buffer Most of our state doesn't carry over across jobs, so it needs to be re-emitted. For example, if we have two render passes running back to back using the same pipeline, the application could decide to only bind the vertex buffer or/and the pipeline just once, but as soon as we record the second render pass and create a new job for it we will need to re-emit the shader state record for it just because it is a new job. We could probably only do this for jobs inside a render pass, since those are the only ones that actually draw something and need to care about dirty state, however, there is no harm in doing this for all jobs, for the same reason. Part-of: --- src/broadcom/vulkan/v3dv_cmd_buffer.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c b/src/broadcom/vulkan/v3dv_cmd_buffer.c index d37383e7fa5..9398e2c4813 100644 --- a/src/broadcom/vulkan/v3dv_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c @@ -527,15 +527,25 @@ v3dv_job_init(struct v3dv_job *job, v3dv_cl_init(job, &job->indirect); v3dv_cl_begin(&job->indirect); - /* Keep track of the first subpass that we are recording in this new job. - * We will use this when we emit the RCL to decide how to emit our loads - * and stores. - */ - if (cmd_buffer && cmd_buffer->state.pass) - job->first_subpass = subpass_idx; - if (V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH) job->always_flush = true; + + if (cmd_buffer) { + /* Flag all state as dirty. Generally, we need to re-emit state for each + * new job. + * + * FIXME: there may be some exceptions, in which case we could skip some + * bits. + */ + cmd_buffer->state.dirty = ~0; + + /* Keep track of the first subpass that we are recording in this new job. + * We will use this when we emit the RCL to decide how to emit our loads + * and stores. + */ + if (cmd_buffer->state.pass) + job->first_subpass = subpass_idx; + } } struct v3dv_job *