venus: add dri option to enable multi-plane wsi modifiers

Adds a venus dri option to advertise support for multi-plane format
modifiers to Vulkan's common WSI. Otherwise, Venus will only support
modifiers with planeCount == 1 to ensure compatibility with Xwayland's
virgl-backed Glamor backend.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26240>
This commit is contained in:
Ryan Neph 2023-11-08 11:27:09 -08:00 committed by Marge Bot
parent 035730f26e
commit a495d437b7
4 changed files with 14 additions and 0 deletions

View file

@ -597,6 +597,10 @@
DRI_CONF_OPT_B(venus_implicit_fencing, def, \
"Assume the virtio-gpu kernel driver supports implicit fencing")
#define DRI_CONF_VENUS_WSI_MULTI_PLANE_MODIFIERS(def) \
DRI_CONF_OPT_B(venus_wsi_multi_plane_modifiers, def, \
"Enable support of multi-plane format modifiers for wsi images")
/**
* \brief RADV specific configuration options
*/

View file

@ -60,6 +60,7 @@ static const driOptionDescription vn_dri_options[] = {
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(false)
DRI_CONF_VK_XWAYLAND_WAIT_READY(true)
DRI_CONF_VENUS_IMPLICIT_FENCING(false)
DRI_CONF_VENUS_WSI_MULTI_PLANE_MODIFIERS(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false)
@ -693,6 +694,13 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
instance->renderer->info.has_implicit_fencing =
driQueryOptionb(&instance->dri_options, "venus_implicit_fencing");
instance->enable_wsi_multi_plane_modifiers = driQueryOptionb(
&instance->dri_options, "venus_wsi_multi_plane_modifiers");
if (VN_DEBUG(INIT)) {
vn_log(instance, "supports multi-plane wsi format modifiers: %s",
instance->enable_wsi_multi_plane_modifiers ? "yes" : "no");
}
*pInstance = instance_handle;

View file

@ -36,6 +36,7 @@ struct vn_instance {
struct driOptionCache dri_options;
struct driOptionCache available_dri_options;
bool enable_wsi_multi_plane_modifiers;
struct vn_renderer *renderer;

View file

@ -2104,6 +2104,7 @@ vn_GetPhysicalDeviceImageFormatProperties2(
* both plane counts to 1 while virgl may be involved.
*/
if (wsi_info && modifier_info &&
!physical_dev->instance->enable_wsi_multi_plane_modifiers &&
modifier_info->drmFormatModifier != DRM_FORMAT_MOD_LINEAR) {
const uint32_t plane_count =
vn_modifier_plane_count(physical_dev, pImageFormatInfo->format,