Skip to content

Commit 1b7d71f

Browse files
emersionXinfengZhang
authored andcommitted
wayland: add support for linux-dmabuf
wl_drm is a legacy protocol, and wlroots is getting rid of it [1]. Use the newer and standard linux-dmabuf protocol if available to get the DRM device. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4397 Signed-off-by: Simon Ser <contact@emersion.fr>
1 parent 6f3e068 commit 1b7d71f

8 files changed

+1035
-14
lines changed

configure.ac

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ m4_define([libva_lt_age],
7575
[m4_eval(libva_binary_age - libva_interface_age)])
7676

7777
# libdrm minimun version requirement
78-
m4_define([libdrm_version], [2.4.60])
78+
# 2.4.75 for drmGetDevices2
79+
m4_define([libdrm_version], [2.4.75])
7980

8081
# Wayland minimum version number
8182
# 1.11.0 for wl_proxy_create_wrapper

meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ cc = meson.get_compiler('c')
8585
dl_dep = cc.find_library('dl', required : false)
8686

8787
WITH_DRM = not get_option('disable_drm') and (host_machine.system() != 'windows')
88-
libdrm_dep = dependency('libdrm', version : '>= 2.4.60', required : (host_machine.system() != 'windows'))
88+
libdrm_dep = dependency('libdrm', version : '>= 2.4.75', required : (host_machine.system() != 'windows'))
8989

9090
WITH_X11 = false
9191
if get_option('with_x11') != 'no'

va/meson.build

+20-12
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ endif
228228
if WITH_WAYLAND
229229
libva_wayland_sources = [
230230
'wayland/va_wayland.c',
231+
'wayland/va_wayland_linux_dmabuf.c',
231232
'wayland/va_wayland_drm.c',
232233
'wayland/va_wayland_emgd.c',
233234
'drm/va_drm_utils.c',
@@ -241,24 +242,31 @@ if WITH_WAYLAND
241242
libva_headers_subproject += libva_wayland_headers
242243

243244
libva_wayland_headers_priv = [
245+
'wayland/va_wayland_linux_dmabuf.h',
244246
'wayland/va_wayland_drm.h',
245247
'wayland/va_wayland_emgd.h',
246248
'wayland/va_wayland_private.h',
247249
]
248250

249-
protocol_files = [
250-
custom_target(
251-
'wayland-drm-client-protocol.c',
252-
output : 'wayland-drm-client-protocol.c',
253-
input : 'wayland/wayland-drm.xml',
254-
command : [wl_scanner, 'private-code', '@INPUT@', '@OUTPUT@']),
255-
256-
custom_target(
257-
'wayland-drm-client-protocol.h',
258-
output : 'wayland-drm-client-protocol.h',
259-
input : 'wayland/wayland-drm.xml',
251+
# XXX: grab linux-dmabuf-v1.xml from wayland-protocols
252+
protocols = {
253+
'wayland-drm': 'wayland/wayland-drm.xml',
254+
'linux-dmabuf-v1': 'wayland/linux-dmabuf-v1.xml',
255+
}
256+
257+
protocol_files = []
258+
foreach name, xml : protocols
259+
protocol_files += custom_target(
260+
name + '-client-protocol.c',
261+
output : name + '-client-protocol.c',
262+
input : xml,
263+
command : [wl_scanner, 'private-code', '@INPUT@', '@OUTPUT@'])
264+
protocol_files += custom_target(
265+
name + '-client-protocol.h',
266+
output : name + '-client-protocol.h',
267+
input : xml,
260268
command : [wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'])
261-
]
269+
endforeach
262270

263271
install_headers(libva_wayland_headers, subdir : 'va')
264272

va/wayland/Makefile.am

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ AM_CPPFLAGS = \
2929

3030
source_c = \
3131
va_wayland.c \
32+
va_wayland_linux_dmabuf.c \
3233
va_wayland_drm.c \
3334
va_wayland_emgd.c \
3435
../drm/va_drm_utils.c \
@@ -40,16 +41,19 @@ source_h = \
4041
$(NULL)
4142

4243
source_h_priv = \
44+
va_wayland_linux_dmabuf.h \
4345
va_wayland_drm.h \
4446
va_wayland_emgd.h \
4547
va_wayland_private.h \
4648
$(NULL)
4749

4850
protocol_source_c = \
51+
linux-dmabuf-v1-client-protocol.c \
4952
wayland-drm-client-protocol.c \
5053
$(NULL)
5154

5255
protocol_source_h = \
56+
linux-dmabuf-v1-client-protocol.h \
5357
wayland-drm-client-protocol.h \
5458
$(NULL)
5559

@@ -61,13 +65,15 @@ noinst_HEADERS = $(source_h_priv)
6165

6266
# Wayland protocol
6367
va_wayland_drm.c: $(protocol_source_h)
68+
va_wayland_linux_dmabuf.c: $(protocol_source_h)
6469
%-client-protocol.h : %.xml
6570
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
6671
%-client-protocol.c : %.xml
6772
$(AM_V_GEN)$(WAYLAND_SCANNER) private-code < $< > $@
6873

6974
EXTRA_DIST = \
7075
wayland-drm.xml \
76+
linux-dmabuf-v1.xml \
7177
$(NULL)
7278

7379
BUILT_SOURCES = $(protocol_source_h) $(protocol_source_c)

0 commit comments

Comments
 (0)