panfrost: Introduce a PAN_BO_SHAREABLE flag

This flag reflects the ability to share a BO. This lets the kmod
backend optimize the case where the BO stays private to a specific
VM.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26357>
This commit is contained in:
Boris Brezillon 2023-07-05 10:25:58 +02:00 committed by Marge Bot
parent 5089a758df
commit aa6176ee1e
2 changed files with 8 additions and 2 deletions

View file

@ -73,11 +73,13 @@ static struct panfrost_bo *
panfrost_bo_alloc(struct panfrost_device *dev, size_t size, uint32_t flags,
const char *label)
{
struct pan_kmod_vm *exclusive_vm =
!(flags & PAN_BO_SHAREABLE) ? dev->kmod.vm : NULL;
struct pan_kmod_bo *kmod_bo;
struct panfrost_bo *bo;
kmod_bo =
pan_kmod_bo_alloc(dev->kmod.dev, NULL, size, to_kmod_bo_flags(flags));
kmod_bo = pan_kmod_bo_alloc(dev->kmod.dev, exclusive_vm, size,
to_kmod_bo_flags(flags));
assert(kmod_bo);
bo = pan_lookup_bo(dev, kmod_bo->handle);

View file

@ -52,6 +52,10 @@
* cached locally */
#define PAN_BO_SHARED (1 << 4)
/* BO might be exported at some point. PAN_BO_SHAREABLE does not imply
* PAN_BO_SHARED if the BO has not been exported yet */
#define PAN_BO_SHAREABLE (1 << 5)
/* GPU access flags */
/* BO is either shared (can be accessed by more than one GPU batch) or private