egl: always compile surfaceless

It has no dependencies and costs virtually nothing to build. There is
no downside to enabling it unconditionally, so let's do just that.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3161>
This commit is contained in:
Eric Engestrom 2019-06-25 13:47:04 +01:00 committed by Marge Bot
parent e66e0c0c2d
commit a38e21d668
9 changed files with 20 additions and 44 deletions

View file

@ -520,7 +520,7 @@ meson-testing:
-D glx=dri -D glx=dri
-D gbm=enabled -D gbm=enabled
-D egl=enabled -D egl=enabled
-D platforms=x11,drm,surfaceless -D platforms=x11,drm
GALLIUM_ST: > GALLIUM_ST: >
-D dri3=enabled -D dri3=enabled
GALLIUM_DRIVERS: "swrast,virgl" GALLIUM_DRIVERS: "swrast,virgl"
@ -540,7 +540,7 @@ meson-gallium:
-D glx=dri -D glx=dri
-D gbm=enabled -D gbm=enabled
-D egl=enabled -D egl=enabled
-D platforms=x11,wayland,drm,surfaceless -D platforms=x11,wayland,drm
GALLIUM_ST: > GALLIUM_ST: >
-D dri3=enabled -D dri3=enabled
-D gallium-extra-hud=true -D gallium-extra-hud=true
@ -585,7 +585,7 @@ meson-classic:
-D glx=disabled -D glx=disabled
-D gbm=disabled -D gbm=disabled
-D egl=enabled -D egl=enabled
-D platforms=surfaceless -D platforms=[]
-D osmesa=none -D osmesa=none
GALLIUM_ST: > GALLIUM_ST: >
-D dri3=disabled -D dri3=disabled
@ -705,7 +705,7 @@ meson-clover-old-llvm:
-D glx=disabled -D glx=disabled
-D egl=disabled -D egl=disabled
-D gbm=disabled -D gbm=disabled
-D platforms=drm,surfaceless -D platforms=drm
GALLIUM_DRIVERS: "i915,r600" GALLIUM_DRIVERS: "i915,r600"
script: script:
- LLVM_VERSION=3.9 .gitlab-ci/meson-build.sh - LLVM_VERSION=3.9 .gitlab-ci/meson-build.sh

View file

@ -54,7 +54,7 @@ time
used by the main library to decide the native platform. used by the main library to decide the native platform.
The available platforms are ``x11``, ``drm``, ``wayland``, The available platforms are ``x11``, ``drm``, ``wayland``,
``surfaceless``, ``android``, and ``haiku``. The ``android`` platform ``android``, and ``haiku``. The ``android`` platform
can either be built as a system component, part of AOSP, using can either be built as a system component, part of AOSP, using
``Android.mk`` files, or cross-compiled using appropriate options. ``Android.mk`` files, or cross-compiled using appropriate options.
Unless for special needs, the build system should select the right Unless for special needs, the build system should select the right

View file

@ -293,9 +293,9 @@ endif
_platforms = get_option('platforms') _platforms = get_option('platforms')
if _platforms.contains('auto') if _platforms.contains('auto')
if system_has_kms_drm if system_has_kms_drm
_platforms = ['x11', 'wayland', 'drm', 'surfaceless'] _platforms = ['x11', 'wayland', 'drm']
elif ['darwin', 'cygwin'].contains(host_machine.system()) elif ['darwin', 'cygwin'].contains(host_machine.system())
_platforms = ['x11', 'surfaceless'] _platforms = ['x11']
elif ['haiku'].contains(host_machine.system()) elif ['haiku'].contains(host_machine.system())
_platforms = ['haiku'] _platforms = ['haiku']
elif host_machine.system() == 'windows' elif host_machine.system() == 'windows'
@ -311,11 +311,16 @@ with_platform_x11 = _platforms.contains('x11')
with_platform_wayland = _platforms.contains('wayland') with_platform_wayland = _platforms.contains('wayland')
with_platform_drm = _platforms.contains('drm') with_platform_drm = _platforms.contains('drm')
with_platform_haiku = _platforms.contains('haiku') with_platform_haiku = _platforms.contains('haiku')
with_platform_surfaceless = _platforms.contains('surfaceless')
with_platform_windows = _platforms.contains('windows') with_platform_windows = _platforms.contains('windows')
if _platforms.contains('surfaceless')
warning('Platform `surfaceless` is now always selected; setting this option will be an error in Mesa 20.3')
endif
if _platforms.length() != 0 if _platforms.length() != 0
egl_native_platform = _platforms[0] egl_native_platform = _platforms[0]
else
egl_native_platform = 'surfaceless'
endif endif
_xlib_lease = get_option('xlib-lease') _xlib_lease = get_option('xlib-lease')
@ -393,15 +398,13 @@ endif
if _egl == 'auto' if _egl == 'auto'
with_egl = ( with_egl = (
not ['darwin', 'windows'].contains(host_machine.system()) and not ['darwin', 'windows'].contains(host_machine.system()) and
with_dri and with_shared_glapi and _platforms.length() != 0 with_dri and with_shared_glapi
) )
elif _egl == 'enabled' elif _egl == 'enabled'
if not with_dri if not with_dri
error('EGL requires dri') error('EGL requires dri')
elif not with_shared_glapi elif not with_shared_glapi
error('EGL requires shared-glapi') error('EGL requires shared-glapi')
elif _platforms.length() == 0
error('No platforms specified, consider -Dplatforms=drm,x11,surfaceless at least')
elif not ['disabled', 'dri'].contains(with_glx) elif not ['disabled', 'dri'].contains(with_glx)
error('EGL requires dri, but a GLX is being built without dri') error('EGL requires dri, but a GLX is being built without dri')
elif ['darwin', 'windows'].contains(host_machine.system()) elif ['darwin', 'windows'].contains(host_machine.system())
@ -412,15 +415,6 @@ else
with_egl = false with_egl = false
endif endif
if with_egl and not (with_platform_drm or with_platform_surfaceless or with_platform_android)
if with_gallium_radeonsi
error('RadeonSI requires the drm, surfaceless or android platform when using EGL')
endif
if with_gallium_virgl
error('Virgl requires the drm, surfaceless or android platform when using EGL')
endif
endif
# Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS. # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
if not ['windows', 'freebsd'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29) if not ['windows', 'freebsd'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29)
pre_args += '-DUSE_ELF_TLS' pre_args += '-DUSE_ELF_TLS'
@ -834,9 +828,6 @@ if with_platform_drm
endif endif
pre_args += '-DHAVE_DRM_PLATFORM' pre_args += '-DHAVE_DRM_PLATFORM'
endif endif
if with_platform_surfaceless
pre_args += '-DHAVE_SURFACELESS_PLATFORM'
endif
if with_platform_android if with_platform_android
dep_android = [ dep_android = [
dependency('cutils'), dependency('cutils'),
@ -1888,7 +1879,8 @@ if with_egl
lines += 'EGL drivers: ' + ' '.join(egl_drivers) lines += 'EGL drivers: ' + ' '.join(egl_drivers)
endif endif
lines += 'GBM: ' + (with_gbm ? 'yes' : 'no') lines += 'GBM: ' + (with_gbm ? 'yes' : 'no')
if _platforms.length() != 0 if with_egl or with_any_vk
_platforms += 'surfaceless'
lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms) lines += 'EGL/Vulkan/VL platforms: ' + ' '.join(_platforms)
endif endif

View file

@ -503,16 +503,8 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
} }
#endif #endif
#ifdef HAVE_SURFACELESS_PLATFORM
EGLBoolean EGLBoolean
dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp); dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp);
#else
static inline EGLBoolean
dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
{
return _eglError(EGL_NOT_INITIALIZED, "Surfaceless platform not built");
}
#endif
EGLBoolean EGLBoolean
dri2_initialize_device(_EGLDriver *drv, _EGLDisplay *disp); dri2_initialize_device(_EGLDriver *drv, _EGLDisplay *disp);

View file

@ -401,11 +401,9 @@ _eglGetPlatformDisplayCommon(EGLenum platform, void *native_display,
attrib_list); attrib_list);
break; break;
#endif #endif
#ifdef HAVE_SURFACELESS_PLATFORM
case EGL_PLATFORM_SURFACELESS_MESA: case EGL_PLATFORM_SURFACELESS_MESA:
disp = _eglGetSurfacelessDisplay(native_display, attrib_list); disp = _eglGetSurfacelessDisplay(native_display, attrib_list);
break; break;
#endif
#ifdef HAVE_ANDROID_PLATFORM #ifdef HAVE_ANDROID_PLATFORM
case EGL_PLATFORM_ANDROID_KHR: case EGL_PLATFORM_ANDROID_KHR:
disp = _eglGetAndroidDisplay(native_display, attrib_list); disp = _eglGetAndroidDisplay(native_display, attrib_list);

View file

@ -534,7 +534,6 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
} }
#endif /* HAVE_WAYLAND_PLATFORM */ #endif /* HAVE_WAYLAND_PLATFORM */
#ifdef HAVE_SURFACELESS_PLATFORM
_EGLDisplay* _EGLDisplay*
_eglGetSurfacelessDisplay(void *native_display, _eglGetSurfacelessDisplay(void *native_display,
const EGLAttrib *attrib_list) const EGLAttrib *attrib_list)
@ -554,7 +553,6 @@ _eglGetSurfacelessDisplay(void *native_display,
return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display, return _eglFindDisplay(_EGL_PLATFORM_SURFACELESS, native_display,
attrib_list); attrib_list);
} }
#endif /* HAVE_SURFACELESS_PLATFORM */
#ifdef HAVE_ANDROID_PLATFORM #ifdef HAVE_ANDROID_PLATFORM
_EGLDisplay* _EGLDisplay*

View file

@ -309,11 +309,9 @@ _eglGetWaylandDisplay(struct wl_display *native_display,
const EGLAttrib *attrib_list); const EGLAttrib *attrib_list);
#endif #endif
#ifdef HAVE_SURFACELESS_PLATFORM
_EGLDisplay* _EGLDisplay*
_eglGetSurfacelessDisplay(void *native_display, _eglGetSurfacelessDisplay(void *native_display,
const EGLAttrib *attrib_list); const EGLAttrib *attrib_list);
#endif
#ifdef HAVE_ANDROID_PLATFORM #ifdef HAVE_ANDROID_PLATFORM
_EGLDisplay* _EGLDisplay*

View file

@ -95,9 +95,7 @@ struct _egl_global _eglGlobal =
" EGL_MESA_platform_gbm" " EGL_MESA_platform_gbm"
" EGL_KHR_platform_gbm" " EGL_KHR_platform_gbm"
#endif #endif
#ifdef HAVE_SURFACELESS_PLATFORM
" EGL_MESA_platform_surfaceless" " EGL_MESA_platform_surfaceless"
#endif
"", "",
.debugCallback = NULL, .debugCallback = NULL,

View file

@ -96,7 +96,10 @@ if with_dri2
link_for_egl += libloader link_for_egl += libloader
incs_for_egl += inc_loader incs_for_egl += inc_loader
files_egl += files('drivers/dri2/platform_device.c') files_egl += files(
'drivers/dri2/platform_device.c',
'drivers/dri2/platform_surfaceless.c',
)
if with_platform_x11 if with_platform_x11
files_egl += files('drivers/dri2/platform_x11.c') files_egl += files('drivers/dri2/platform_x11.c')
if with_dri3 if with_dri3
@ -111,9 +114,6 @@ if with_dri2
incs_for_egl += [inc_gbm, include_directories('../gbm/main')] incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
deps_for_egl += dep_libdrm deps_for_egl += dep_libdrm
endif endif
if with_platform_surfaceless
files_egl += files('drivers/dri2/platform_surfaceless.c')
endif
if with_platform_wayland if with_platform_wayland
deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers] deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
link_for_egl += libwayland_drm link_for_egl += libwayland_drm