freedreno/drm: Add FD_BO_SHARED hint
authorRob Clark <robdclark@chromium.org>
Sun, 6 Feb 2022 17:22:59 +0000 (09:22 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 25 Mar 2022 02:03:30 +0000 (02:03 +0000)
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>

src/freedreno/drm/freedreno_drmif.h
src/gallium/drivers/freedreno/freedreno_resource.c

index 73c7b5e..e0e2b5b 100644 (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)
index 094e064..327bc36 100644 (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? */