From d0b2f4830d8bc0c4768c399b9fce03a3c8c7c53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Thu, 10 Apr 2025 15:05:35 +0300 Subject: [PATCH] iris: force reallocate on eglCreateImage with GFX >= 20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: mesa-stable Signed-off-by: Tapani Pälli Reviewed-by: José Roberto de Souza Part-of: (cherry picked from commit c2a46578626402c2ceebfe5a4a8e6640101678a6) --- .pick_status.json | 2 +- src/gallium/drivers/iris/iris_resource.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8dd725f2b6a..eab60a9fdad 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1904,7 +1904,7 @@ "description": "iris: force reallocate on eglCreateImage with GFX >= 20", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index e0bcf78183f..54300498bc3 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1641,12 +1641,19 @@ iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource) const struct isl_drm_modifier_info *mod = res->mod_info; bool newly_external = false; + /* We need to reallocate because original texture is compressed and we + * might end up doing a resolve. + */ + bool need_reallocate = + res->aux.usage == ISL_AUX_USAGE_CCS_E && + iris_bo_is_real(res->bo) && iris_heap_is_compressed(res->bo->real.heap); + /* flush_resource() may be used to prepare an image for sharing externally * with other clients (e.g. via eglCreateImage). To account for this, we * make sure to eliminate suballocation and any compression that a consumer * wouldn't know how to handle. */ - if (!iris_bo_is_real(res->bo)) { + if (!iris_bo_is_real(res->bo) || need_reallocate) { assert(!(res->base.b.bind & PIPE_BIND_SHARED)); iris_reallocate_resource_inplace(ice, res, PIPE_BIND_SHARED); assert(res->base.b.bind & PIPE_BIND_SHARED);