diff options
author | Dudemanguy <random342@airmail.cc> | 2022-10-29 13:07:34 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-10-29 20:41:20 +0000 |
commit | f5944824513f3081ac01484c85960324bdaabda1 (patch) | |
tree | 56f75868bc5eb2b0c0b546093ef2cf7d21a7ef10 | |
parent | a9e1905a4a2ee9d925c48cb382132dbc10820233 (diff) | |
download | mpv-f5944824513f3081ac01484c85960324bdaabda1.tar.bz2 mpv-f5944824513f3081ac01484c85960324bdaabda1.tar.xz |
build: add an additional check for wayland-protocols 1.24
666cb91cf12a4f8b42087530104513b0fc4ba16d added support for v4 of the
dmabuf protocol. This was meant to be optional and the fallback support
for the old v2 (dates back to 2017[0] well before the 1.15
wayland-protocol version we depend on) was maintained. However, v4 added
several new functions and structs that of course aren't defined in old
protocol versions so naturally this breaks the build on those systems.
Since this is just a niche feature and not really critical to overall
wayland support in mpv, just give in and add another check in the build
system and #if out the newer stuff in wayland_common. v4 of linux-dmabuf
depends on wayland protocols 1-24[1], so go ahead and make that our new
check. Fixes #10807.
[0]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/commit/a840b3634ad637b237f238d2efb9ab8f4712d5f4
[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/commit/8a5cd28a0e84911a5339855cb32ed63fb57ea40a
-rw-r--r-- | generated/wayland/meson.build | 2 | ||||
-rw-r--r-- | video/out/wayland_common.c | 7 | ||||
-rw-r--r-- | video/out/wayland_common.h | 3 | ||||
-rw-r--r-- | wscript | 5 |
4 files changed, 14 insertions, 3 deletions
diff --git a/generated/wayland/meson.build b/generated/wayland/meson.build index 6a1c9fb3cd..7811f849e9 100644 --- a/generated/wayland/meson.build +++ b/generated/wayland/meson.build @@ -8,6 +8,8 @@ protocols = [[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'] wl_protocols_source = [] wl_protocols_headers = [] +features += {'wayland_protocols_1_24': wayland['deps'][2].version().version_compare('>=1.24')} + foreach p: protocols xml = join_paths(p) wl_protocols_source += custom_target(xml.underscorify() + '_c', diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 7ec852c14e..a22a7f1a93 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1094,6 +1094,7 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = { dmabuf_format }; +#if HAVE_WAYLAND_PROTOCOLS_1_24 static void done(void *data, struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1) { @@ -1153,6 +1154,7 @@ static const struct zwp_linux_dmabuf_feedback_v1_listener dmabuf_feedback_listen tranche_formats, tranche_flags, }; +#endif static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id, const char *interface, uint32_t ver) @@ -1178,10 +1180,11 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id if (!strcmp (interface, zwp_linux_dmabuf_v1_interface.name) && (ver >= 4) && found++) { wl->dmabuf = wl_registry_bind(reg, id, &zwp_linux_dmabuf_v1_interface, 4); +#if HAVE_WAYLAND_PROTOCOLS_1_24 wl->dmabuf_feedback = zwp_linux_dmabuf_v1_get_default_feedback(wl->dmabuf); zwp_linux_dmabuf_feedback_v1_add_listener(wl->dmabuf_feedback, &dmabuf_feedback_listener, wl); - } - else if (!strcmp (interface, zwp_linux_dmabuf_v1_interface.name) && (ver >= 2) && found++) { +#endif + } else if (!strcmp (interface, zwp_linux_dmabuf_v1_interface.name) && (ver >= 2) && found++) { wl->dmabuf = wl_registry_bind(reg, id, &zwp_linux_dmabuf_v1_interface, 2); zwp_linux_dmabuf_v1_add_listener(wl->dmabuf, &dmabuf_listener, wl); wl->drm_format_ct_max = 64; diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index fdb745c5d3..541b4d0d28 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -83,7 +83,8 @@ struct vo_wayland_state { /* linux-dmabuf */ struct zwp_linux_dmabuf_v1 *dmabuf; - struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback; + /* TODO: unvoid this if required wayland protocols is bumped to 1.24+ */ + void *dmabuf_feedback; void *format_map; uint32_t format_size; /* TODO: remove these once zwp_linux_dmabuf_v1 version 2 support is removed. */ @@ -531,6 +531,11 @@ video_output_features = [ 'wayland-cursor', '>= 1.15.0', 'xkbcommon', '>= 0.3.0'), } , { + 'name': 'wayland-protocols-1-24', + 'desc': 'wayland-protocols version 1.24+', + 'deps': 'wayland', + 'func': check_pkg_config('wayland-protocols >= 1.24'), + } , { 'name': 'memfd_create', 'desc': "Linux's memfd_create()", 'deps': 'wayland', |