Module: Mesa
Branch: staging/23.0
Commit: 0128c73e353111ba6c8606045fda245eb1043164
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0128c73e353111ba6c8606045fda245eb1043164

Author: Nanley Chery <[email protected]>
Date:   Mon Apr 10 14:26:37 2023 -0700

iris/bufmgr: Handle flat_ccs for BO_ALLOC_ZEROED

We can't map the CCS memory region. So, rely on the kernel's zeroing of
new allocations. This is helpful when creating dmabufs that use
compression.

Cc: mesa-stable
Reviewed-by: José Roberto de Souza <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22487>
(cherry picked from commit b2d7386631f44bcdb8ba0c42fef78ae7b3380f14)

---

 .pick_status.json                      | 2 +-
 src/gallium/drivers/iris/iris_bufmgr.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 6416dfb8ac4..81d646b08e6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3004,7 +3004,7 @@
         "description": "iris/bufmgr: Handle flat_ccs for BO_ALLOC_ZEROED",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/drivers/iris/iris_bufmgr.c 
b/src/gallium/drivers/iris/iris_bufmgr.c
index 9ca2d64d85d..b185046acf4 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -785,6 +785,14 @@ zero_bo(struct iris_bufmgr *bufmgr,
 {
    assert(flags & BO_ALLOC_ZEROED);
 
+   if (bufmgr->devinfo.has_flat_ccs && (flags & BO_ALLOC_LMEM)) {
+      /* With flat CCS, all allocations in LMEM have memory ranges with
+       * corresponding CCS elements. These elements are only accessible
+       * through GPU commands, but we don't issue GPU commands here.
+       */
+      return false;
+   }
+
    void *map = iris_bo_map(NULL, bo, MAP_WRITE | MAP_RAW);
    if (!map)
       return false;

Reply via email to