wayland/dma-buf: Don't require modifiers support for scanout tranche

When building the list of formats to be sent as part of the scanout
tranche, avoid requiring modifier support by the DRM driver for
formats relying on implicit modifiers (DRM_FORMAT_MOD_INVALID).

Specifically, the previous check required the DRM driver to have
advertised some modifier support for the given format in its
IN_FORMATS KMS plane property, regardless of modifier it was. If it
hadn't, the format was left out of the list of formats to be sent
in the scanout tranche.

When no formats remained to be sent in the scanout tranche, the
tranche simply wasn't sent.

This resulted in the scanout tranche never being sent for GPUs where
modifiers aren't supported. In those cases, no formats are advertised
using the IN_FORMATS property, and thus the list of formats to be sent
in the scanout tranche remained empty.

Since Mesa doesn't use scanout-compatible buffers for native Wayland
clients unless specifically requested to do so using the "scanout"
tranche flag, it effectively means that direct scanout of native
Wayland clients wasn't supported for GPUs without modifiers support.

Sending a tranche with formats paired with the implicit modifier
(DRM_FORMAT_MOD_INVALID) is both allowed by the protocol and is
already done by default for GPUs with modifiers support, unless the
experimental support for explicit modifiers is enabled in Mutter.

So instead of requiring modifiers to be supported for each format
being evaluated for the scanout tranche, when processing formats
which rely on implicit modifiers, only check if the format in
question is supported by the DRM driver for scanout on the primary
plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2510>
This commit is contained in:
Dor Askayo 2022-07-12 17:24:51 +03:00
parent 1a56a53909
commit f037c9df66

View File

@ -1020,7 +1020,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback,
if (format.drm_modifier != DRM_FORMAT_MOD_INVALID) if (format.drm_modifier != DRM_FORMAT_MOD_INVALID)
continue; continue;
if (!meta_crtc_kms_get_modifiers (crtc_kms, format.drm_format)) if (!meta_crtc_kms_supports_format (crtc_kms, format.drm_format))
continue; continue;
g_array_append_val (formats, format); g_array_append_val (formats, format);