v3dv: optimize a few cases of BO job additions

In these cases we know that the BO has not been added to the job
before, so we can skip the usual process for adding the BO where
we check if we had already added it before to avoid duplicates.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10210>
This commit is contained in:
Iago Toral Quiroga
2021-04-13 12:21:08 +02:00
committed by Marge Bot
parent 493a316e40
commit 9e76240f84
3 changed files with 16 additions and 5 deletions
+2 -2
View File
@@ -72,10 +72,10 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, bool use_branch)
cl_emit(cl, BRANCH, branch) {
branch.address = v3dv_cl_address(bo, 0);
}
} else {
v3dv_job_add_bo_unchecked(cl->job, bo);
}
v3dv_job_add_bo(cl->job, bo);
cl->bo = bo;
cl->base = cl->bo->map;
cl->size = cl->bo->size;
+11 -3
View File
@@ -72,6 +72,14 @@ v3dv_job_add_bo(struct v3dv_job *job, struct v3dv_bo *bo)
job->bo_count++;
}
void
v3dv_job_add_bo_unchecked(struct v3dv_job *job, struct v3dv_bo *bo)
{
assert(bo);
_mesa_set_add(job->bos, bo);
job->bo_count++;
}
static void
cmd_buffer_emit_render_pass_rcl(struct v3dv_cmd_buffer *cmd_buffer);
@@ -561,7 +569,7 @@ v3dv_job_start_frame(struct v3dv_job *job,
return;
}
v3dv_job_add_bo(job, job->tile_alloc);
v3dv_job_add_bo_unchecked(job, job->tile_alloc);
const uint32_t tsda_per_tile_size = 256;
const uint32_t tile_state_size = tiling->layers *
@@ -574,7 +582,7 @@ v3dv_job_start_frame(struct v3dv_job *job,
return;
}
v3dv_job_add_bo(job, job->tile_state);
v3dv_job_add_bo_unchecked(job, job->tile_state);
/* This must go before the binning mode configuration. It is
* required for layered framebuffers to work.
@@ -5302,7 +5310,7 @@ cmd_buffer_create_csd_job(struct v3dv_cmd_buffer *cmd_buffer,
}
}
v3dv_job_add_bo(job, cs_assembly_bo);
v3dv_job_add_bo_unchecked(job, cs_assembly_bo);
struct v3dv_cl_reloc uniforms =
v3dv_write_uniforms_wg_offsets(cmd_buffer, pipeline,
cs_variant,
+3
View File
@@ -998,7 +998,10 @@ void v3dv_job_init(struct v3dv_job *job,
struct v3dv_cmd_buffer *cmd_buffer,
int32_t subpass_idx);
void v3dv_job_destroy(struct v3dv_job *job);
void v3dv_job_add_bo(struct v3dv_job *job, struct v3dv_bo *bo);
void v3dv_job_add_bo_unchecked(struct v3dv_job *job, struct v3dv_bo *bo);
void v3dv_job_emit_binning_flush(struct v3dv_job *job);
void v3dv_job_start_frame(struct v3dv_job *job,
uint32_t width,