[Mesa-stable] [PATCH 1/5] wayland-egl: allow shipping the library or not
Emil Velikov
emil.l.velikov at gmail.com
Tue Jun 5 14:14:30 UTC 2018
From: Emil Velikov <emil.velikov at collabora.com>
Recently the wayland-egl library and pkg-config file were moved to the
Wayland repository. With that a strange conflict came to be - which one
should be used and when.
The long term goal is to remove the Mesa copies, but with this patch we
allow builders to explicitly select if they want it.
Note: since the header (wayland-egl-backend.h) is now used by C++
people, s/private/driver_private/ was applied.
Cc: Eric Engestrom <eric.engestrom at intel.com>
CC: 18.0 18.1 <mesa-stable at freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
configure.ac | 17 +++++++++++++++++
meson.build | 12 ++++++++++++
meson_options.txt | 6 ++++++
src/Makefile.am | 2 ++
src/egl/Makefile.am | 1 +
src/egl/drivers/dri2/platform_wayland.c | 12 ++++++++++++
src/egl/meson.build | 2 +-
src/meson.build | 2 +-
8 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 02dca4547c8..5ea52242bd1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ LIBOMXIL_BELLAGIO_REQUIRED=0.0
LIBOMXIL_TIZONIA_REQUIRED=0.10.0
LIBVA_REQUIRED=0.39.0
VDPAU_REQUIRED=1.1
+# TODO: Bump to 1.15 -> the first version that ships wayland-egl-backend
WAYLAND_REQUIRED=1.11
WAYLAND_PROTOCOLS_REQUIRED=1.8
XCB_REQUIRED=1.9.3
@@ -1766,6 +1767,18 @@ if test "x$enable_glx_read_only_text" = xyes; then
DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
fi
+dnl
+dnl TEMPORARY: mostly for stable releases
+dnl
+dnl It will allow easier management as the wayland-egl library was
+dnl moved to the Wayland project
+dnl
+AC_ARG_ENABLE(bundled-wayland-egl,
+ [AS_HELP_STRING([--disable-bundled-wayland-egl],
+ [disable shipping of the wayland-egl library and pkg-config file @<:@default=enabled@:>@])],
+ [enable_wayland_egl=$enableval], [enable_wayland_egl=yes])
+AM_CONDITIONAL(BUILD_WAYLAND_EGL, test "x$enable_wayland_egl" = xyes)
+
dnl
dnl DEPRECATED: EGL Platforms configuration
dnl
@@ -1807,6 +1820,10 @@ for plat in $platforms; do
PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= $WAYLAND_REQUIRED])
PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server >= $WAYLAND_REQUIRED])
+ if test "x$enable_egl" = xyes -a "x$enable_wayland_egl" != xyes; then
+ PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl-backend >= 3])
+ DEFINES="$DEFINES -DUSE_EXTERNAL_WAYLAND_EGL"
+ fi
PKG_CHECK_MODULES([WAYLAND_PROTOCOLS], [wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED])
WAYLAND_PROTOCOLS_DATADIR=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
diff --git a/meson.build b/meson.build
index 4aafba802a5..a4c72dad41a 100644
--- a/meson.build
+++ b/meson.build
@@ -1229,8 +1229,19 @@ endif
if with_platform_wayland
prog_wl_scanner = find_program('wayland-scanner')
dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
+ # TODO: Bump to 1.15 -> the first version that ships wayland-egl-backend
dep_wayland_client = dependency('wayland-client', version : '>=1.11')
dep_wayland_server = dependency('wayland-server', version : '>=1.11')
+ build_wayland_egl = get_option('bundled-wayland-egl')
+ if with_egl and not build_wayland_egl
+ dep_wayland_egl = dependency('wayland-egl-backend', version : '>= 3')
+ dep_wayland_egl_headers = declare_dependency(
+ compile_args : run_command(prog_pkgconfig, ['wayland-egl-backend', '--cflags']).stdout().split()
+ )
+ pre_args += ['-DUSE_EXTERNAL_WAYLAND_EGL']
+ else
+ dep_wayland_egl_headers = null_dep
+ endif
wayland_dmabuf_xml = join_paths(
dep_wl_protocols.get_pkgconfig_variable('pkgdatadir'), 'unstable',
'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml'
@@ -1241,6 +1252,7 @@ else
dep_wl_protocols = null_dep
dep_wayland_client = null_dep
dep_wayland_server = null_dep
+ dep_wayland_egl_headers = null_dep
wayland_dmabuf_xml = ''
endif
diff --git a/meson_options.txt b/meson_options.txt
index 2c1f514debe..77d7c283fc9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -212,6 +212,12 @@ option(
choices : ['auto', 'true', 'false'],
description : 'Build support for EGL platform'
)
+option(
+ 'bundled-wayland-egl',
+ type : 'boolean',
+ value : true,
+ description : 'Build/ship the wayland-egl library and pkg-config file'
+)
option(
'glvnd',
type : 'boolean',
diff --git a/src/Makefile.am b/src/Makefile.am
index fd5ae445502..d91ecb3e239 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -97,8 +97,10 @@ endif
## Optionally required by EGL
if HAVE_PLATFORM_WAYLAND
+if BUILD_WAYLAND_EGL
SUBDIRS += egl/wayland/wayland-egl
endif
+endif
if HAVE_EGL
SUBDIRS += egl
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 086a4a1e630..bde400bb47f 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -87,6 +87,7 @@ libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
AM_CFLAGS += $(WAYLAND_SERVER_CFLAGS)
libEGL_common_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
libEGL_common_la_LIBADD += $(WAYLAND_SERVER_LIBS)
+AM_CFLAGS += $(WAYLAND_EGL_CFLAGS)
dri2_backend_FILES += \
drivers/dri2/platform_wayland.c
dri2_backend_GENERATED_FILES += \
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 63da21cdf55..c49041f1174 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -49,7 +49,11 @@
#include "wayland-drm-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
+#ifdef USE_EXTERNAL_WAYLAND_EGL
+#include <wayland-egl-backend.h>
+#else
#include "wayland/wayland-egl/wayland-egl-backend.h"
+#endif
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
@@ -298,7 +302,11 @@ dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
dri2_surf->wl_queue);
dri2_surf->wl_win = window;
+#ifdef USE_EXTERNAL_WAYLAND_EGL
+ dri2_surf->wl_win->driver_private = dri2_surf;
+#else
dri2_surf->wl_win->private = dri2_surf;
+#endif
dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
if (dri2_dpy->flush)
dri2_surf->wl_win->resize_callback = resize_callback;
@@ -384,7 +392,11 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
wl_callback_destroy(dri2_surf->throttle_callback);
if (dri2_surf->wl_win) {
+#ifdef USE_EXTERNAL_WAYLAND_EGL
+ dri2_surf->wl_win->driver_private = NULL;
+#else
dri2_surf->wl_win->private = NULL;
+#endif
dri2_surf->wl_win->resize_callback = NULL;
dri2_surf->wl_win->destroy_window_callback = NULL;
}
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 9050d763a6c..be5a09106c6 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -116,7 +116,7 @@ if with_platform_surfaceless
files_egl += files('drivers/dri2/platform_surfaceless.c')
endif
if with_platform_wayland
- deps_for_egl += [dep_wayland_client, dep_wayland_server]
+ deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
link_for_egl += libwayland_drm
files_egl += files('drivers/dri2/platform_wayland.c')
files_egl += [
diff --git a/src/meson.build b/src/meson.build
index c2566b7a687..50af466c2ad 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -75,7 +75,7 @@ if with_gbm
else
inc_gbm = []
endif
-if with_egl
+if with_egl and build_wayland_egl
subdir('egl')
endif
if with_gallium
--
2.16.0
More information about the mesa-stable
mailing list