summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2024-03-18 09:35:21 -0400
committerMarge Bot <emma+marge@anholt.net>2024-03-19 23:12:06 +0000
commitbf1008ac28ab9de318287f3958836a37bc4b883d (patch)
tree286b46e61786e786147201117baf8ea0886a7f07
parent345c918a769191d6a6edabbef34006bea3ccc035 (diff)
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>
-rw-r--r--src/gallium/drivers/iris/iris_resource.c28
1 files 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)