From bf1008ac28ab9de318287f3958836a37bc4b883d Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Mon, 18 Mar 2024 09:35:21 -0400 Subject: [PATCH] iris: Report the correct modifier for Tile4 images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In iris_resource_get_param, report the Tile4 modifier for Tile4 images instead of reporting the linear modifier. Reviewed-by: Tapani Pälli Part-of: --- src/gallium/drivers/iris/iris_resource.c | 28 ++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 12a579e4431..a4d279db09a 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1692,8 +1692,32 @@ iris_resource_get_param(struct pipe_screen *pscreen, wants_aux ? res->aux.offset : res->offset; return true; case PIPE_RESOURCE_PARAM_MODIFIER: - *value = res->mod_info ? res->mod_info->modifier : - tiling_to_modifier(isl_tiling_to_i915_tiling(res->surf.tiling)); + if (res->mod_info) { + *value = res->mod_info->modifier; + } else { + /* We restrict ourselves to modifiers without CCS for several + * reasons: + * + * - Mesa's implementation of EGL_MESA_image_dma_buf_export + * currently only exports a single plane (see + * dri2_export_dma_buf_image_mesa), but for some modifiers, + * CCS exists in a second plane. + * + * - Even if we returned CCS modifiers, iris currently + * resolves away compression during the export/flushing process + * (see iris_flush_resource). So, only uncompressed data is + * exposed anyways. + */ + switch (res->surf.tiling) { + case ISL_TILING_4: *value = I915_FORMAT_MOD_4_TILED; break; + case ISL_TILING_Y0: *value = I915_FORMAT_MOD_Y_TILED; break; + case ISL_TILING_X: *value = I915_FORMAT_MOD_X_TILED; break; + case ISL_TILING_LINEAR: *value = DRM_FORMAT_MOD_LINEAR; break; + default: + assert("no modifier mapped for resource's tiling"); + return false; + } + } return true; case PIPE_RESOURCE_PARAM_HANDLE_TYPE_SHARED: if (!wants_aux)