panvk: explicit fallback to linear for legacy scanout images

If there isn't any modifier info coming from the compositor, we go
through our internal image path and pick the best modifier that
supports the image. This causes problems on X11, as it actually
expects the image to be in a linear layout.

Explicitly set the modifier to linear for legacy scanout images,
which specifically indicates that the image doesn't have an
explicit DRM modifier and we should do the safe thing by using
linear.

The naming becomes confusing for scanout with this change,
so the flag is now split into two separate flags, one for controlling
the AFBC optimalness called wsi, the other more directly called
legacy_scanout, which is used for enforcing the linear mod.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37771>
This commit is contained in:
Utku Iseri 2025-10-08 16:57:01 +02:00 committed by Marge Bot
parent 0551a40c36
commit d6eb5b4039
3 changed files with 14 additions and 5 deletions

View file

@ -262,8 +262,11 @@ struct pan_image_usage {
/* Image frequently updated with host data. */
bool frequent_host_updates;
/* Scanout image. */
bool scanout;
/* Legacy scanout image. */
bool legacy_scanout;
/* Image created by WSI. */
bool wsi;
};
static inline enum pan_mod_support

View file

@ -247,8 +247,8 @@ pan_mod_afbc_test_props(const struct pan_kmod_dev_props *dprops,
if (iprops->extent_px.width <= 16 && iprops->extent_px.height <= 16)
return PAN_MOD_NOT_OPTIMAL;
/* Reserve 32x8 tiles for scanout buffers. */
if (iusage && !iusage->scanout &&
/* Reserve 32x8 tiles for WSI images. */
if (iusage && !iusage->wsi &&
pan_afbc_superblock_width(iprops->modifier) != 16)
return PAN_MOD_NOT_OPTIMAL;

View file

@ -124,7 +124,8 @@ get_iusage(struct panvk_image *image, const VkImageCreateInfo *create_info)
iusage.host_copy =
!!(image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT);
iusage.scanout = wsi_info && wsi_info->scanout;
iusage.legacy_scanout = wsi_info && wsi_info->scanout;
iusage.wsi = wsi_info != NULL;
return iusage;
}
@ -373,6 +374,11 @@ panvk_image_get_mod(struct panvk_image *image,
assert(!"Missing modifier info");
}
/* legacy scanout (images without any external modifier info) should default to LINEAR. */
if (iusage.legacy_scanout)
return DRM_FORMAT_MOD_LINEAR;
/* Without external dependencies, pick the best modifier that supports the image. */
return panvk_image_get_mod_from_list(image, &iusage, NULL, 0);
}