v3dv: drop the extra BO handling from the command buffer

Now that we have a framework to register objects allocated internally
by the driver we can just use that.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2020-05-25 09:56:23 +02:00 committed by Marge Bot
parent bbdfc5296b
commit e048eba81a
3 changed files with 12 additions and 31 deletions

View file

@ -70,14 +70,6 @@ v3dv_job_add_bo(struct v3dv_job *job, struct v3dv_bo *bo)
job->bo_count++;
}
void
v3dv_job_add_extra_bo(struct v3dv_job *job, struct v3dv_bo *bo)
{
assert(bo);
assert(!_mesa_set_search(job->extra_bos, bo));
_mesa_set_add(job->extra_bos, bo);
}
static void
cmd_buffer_emit_render_pass_rcl(struct v3dv_cmd_buffer *cmd_buffer);
@ -177,15 +169,6 @@ job_destroy_gpu_cl_resources(struct v3dv_job *job)
*/
_mesa_set_destroy(job->bos, NULL);
/* Extra BOs need to be destroyed with the job, since they were created
* internally by the driver for it.
*/
set_foreach(job->extra_bos, entry) {
struct v3dv_bo *bo = (struct v3dv_bo *)entry->key;
v3dv_bo_free(job->device, bo);
}
_mesa_set_destroy(job->extra_bos, NULL);
v3dv_bo_free(job->device, job->tile_alloc);
v3dv_bo_free(job->device, job->tile_state);
}
@ -650,9 +633,6 @@ v3dv_job_init(struct v3dv_job *job,
_mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
job->bo_count = 0;
job->extra_bos =
_mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
v3dv_cl_init(job, &job->bcl);
v3dv_cl_begin(&job->bcl);

View file

@ -1757,6 +1757,16 @@ v3dv_CmdCopyBuffer(VkCommandBuffer commandBuffer,
}
}
static void
destroy_update_buffer_cb(VkDevice _device,
uint64_t pobj,
VkAllocationCallbacks *alloc)
{
V3DV_FROM_HANDLE(v3dv_device, device, _device);
struct v3dv_bo *bo = (struct v3dv_bo *) pobj;
v3dv_bo_free(device, bo);
}
void
v3dv_CmdUpdateBuffer(VkCommandBuffer commandBuffer,
VkBuffer dstBuffer,
@ -1794,11 +1804,8 @@ v3dv_CmdUpdateBuffer(VkCommandBuffer commandBuffer,
if (!copy_job)
return;
/* Make sure we add the BO to the list of extra BOs so it is not leaked.
* If the copy job was split into multiple jobs, we just bind it to the last
* one.
*/
v3dv_job_add_extra_bo(copy_job, src_bo);
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (uint64_t)(uintptr_t)src_bo, destroy_update_buffer_cb);
}
static void

View file

@ -715,11 +715,6 @@ struct v3dv_job {
struct set *bos;
uint32_t bo_count;
/* A subset of the BOs set above that are allocated internally by
* the job and that should be explicitly freed with it.
*/
struct set *extra_bos;
struct v3dv_bo *tile_alloc;
struct v3dv_bo *tile_state;
@ -769,7 +764,6 @@ void v3dv_job_init(struct v3dv_job *job,
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_extra_bo(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,