diff options
author | James McDonnell <jmcdonnell@blackberry.com> | 2019-12-05 12:12:37 -0500 |
---|---|---|
committer | James McDonnell <jmcdonnell@blackberry.com> | 2020-01-13 11:50:21 -0500 |
commit | 5a66bc64b0b157929c9fc76f0f4ae046393be600 (patch) | |
tree | 982af2ecd7f8d64cca36e4390b485ebe381eee12 | |
parent | da13b1b130f520ee0bd9df0e9190db64a2ea4a93 (diff) | |
download | qtwayland-5a66bc64b0b157929c9fc76f0f4ae046393be600.tar.gz |
Enable QtWayland for QNX
Make EGL 1.5 with EGL_PLATFORM_WAYLAND_EXT a requirement for QNX and
add some EGL 1.5 code alternatives. Avoids the need to deal with
incompatibility problems between the QNX native display/window type
and Wayland display/window type.
Change-Id: Ib26a020e1f8c7f570c6af08697d8c8153c887294
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Dan Cape <dcape@qnx.com>
5 files changed, 31 insertions, 4 deletions
diff --git a/qtwayland.pro b/qtwayland.pro index fdcc3e24..1dfa06ae 100644 --- a/qtwayland.pro +++ b/qtwayland.pro @@ -1,3 +1,3 @@ -requires(linux:!android|macos) +requires(linux:!android|macos|qnx) requires(qtHaveModule(gui)) load(qt_parts) diff --git a/src/client/configure.json b/src/client/configure.json index 7d446824..9b8b4345 100644 --- a/src/client/configure.json +++ b/src/client/configure.json @@ -168,6 +168,21 @@ "return 0;" ] } + }, + "egl_1_5-wayland": { + "label": "EGL 1.5 with Wayland Platform", + "type": "compile", + "test": { + "include": [ + "EGL/egl.h", + "EGL/eglext.h", + "wayland-client.h" + ], + "main": [ + "eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, (struct wl_display *)(nullptr), nullptr);" + ] + }, + "use": "egl" } }, @@ -218,7 +233,7 @@ }, "wayland-egl": { "label": "EGL", - "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl", + "condition": "features.wayland-client && features.opengl && features.egl && libs.wayland-egl && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-brcm": { @@ -238,7 +253,7 @@ }, "wayland-drm-egl-server-buffer": { "label": "DRM EGL", - "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server", + "condition": "features.wayland-client && features.opengl && features.egl && tests.drm-egl-server && (!config.qnx || tests.egl_1_5-wayland)", "output": [ "privateFeature" ] }, "wayland-libhybris-egl-server-buffer": { diff --git a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp index 75419646..42c85f7d 100644 --- a/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp +++ b/src/hardwareintegration/client/drm-egl-server/drmeglserverbufferintegration.cpp @@ -125,7 +125,11 @@ void DrmEglServerBufferIntegration::initializeEgl() return; m_egl_initialized = true; +#if defined(EGL_VERSION_1_5) && defined(EGL_PLATFORM_WAYLAND_EXT) + m_egl_display = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, m_display->wl_display(), nullptr); +#else m_egl_display = eglGetDisplay((EGLNativeDisplayType) m_display->wl_display()); +#endif if (m_egl_display == EGL_NO_DISPLAY) { qWarning("Failed to initialize drm egl server buffer integration. Could not get egl display from wl_display."); return; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp index 0dc389bb..6f0b57fc 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp @@ -76,6 +76,9 @@ QWaylandEglClientBufferIntegration::~QWaylandEglClientBufferIntegration() void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) { +#if defined(EGL_VERSION_1_5) && defined(EGL_PLATFORM_WAYLAND_EXT) + m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr); +#else if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_base")) { if (q_hasEglExtension(EGL_NO_DISPLAY, "EGL_KHR_platform_wayland") || q_hasEglExtension(EGL_NO_DISPLAY, "EGL_EXT_platform_wayland") || @@ -98,6 +101,7 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) display->wl_display()); } +#endif m_display = display; diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp index 7679a5fb..8ea8e109 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp @@ -346,7 +346,11 @@ void QWaylandGLContext::updateGLFormat() wl_surface *wlSurface = m_display->createSurface(nullptr); wl_egl_window *eglWindow = wl_egl_window_create(wlSurface, 1, 1); - EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, 0); +#if defined(EGL_VERSION_1_5) + EGLSurface eglSurface = eglCreatePlatformWindowSurface(m_eglDisplay, m_config, eglWindow, nullptr); +#else + EGLSurface eglSurface = eglCreateWindowSurface(m_eglDisplay, m_config, eglWindow, nullptr); +#endif if (eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) { if (m_format.renderableType() == QSurfaceFormat::OpenGL |