render/egl: include EGL/eglmesaext.h only if present

This patch will make the EGL renderer work on any EGL/GLESv2 driver
providing the EGL_WL_bind_wayland_display extensions.

Mesa used to declare provisional EGL_WL_bind_wayland_display directly
in <EGL/eglext.h>. Then, all unofficial extensions were moved to
<EGL/eglmesaext.h>, to have a cleaner implementation. See:
ab7bb10a2a

The extension was then approved at Khronos Group, and reached the
official <EGL/eglext.h>. See:
https://www.khronos.org/registry/EGL/extensions/WL/EGL_WL_bind_wayland_display.txt
aa9b63f3ab

In order to make sure the renderer will work on any version of any
implementation providing the extension, only include the mesa-specific
header if it's present.

Signed-off-by: Julien Olivain <juju@cotds.org>
This commit is contained in:
Julien Olivain 2020-05-11 08:58:30 +02:00 committed by GitHub
parent 1139234117
commit c2288a7b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#ifndef WLR_CONFIG_H
#define WLR_CONFIG_H
#mesondefine WLR_HAS_EGLMESAEXT_H
#mesondefine WLR_HAS_LIBCAP
#mesondefine WLR_HAS_SYSTEMD

View File

@ -16,10 +16,14 @@
#define EGL_NO_X11
#endif
#include <wlr/config.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#if WLR_HAS_EGLMESAEXT_H
// TODO: remove eglmesaext.h
#include <EGL/eglmesaext.h>
#endif
#include <pixman.h>
#include <stdbool.h>
#include <wayland-server-core.h>

View File

@ -86,6 +86,7 @@ conf_data.set10('WLR_HAS_X11_BACKEND', false)
conf_data.set10('WLR_HAS_XWAYLAND', false)
conf_data.set10('WLR_HAS_XCB_ERRORS', false)
conf_data.set10('WLR_HAS_XCB_ICCCM', false)
conf_data.set10('WLR_HAS_EGLMESAEXT_H', false)
# Clang complains about some zeroed initializer lists (= {0}), even though they
# are valid
@ -109,6 +110,10 @@ pixman = dependency('pixman-1')
math = cc.find_library('m')
rt = cc.find_library('rt')
if cc.has_header('EGL/eglmesaext.h', dependencies: egl)
conf_data.set10('WLR_HAS_EGLMESAEXT_H', true)
endif
wlr_files = []
wlr_deps = [
wayland_server,