linux-dmabuf: Send format events for protocol version 3

The linux-dmabuf-unstable-v1 specification does not deprecate "format"
events in version 3 of the protocol. Therefore the compositor must send
both "format" and "modifier" events if version 3 is bound.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
This commit is contained in:
Alexandros Frantzis 2022-06-03 11:46:23 +03:00
parent dfceb60274
commit f2d2313693

View File

@ -1049,6 +1049,12 @@ bind_linux_dmabuf(struct wl_client *client,
wl_array_for_each(fmt, &supported_formats->arr) {
modifiers = weston_drm_format_get_modifiers(fmt, &num_modifiers);
for (i = 0; i < num_modifiers; i++) {
if (modifiers[i] == DRM_FORMAT_MOD_LINEAR ||
modifiers[i] == DRM_FORMAT_MOD_INVALID) {
zwp_linux_dmabuf_v1_send_format(resource,
fmt->format);
}
if (version >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
uint32_t modifier_lo = modifiers[i] & 0xFFFFFFFF;
uint32_t modifier_hi = modifiers[i] >> 32;
@ -1056,10 +1062,6 @@ bind_linux_dmabuf(struct wl_client *client,
fmt->format,
modifier_hi,
modifier_lo);
} else if (modifiers[i] == DRM_FORMAT_MOD_LINEAR ||
modifiers[i] == DRM_FORMAT_MOD_INVALID) {
zwp_linux_dmabuf_v1_send_format(resource,
fmt->format);
}
}
}