1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 17:12:36 +00:00

build: add an additional check for wayland-protocols 1.24

666cb91cf1 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]: a840b3634a
[1]: 8a5cd28a0e
This commit is contained in:
Dudemanguy 2022-10-29 13:07:34 -05:00
parent a9e1905a4a
commit f594482451
4 changed files with 14 additions and 3 deletions

View File

@ -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',

View File

@ -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;

View File

@ -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. */

View File

@ -530,6 +530,11 @@ video_output_features = [
'func': check_pkg_config('wayland-client', '>= 1.15.0',
'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()",