Module: Mesa
Branch: main
Commit: 0463a951ad6c0115df959d85c41517a30e8e5ee2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0463a951ad6c0115df959d85c41517a30e8e5ee2

Author: Boris Brezillon <boris.brezil...@collabora.com>
Date:   Wed Jul  5 10:44:35 2023 +0200

panfrost: Flag BO shareable when appropriate

Let the kmod backend know when we might end up exporting a BO. This
doesn't change anything for the Panfrost kmod backend, but will be
needed for Panthor.

Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26357>

---

 src/gallium/drivers/panfrost/pan_resource.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index a942c35cc3b..011a5386785 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -737,9 +737,14 @@ panfrost_resource_create_with_modifier(struct pipe_screen 
*screen,
    } else {
       /* We create a BO immediately but don't bother mapping, since we don't
        * care to map e.g. FBOs which the CPU probably won't touch */
+      uint32_t flags = PAN_BO_DELAY_MMAP;
 
-      so->image.data.bo = panfrost_bo_create(dev, so->image.layout.data_size,
-                                             PAN_BO_DELAY_MMAP, label);
+      /* If the resource is never exported, we can make the BO private. */
+      if (template->bind & PIPE_BIND_SHARED)
+         flags |= PAN_BO_SHAREABLE;
+
+      so->image.data.bo =
+         panfrost_bo_create(dev, so->image.layout.data_size, flags, label);
 
       so->constant_stencil = true;
    }

Reply via email to