Module: Mesa Branch: main Commit: 0498ad3e26da4bb3bfe3472903d2b6d9d4af22f3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0498ad3e26da4bb3bfe3472903d2b6d9d4af22f3
Author: Asahi Lina <[email protected]> Date: Sat Feb 25 11:49:20 2023 -0500 asahi: Add BO_SHAREABLE flag Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538> --- src/asahi/lib/agx_bo.h | 5 +++++ src/gallium/drivers/asahi/agx_pipe.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/asahi/lib/agx_bo.h b/src/asahi/lib/agx_bo.h index 4a735319777..d18568a7262 100644 --- a/src/asahi/lib/agx_bo.h +++ b/src/asahi/lib/agx_bo.h @@ -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 { diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 2cb9f13dcb2..218591e29e5 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -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);
