From db475c81b7cdde9d967b0216e6f12d17e0adae83 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Fri, 21 Jan 2022 13:05:30 -0500 Subject: [PATCH] iris: Return non-zero stride for clear color plane MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- src/gallium/drivers/iris/iris_resource.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index a2981fcaaa7..109c6de59ff 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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 :