iris: Return non-zero stride for clear color plane

Before this patch, when querying the clear color plane's stride, iris
would return the aux surface stride. This was okay because the clear
color plane wasn't really used for anything.

This doesn't work on XeHP however. On that platform, the aux surface
stride is zero (because it doesn't have an ISL surface for the CCS).
This is a problem because mesa's implementation of eglCreateImage
rejects strides of zero (see dri2_check_dma_buf_attribs) and this value
may be queried from GBM and passed into EGL.

When the DG2 clear color modifier is enabled, this avoids EGL_BAD_ACCESS
errors when running the piglit test,
ext_image_dma_buf_import-intel_modifiers.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14759>
This commit is contained in:
Nanley Chery 2022-01-21 13:05:30 -05:00 committed by Marge Bot
parent 2407a7e6c1
commit db475c81b7
1 changed files with 9 additions and 1 deletions

View File

@ -1605,7 +1605,15 @@ iris_resource_get_param(struct pipe_screen *pscreen,
}
return true;
case PIPE_RESOURCE_PARAM_STRIDE:
*value = wants_aux ? res->aux.surf.row_pitch_B : res->surf.row_pitch_B;
*value = wants_cc ? 1 :
wants_aux ? res->aux.surf.row_pitch_B : res->surf.row_pitch_B;
/* Mesa's implementation of eglCreateImage rejects strides of zero (see
* dri2_check_dma_buf_attribs). Ensure we return a non-zero stride as
* this value may be queried from GBM and passed into EGL.
*/
assert(*value);
return true;
case PIPE_RESOURCE_PARAM_OFFSET:
*value = wants_cc ? res->aux.clear_color_offset :