freedreno/drm: Add FD_BO_SHARED hint

With the virtio backend we will need to pass an extra flag when
allocating buffers that will be shared cross-device (such as with
virtio-wl for passing between host and guest)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>
This commit is contained in:
Rob Clark 2022-02-06 09:22:59 -08:00 committed by Marge Bot
parent f846181fe5
commit 115518ec35
2 changed files with 3 additions and 0 deletions

View file

@ -104,6 +104,8 @@ struct fd_fence {
#define FD_BO_CACHED_COHERENT BITSET_BIT(3)
/* Hint that the bo will not be mmap'd: */
#define FD_BO_NOMAP BITSET_BIT(4)
/* Hint that the bo will be exported/shared: */
#define FD_BO_SHARED BITSET_BIT(5)
/* bo access flags: (keep aligned to MSM_PREP_x) */
#define FD_BO_PREP_READ BITSET_BIT(0)

View file

@ -198,6 +198,7 @@ realloc_bo(struct fd_resource *rsc, uint32_t size)
uint32_t flags =
COND(rsc->layout.tile_mode, FD_BO_NOMAP) |
COND(prsc->usage & PIPE_USAGE_STAGING, FD_BO_CACHED_COHERENT) |
COND(prsc->bind & PIPE_BIND_SHARED, FD_BO_SHARED) |
COND(prsc->bind & PIPE_BIND_SCANOUT, FD_BO_SCANOUT);
/* TODO other flags? */