Commit 5e5b9f45 authored by Laszlo Agocs's avatar Laszlo Agocs Committed by Giulio Camuffo

Enable Qt WebEngine on Wayland

The native resource getters that are supported by eglfs will have to be
supported by the wayland platform plugin too. (on wayland-egl at least)

Change-Id: Ibbab649c04785dbde177342c45b9bc6f1edd954d
Reviewed-by: default avatarAndy Nichols <andy.nichols@theqtcompany.com>
Reviewed-by: default avatarAndras Becsi <andras.becsi@theqtcompany.com>
parent e51ca4b1
......@@ -67,6 +67,14 @@ public:
virtual QWaylandWindow *createEglWindow(QWindow *window) = 0;
virtual QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const = 0;
enum NativeResource {
EglDisplay,
EglConfig,
EglContext
};
virtual void *nativeResource(NativeResource /*resource*/) { return Q_NULLPTR; }
virtual void *nativeResourceForContext(NativeResource /*resource*/, QPlatformOpenGLContext */*context*/) { return Q_NULLPTR; }
};
QT_END_NAMESPACE
......
......@@ -49,6 +49,8 @@
#include "qwaylandscreen_p.h"
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QScreen>
#include <QtWaylandClient/private/qwaylandclientbufferintegration_p.h>
#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
......@@ -61,13 +63,16 @@ void *QWaylandNativeInterface::nativeResourceForIntegration(const QByteArray &re
{
QByteArray lowerCaseResource = resourceString.toLower();
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display")
if (lowerCaseResource == "display" || lowerCaseResource == "wl_display" || lowerCaseResource == "nativedisplay")
return m_integration->display()->wl_display();
if (lowerCaseResource == "compositor")
return const_cast<wl_compositor *>(m_integration->display()->wl_compositor());
if (lowerCaseResource == "server_buffer_integration")
return m_integration->serverBufferIntegration();
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResource(QWaylandClientBufferIntegration::EglDisplay);
return 0;
}
......@@ -96,6 +101,22 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
return NULL;
}
void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
QByteArray lowerCaseResource = resource.toLower();
if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglConfig, context->handle());
if (lowerCaseResource == "eglcontext" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglContext, context->handle());
if (lowerCaseResource == "egldisplay" && m_integration->clientBufferIntegration())
return m_integration->clientBufferIntegration()->nativeResourceForContext(QWaylandClientBufferIntegration::EglDisplay, context->handle());
return 0;
}
QVariantMap QWaylandNativeInterface::windowProperties(QPlatformWindow *window) const
{
QWaylandWindow *waylandWindow = static_cast<QWaylandWindow *>(window);
......
......@@ -61,6 +61,7 @@ public:
QWindow *window);
void *nativeResourceForScreen(const QByteArray &resourceString,
QScreen *screen);
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
QVariantMap windowProperties(QPlatformWindow *window) const;
QVariant windowProperty(QPlatformWindow *window, const QString &name) const;
......
......@@ -121,6 +121,33 @@ QPlatformOpenGLContext *QWaylandEglClientBufferIntegration::createPlatformOpenGL
return new QWaylandGLContext(m_eglDisplay, m_display, glFormat, share);
}
void *QWaylandEglClientBufferIntegration::nativeResource(NativeResource resource)
{
switch (resource) {
case EglDisplay:
return m_eglDisplay;
default:
break;
}
return Q_NULLPTR;
}
void *QWaylandEglClientBufferIntegration::nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context)
{
Q_ASSERT(context);
switch (resource) {
case EglConfig:
return static_cast<QWaylandGLContext *>(context)->eglConfig();
case EglContext:
return static_cast<QWaylandGLContext *>(context)->eglContext();
case EglDisplay:
return m_eglDisplay;
default:
break;
}
return Q_NULLPTR;
}
EGLDisplay QWaylandEglClientBufferIntegration::eglDisplay() const
{
return m_eglDisplay;
......
......@@ -64,6 +64,9 @@ public:
QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE;
QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const Q_DECL_OVERRIDE;
void *nativeResource(NativeResource resource) Q_DECL_OVERRIDE;
void *nativeResourceForContext(NativeResource resource, QPlatformOpenGLContext *context) Q_DECL_OVERRIDE;
EGLDisplay eglDisplay() const;
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment