iris: Report the correct modifier for Tile4 images

In iris_resource_get_param, report the Tile4 modifier for Tile4 images
instead of reporting the linear modifier.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28258>
This commit is contained in:
Nanley Chery 2024-03-18 09:35:21 -04:00 committed by Marge Bot
parent 345c918a76
commit bf1008ac28

View file

@ -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)