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)