v3dv: store the offset of the BRANCH instruction in a CL

This will be useful to know which is the actual executable
size of a BO in a CL that branches into a another BO. We
will need this soon to implement deep clones of the BCL
for suspending jobs with the command buffer simultaneous
use flag.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28521>
This commit is contained in:
Iago Toral Quiroga 2024-04-01 14:28:15 +02:00
parent c874caf33d
commit ff8d72ba22
3 changed files with 7 additions and 0 deletions

View file

@ -206,6 +206,7 @@ v3dv_bo_init(struct v3dv_bo *bo,
bo->private = private;
bo->dumb_handle = -1;
bo->is_import = false;
bo->cl_branch_offset = 0xffffffff;
list_inithead(&bo->list_link);
}

View file

@ -39,6 +39,11 @@ struct v3dv_bo {
const char *name;
/* In a CL where a BRANCH has been emitted, the offset of the BRANCH
* instruction in the BO.
*/
uint32_t cl_branch_offset;
/** Entry in the linked list of buffers freed, by age. */
struct list_head time_list;
/** Entry in the per-page-count linked list of buffers freed (by age). */

View file

@ -84,6 +84,7 @@ cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, bool use_branch)
/* Chain to the new BO from the old one if requested */
if (use_branch && cl->bo) {
cl->bo->cl_branch_offset = v3dv_cl_offset(cl);
cl_emit(cl, BRANCH, branch) {
branch.address = v3dv_cl_address(bo, 0);
}