xcb: Support EGLStreams for Wayland on X11

To make NVidia EGLStreams work on the desktop, we need to use eglGetPlatformDisplayEXT
instead of eglGetDisplay. Therefore, let's try that first if we have the extension.

Change-Id: Id420fb46d5bc5345faa5cbb066584b0859d50417
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Paul Olav Tvete 2016-09-25 11:12:02 +02:00 committed by Paul Olav Tvete
parent 41a7d74385
commit 1a947f6fc2
2 changed files with 17 additions and 1 deletions

View File

@ -140,6 +140,10 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay
#define EGL_DRM_PLANE_EXT 0x3235
#endif
#ifndef EGL_PLATFORM_X11_KHR
#define EGL_PLATFORM_X11_KHR 0x31D5
#endif
QT_BEGIN_NAMESPACE
class QEGLStreamConvenience

View File

@ -42,6 +42,7 @@
#include "qxcbeglcontext.h"
#include <QtGui/QOffscreenSurface>
#include <QtPlatformSupport/private/qeglstreamconvenience_p.h>
#include "qxcbeglnativeinterfacehandler.h"
@ -63,7 +64,18 @@ QXcbEglIntegration::~QXcbEglIntegration()
bool QXcbEglIntegration::initialize(QXcbConnection *connection)
{
m_connection = connection;
m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) {
QEGLStreamConvenience streamFuncs;
m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR,
xlib_display(),
nullptr);
}
if (!m_egl_display)
m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
EGLint major, minor;
bool success = eglInitialize(m_egl_display, &major, &minor);