Mesa (main): iris: Introduce a BO_ALLOC_NO_SUBALLOC flag and set it in a few places

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 1 05:13:34 UTC 2021


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sun Aug  8 01:31:30 2021 -0700

iris: Introduce a BO_ALLOC_NO_SUBALLOC flag and set it in a few places

We don't want to suballocate some buffers, such as ones that we know
we're intending to export to other clients, or ones with special
semantics (such as the workaround BO not having proper synchronization).

Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

---

 src/gallium/drivers/iris/iris_batch.c    | 3 ++-
 src/gallium/drivers/iris/iris_bufmgr.h   | 9 +++++----
 src/gallium/drivers/iris/iris_resource.c | 4 ++++
 src/gallium/drivers/iris/iris_screen.c   | 2 +-
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index ec960f5f60c..e0c0aec8aa2 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -363,9 +363,10 @@ create_batch(struct iris_batch *batch)
    struct iris_screen *screen = batch->screen;
    struct iris_bufmgr *bufmgr = screen->bufmgr;
 
+   /* TODO: We probably could suballocate batches... */
    batch->bo = iris_bo_alloc(bufmgr, "command buffer",
                              BATCH_SZ + BATCH_RESERVED, 1,
-                             IRIS_MEMZONE_OTHER, 0);
+                             IRIS_MEMZONE_OTHER, BO_ALLOC_NO_SUBALLOC);
    iris_get_backing_bo(batch->bo)->real.kflags |= EXEC_OBJECT_CAPTURE;
    batch->map = iris_bo_map(NULL, batch->bo, MAP_READ | MAP_WRITE);
    batch->map_next = batch->map;
diff --git a/src/gallium/drivers/iris/iris_bufmgr.h b/src/gallium/drivers/iris/iris_bufmgr.h
index 558257d7b36..f2f20407687 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.h
+++ b/src/gallium/drivers/iris/iris_bufmgr.h
@@ -264,10 +264,11 @@ struct iris_bo {
    };
 };
 
-#define BO_ALLOC_ZEROED     (1<<0)
-#define BO_ALLOC_COHERENT   (1<<1)
-#define BO_ALLOC_SMEM       (1<<2)
-#define BO_ALLOC_SCANOUT    (1<<3)
+#define BO_ALLOC_ZEROED      (1<<0)
+#define BO_ALLOC_COHERENT    (1<<1)
+#define BO_ALLOC_SMEM        (1<<2)
+#define BO_ALLOC_SCANOUT     (1<<3)
+#define BO_ALLOC_NO_SUBALLOC (1<<4)
 
 /**
  * Allocate a buffer object.
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 9c1d50aa522..ebfa1534023 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -442,6 +442,10 @@ iris_resource_alloc_flags(const struct iris_screen *screen,
                        PIPE_RESOURCE_FLAG_MAP_PERSISTENT))
       flags |= BO_ALLOC_SMEM;
 
+   if ((templ->bind & PIPE_BIND_SHARED) ||
+       util_format_get_num_planes(templ->format) > 1)
+      flags |= BO_ALLOC_NO_SUBALLOC;
+
    return flags;
 }
 
diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c
index 858ac19de62..60ed93bcd6c 100644
--- a/src/gallium/drivers/iris/iris_screen.c
+++ b/src/gallium/drivers/iris/iris_screen.c
@@ -805,7 +805,7 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
 
    screen->workaround_bo =
       iris_bo_alloc(screen->bufmgr, "workaround", 4096, 1,
-                    IRIS_MEMZONE_OTHER, 0);
+                    IRIS_MEMZONE_OTHER, BO_ALLOC_NO_SUBALLOC);
    if (!screen->workaround_bo)
       return NULL;
 



More information about the mesa-commit mailing list