From db5c94d170b1be3b3679f2bc27ecf98eb57eb970 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 10 Apr 2023 14:26:37 -0700 Subject: [PATCH] iris/bufmgr: Handle flat_ccs for BO_ALLOC_ZEROED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: (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 f4e3d647709..4e3f11ecc18 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -490,7 +490,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 }, diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index f5ff1984391..6227bad583e 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -794,6 +794,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;