asahi: Add BO_SHAREABLE flag
authorAsahi Lina <lina@asahilina.net>
Sat, 25 Feb 2023 16:49:20 +0000 (11:49 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 1 Mar 2023 01:04:29 +0000 (01:04 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538>

src/asahi/lib/agx_bo.h
src/gallium/drivers/asahi/agx_pipe.c

index 4a73531..d18568a 100644 (file)
@@ -54,6 +54,11 @@ enum agx_bo_flags {
 
    /* BO should be mapped write-back on the CPU (else, write combine) */
    AGX_BO_WRITEBACK = 1 << 3,
+
+   /* BO could potentially be shared (imported or exported) and therefore cannot
+    * be allocated as private
+    */
+   AGX_BO_SHAREABLE = 1 << 4,
 };
 
 struct agx_ptr {
index 2cb9f13..218591e 100644 (file)
@@ -547,6 +547,10 @@ agx_resource_create_with_modifiers(struct pipe_screen *screen,
       create_flags |= AGX_BO_WRITEBACK;
    }
 
+   /* Create buffers that might be shared with the SHAREABLE flag */
+   if (bind & (PIPE_BIND_SCANOUT | PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SHARED))
+      create_flags |= AGX_BO_SHAREABLE;
+
    nresource->bo =
       agx_bo_create(dev, nresource->layout.size_B, create_flags, label);