v3dv: use a bitfield to implement a quick check for job BO tracking

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-14 09:08:36 +02:00 committed by Marge Bot
parent 9e76240f84
commit b8403192ed
4 changed files with 9 additions and 2 deletions

View file

@ -184,6 +184,7 @@ v3dv_bo_init(struct v3dv_bo *bo,
bool private)
{
bo->handle = handle;
bo->handle_bit = 1ull << (handle % 64);
bo->size = size;
bo->offset = offset;
bo->map = NULL;

View file

@ -30,6 +30,7 @@ struct v3dv_bo {
struct list_head list_link;
uint32_t handle;
uint64_t handle_bit;
uint32_t size;
uint32_t offset;

View file

@ -65,11 +65,14 @@ v3dv_job_add_bo(struct v3dv_job *job, struct v3dv_bo *bo)
if (!bo)
return;
if (_mesa_set_search(job->bos, bo))
return;
if (job->bo_handle_mask & bo->handle_bit) {
if (_mesa_set_search(job->bos, bo))
return;
}
_mesa_set_add(job->bos, bo);
job->bo_count++;
job->bo_handle_mask |= bo->handle_bit;
}
void
@ -78,6 +81,7 @@ v3dv_job_add_bo_unchecked(struct v3dv_job *job, struct v3dv_bo *bo)
assert(bo);
_mesa_set_add(job->bos, bo);
job->bo_count++;
job->bo_handle_mask |= bo->handle_bit;
}
static void

View file

@ -924,6 +924,7 @@ struct v3dv_job {
*/
struct set *bos;
uint32_t bo_count;
uint64_t bo_handle_mask;
struct v3dv_bo *tile_alloc;
struct v3dv_bo *tile_state;