panfrost: Add a helper to retrieve a panfrost_bo from a pan_kmod_bo

Will be useful to transition panvk out of panfrost_{device,bo}.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:
Boris Brezillon
2023-12-11 12:20:30 +01:00
committed by Marge Bot
parent 446ec05fae
commit c615b4ae10
2 changed files with 16 additions and 0 deletions

View File

@@ -521,3 +521,16 @@ panfrost_bo_export(struct panfrost_bo *bo)
return ret;
}
struct panfrost_bo *
panfrost_bo_from_kmod_bo(struct panfrost_device *dev,
struct pan_kmod_bo *kmod_bo)
{
if (!kmod_bo)
return NULL;
struct panfrost_bo *bo = pan_lookup_bo(dev, pan_kmod_bo_handle(kmod_bo));
assert(bo->kmod_bo == kmod_bo);
return bo;
}

View File

@@ -127,6 +127,9 @@ panfrost_bo_handle(struct panfrost_bo *bo)
return bo->kmod_bo->handle;
}
struct panfrost_bo *panfrost_bo_from_kmod_bo(struct panfrost_device *dev,
struct pan_kmod_bo *kmod_bo);
bool panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns,
bool wait_readers);
void panfrost_bo_reference(struct panfrost_bo *bo);