mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
iris: Fix lowered images in get_main_plane_for_plane
This function was recently simplified based on the idea that if a
modifier is not present, then the plane count should not exceed the
plane count of the resource's external format. This seems to be true
except for lowered images. We don't enable compression modifiers on
lowered images, so this case was not handled during the transition.
As an example of the lowering that may occur: PIPE_FORMAT_YVYU is a
single plane, subsampled format that the gallium layer lowers to two
planes/formats (R8G8_UNORM and B8G8R8A8_UNORM) if not natively supported
by the hardware.
Fixes the assert failure when running the piglit test case:
ext_image_dma_buf_import-sample_yuv -fmt=YVYU -auto
ext_image_dma_buf_import-sample_yuv:
../../src/gallium/drivers/iris/iris_resource.c:1384:
iris_resource_from_handle:
Assertion `main_res->aux.surf.row_pitch_B ==
plane_res->surf.row_pitch_B' failed.
Also, replaces it with a new one in case this fails again:
ext_image_dma_buf_import-sample_yuv:
../../src/gallium/drivers/iris/iris_resource.c:1381:
iris_resource_from_handle:
Assertion `isl_drm_modifier_has_aux(whandle->modifier)' failed.
Fixes: 79222e5884 ("iris: Simplify get_main_plane_for_plane")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26826>
This commit is contained in:
parent
94e5b5d049
commit
ee524e198b
1 changed files with 14 additions and 2 deletions
|
|
@ -1315,8 +1315,19 @@ static unsigned
|
|||
get_main_plane_for_plane(enum pipe_format format,
|
||||
unsigned plane)
|
||||
{
|
||||
unsigned int n_planes = util_format_get_num_planes(format);
|
||||
return plane % n_planes;
|
||||
if (format == PIPE_FORMAT_NONE) {
|
||||
/* Created dmabuf resources have this format. */
|
||||
return 0;
|
||||
} else if (isl_format_for_pipe_format(format) == ISL_FORMAT_UNSUPPORTED) {
|
||||
/* This format has been lowered to more planes than are native to it.
|
||||
* So, compression modifiers are not enabled and the plane index is used
|
||||
* as-is.
|
||||
*/
|
||||
return plane;
|
||||
} else {
|
||||
unsigned int n_planes = util_format_get_num_planes(format);
|
||||
return plane % n_planes;
|
||||
}
|
||||
}
|
||||
|
||||
static struct pipe_resource *
|
||||
|
|
@ -1378,6 +1389,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
|
|||
main_res->aux.clear_color_unknown = true;
|
||||
} else if (plane > main_plane) {
|
||||
/* Fill out some aux surface fields. */
|
||||
assert(isl_drm_modifier_has_aux(whandle->modifier));
|
||||
assert(!devinfo->has_flat_ccs);
|
||||
assert(plane_res->bo->size >= plane_res->offset +
|
||||
main_res->aux.surf.size_B);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue