Get declarative and wayland EGL backend working for Qt compositor.
This commit is contained in:
parent
90ac74c771
commit
8ab2f3d9bd
@ -45,6 +45,8 @@
|
|||||||
#include <QtCore/qnamespace.h>
|
#include <QtCore/qnamespace.h>
|
||||||
#include <QtCore/QScopedPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
|
|
||||||
|
#include <QSurfaceFormat>
|
||||||
|
|
||||||
QT_BEGIN_HEADER
|
QT_BEGIN_HEADER
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -54,7 +56,6 @@ QT_MODULE(Gui)
|
|||||||
class QGuiGLContextPrivate;
|
class QGuiGLContextPrivate;
|
||||||
class QPlatformGLContext;
|
class QPlatformGLContext;
|
||||||
class QSurface;
|
class QSurface;
|
||||||
class QSurfaceFormat;
|
|
||||||
|
|
||||||
class Q_GUI_EXPORT QGuiGLContext
|
class Q_GUI_EXPORT QGuiGLContext
|
||||||
{
|
{
|
||||||
|
@ -50,4 +50,11 @@ void *QPlatformNativeInterface::nativeResourceForWindow(const QByteArray &resour
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *QPlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QGuiGLContext *context)
|
||||||
|
{
|
||||||
|
Q_UNUSED(resource);
|
||||||
|
Q_UNUSED(context);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -50,11 +50,13 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QT_MODULE(Gui)
|
QT_MODULE(Gui)
|
||||||
|
|
||||||
|
class QGuiGLContext;
|
||||||
class QWindow;
|
class QWindow;
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPlatformNativeInterface
|
class Q_GUI_EXPORT QPlatformNativeInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual void *nativeResourceForContext(const QByteArray &resource, QGuiGLContext *context);
|
||||||
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
|
virtual void *nativeResourceForWindow(const QByteArray &resource, QWindow *window);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -394,7 +394,9 @@ public:
|
|||||||
|
|
||||||
#ifdef Q_WS_QPA
|
#ifdef Q_WS_QPA
|
||||||
static QGLContext *fromGuiGLContext(QGuiGLContext *platformContext);
|
static QGLContext *fromGuiGLContext(QGuiGLContext *platformContext);
|
||||||
|
QGuiGLContext *contextHandle() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool chooseContext(const QGLContext* shareContext = 0);
|
virtual bool chooseContext(const QGLContext* shareContext = 0);
|
||||||
|
|
||||||
|
@ -386,6 +386,12 @@ QGLContext::QGLContext(QGuiGLContext *context)
|
|||||||
d->setupSharing();
|
d->setupSharing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGuiGLContext *QGLContext::contextHandle() const
|
||||||
|
{
|
||||||
|
Q_D(const QGLContext);
|
||||||
|
return d->guiGlContext;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns a OpenGL context for the window context specified by \a windowContext
|
Returns a OpenGL context for the window context specified by \a windowContext
|
||||||
*/
|
*/
|
||||||
|
@ -44,11 +44,12 @@
|
|||||||
#include "gl_integration/qwaylandglintegration.h"
|
#include "gl_integration/qwaylandglintegration.h"
|
||||||
|
|
||||||
#include "qwaylandeglwindow.h"
|
#include "qwaylandeglwindow.h"
|
||||||
|
#include "qwaylandglcontext.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay)
|
QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay)
|
||||||
: mWaylandDisplay(waylandDisplay)
|
: m_waylandDisplay(waylandDisplay)
|
||||||
{
|
{
|
||||||
qDebug() << "Using Wayland-EGL";
|
qDebug() << "Using Wayland-EGL";
|
||||||
}
|
}
|
||||||
@ -56,17 +57,17 @@ QWaylandEglIntegration::QWaylandEglIntegration(struct wl_display *waylandDisplay
|
|||||||
|
|
||||||
QWaylandEglIntegration::~QWaylandEglIntegration()
|
QWaylandEglIntegration::~QWaylandEglIntegration()
|
||||||
{
|
{
|
||||||
eglTerminate(mEglDisplay);
|
eglTerminate(m_eglDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandEglIntegration::initialize()
|
void QWaylandEglIntegration::initialize()
|
||||||
{
|
{
|
||||||
EGLint major,minor;
|
EGLint major,minor;
|
||||||
mEglDisplay = eglGetDisplay(mWaylandDisplay);
|
m_eglDisplay = eglGetDisplay(m_waylandDisplay);
|
||||||
if (mEglDisplay == NULL) {
|
if (m_eglDisplay == NULL) {
|
||||||
qWarning("EGL not available");
|
qWarning("EGL not available");
|
||||||
} else {
|
} else {
|
||||||
if (!eglInitialize(mEglDisplay, &major, &minor)) {
|
if (!eglInitialize(m_eglDisplay, &major, &minor)) {
|
||||||
qWarning("failed to initialize EGL display");
|
qWarning("failed to initialize EGL display");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,9 +79,14 @@ QWaylandWindow *QWaylandEglIntegration::createEglWindow(QWindow *window)
|
|||||||
return new QWaylandEglWindow(window);
|
return new QWaylandEglWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPlatformGLContext *QWaylandEglIntegration::createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const
|
||||||
|
{
|
||||||
|
return new QWaylandGLContext(m_eglDisplay, glFormat, share);
|
||||||
|
}
|
||||||
|
|
||||||
EGLDisplay QWaylandEglIntegration::eglDisplay() const
|
EGLDisplay QWaylandEglIntegration::eglDisplay() const
|
||||||
{
|
{
|
||||||
return mEglDisplay;
|
return m_eglDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay)
|
QWaylandGLIntegration *QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay)
|
||||||
|
@ -58,13 +58,14 @@ public:
|
|||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
QWaylandWindow *createEglWindow(QWindow *window);
|
QWaylandWindow *createEglWindow(QWindow *window);
|
||||||
|
QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const;
|
||||||
|
|
||||||
EGLDisplay eglDisplay() const;
|
EGLDisplay eglDisplay() const;
|
||||||
struct wl_egl_display *nativeDisplay() const;
|
|
||||||
private:
|
|
||||||
struct wl_display *mWaylandDisplay;
|
|
||||||
|
|
||||||
EGLDisplay mEglDisplay;
|
private:
|
||||||
|
struct wl_display *m_waylandDisplay;
|
||||||
|
|
||||||
|
EGLDisplay m_eglDisplay;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QWAYLANDEGLINTEGRATION_H
|
#endif // QWAYLANDEGLINTEGRATION_H
|
||||||
|
@ -44,21 +44,29 @@
|
|||||||
#include "qwaylandscreen.h"
|
#include "qwaylandscreen.h"
|
||||||
#include "qwaylandglcontext.h"
|
#include "qwaylandglcontext.h"
|
||||||
|
|
||||||
|
#include <QtPlatformSupport/private/qeglconvenience_p.h>
|
||||||
|
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
|
QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
|
||||||
: QWaylandWindow(window)
|
: QWaylandWindow(window)
|
||||||
, mGLContext(0)
|
, m_waylandEglWindow(0)
|
||||||
, mWaylandEglWindow(0)
|
, m_eglSurface(0)
|
||||||
|
, m_eglConfig(0)
|
||||||
|
, m_format(window->format())
|
||||||
{
|
{
|
||||||
mEglIntegration = static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration());
|
m_eglIntegration = static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration());
|
||||||
|
|
||||||
//super creates a new surface
|
//super creates a new surface
|
||||||
newSurfaceCreated();
|
newSurfaceCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandEglWindow::~QWaylandEglWindow()
|
QWaylandEglWindow::~QWaylandEglWindow()
|
||||||
{
|
{
|
||||||
delete mGLContext;
|
if (m_eglSurface) {
|
||||||
|
eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface);
|
||||||
|
m_eglSurface = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandWindow::WindowType QWaylandEglWindow::windowType() const
|
QWaylandWindow::WindowType QWaylandEglWindow::windowType() const
|
||||||
@ -69,46 +77,46 @@ QWaylandWindow::WindowType QWaylandEglWindow::windowType() const
|
|||||||
void QWaylandEglWindow::setGeometry(const QRect &rect)
|
void QWaylandEglWindow::setGeometry(const QRect &rect)
|
||||||
{
|
{
|
||||||
QWaylandWindow::setGeometry(rect);
|
QWaylandWindow::setGeometry(rect);
|
||||||
if (mWaylandEglWindow) {
|
if (m_waylandEglWindow)
|
||||||
wl_egl_window_resize(mWaylandEglWindow,rect.width(),rect.height(),0,0);
|
wl_egl_window_resize(m_waylandEglWindow, rect.width(), rect.height(), 0, 0);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandEglWindow::setParent(const QPlatformWindow *parent)
|
|
||||||
{
|
|
||||||
const QWaylandWindow *wParent = static_cast<const QWaylandWindow *>(parent);
|
|
||||||
|
|
||||||
mParentWindow = wParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPlatformGLContext * QWaylandEglWindow::glContext() const
|
|
||||||
{
|
|
||||||
if (!mGLContext) {
|
|
||||||
QWaylandEglWindow *that = const_cast<QWaylandEglWindow *>(this);
|
|
||||||
that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),this->window()->requestedWindowFormat());
|
|
||||||
|
|
||||||
EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
|
|
||||||
EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
|
|
||||||
that->mGLContext->setEglSurface(surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mGLContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandEglWindow::newSurfaceCreated()
|
void QWaylandEglWindow::newSurfaceCreated()
|
||||||
{
|
{
|
||||||
if (mWaylandEglWindow) {
|
if (m_waylandEglWindow)
|
||||||
wl_egl_window_destroy(mWaylandEglWindow);
|
wl_egl_window_destroy(m_waylandEglWindow);
|
||||||
}
|
|
||||||
wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual();
|
wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual();
|
||||||
QSize size = geometry().size();
|
QSize size = geometry().size();
|
||||||
if (!size.isValid())
|
if (!size.isValid())
|
||||||
size = QSize(0,0);
|
size = QSize(0,0);
|
||||||
|
|
||||||
mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual);
|
if (m_eglSurface) {
|
||||||
if (mGLContext) {
|
eglDestroySurface(m_eglIntegration->eglDisplay(), m_eglSurface);
|
||||||
EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
|
m_eglSurface = 0;
|
||||||
EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
|
|
||||||
mGLContext->setEglSurface(surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_waylandEglWindow = wl_egl_window_create(mSurface, size.width(), size.height(), visual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSurfaceFormat QWaylandEglWindow::format() const
|
||||||
|
{
|
||||||
|
return m_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
EGLSurface QWaylandEglWindow::eglSurface() const
|
||||||
|
{
|
||||||
|
if (!m_waylandEglWindow)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!m_eglSurface) {
|
||||||
|
if (!m_eglConfig)
|
||||||
|
m_eglConfig = q_configFromGLFormat(m_eglIntegration->eglDisplay(), window()->format(), true);
|
||||||
|
|
||||||
|
EGLNativeWindowType window = m_waylandEglWindow;
|
||||||
|
m_eglSurface = eglCreateWindowSurface(m_eglIntegration->eglDisplay(), m_eglConfig, window, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_eglSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -55,16 +55,24 @@ public:
|
|||||||
~QWaylandEglWindow();
|
~QWaylandEglWindow();
|
||||||
WindowType windowType() const;
|
WindowType windowType() const;
|
||||||
void setGeometry(const QRect &rect);
|
void setGeometry(const QRect &rect);
|
||||||
void setParent(const QPlatformWindow *parent);
|
|
||||||
QPlatformGLContext *glContext() const;
|
EGLSurface eglSurface() const;
|
||||||
|
|
||||||
|
QSurfaceFormat format() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void newSurfaceCreated();
|
void newSurfaceCreated();
|
||||||
private:
|
|
||||||
QWaylandEglIntegration *mEglIntegration;
|
|
||||||
QWaylandGLContext *mGLContext;
|
|
||||||
struct wl_egl_window *mWaylandEglWindow;
|
|
||||||
|
|
||||||
const QWaylandWindow *mParentWindow;
|
private:
|
||||||
|
QWaylandEglIntegration *m_eglIntegration;
|
||||||
|
struct wl_egl_window *m_waylandEglWindow;
|
||||||
|
|
||||||
|
const QWaylandWindow *m_parentWindow;
|
||||||
|
|
||||||
|
mutable EGLSurface m_eglSurface;
|
||||||
|
mutable EGLConfig m_eglConfig;
|
||||||
|
|
||||||
|
QSurfaceFormat m_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QWAYLANDEGLWINDOW_H
|
#endif // QWAYLANDEGLWINDOW_H
|
||||||
|
@ -43,21 +43,21 @@
|
|||||||
|
|
||||||
#include "qwaylanddisplay.h"
|
#include "qwaylanddisplay.h"
|
||||||
#include "qwaylandwindow.h"
|
#include "qwaylandwindow.h"
|
||||||
|
#include "qwaylandeglwindow.h"
|
||||||
|
|
||||||
#include "../../../eglconvenience/qeglconvenience.h"
|
#include <QtPlatformSupport/private/qeglconvenience_p.h>
|
||||||
|
|
||||||
#include <QtGui/QPlatformGLContext>
|
#include <QtGui/QPlatformGLContext>
|
||||||
#include <QtGui/QWindowFormat>
|
#include <QtGui/QSurfaceFormat>
|
||||||
#include <QtCore/QMutex>
|
#include <QtCore/QMutex>
|
||||||
|
|
||||||
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format)
|
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformGLContext *share)
|
||||||
: QPlatformGLContext()
|
: QPlatformGLContext()
|
||||||
, mEglDisplay(eglDisplay)
|
, m_eglDisplay(eglDisplay)
|
||||||
, mSurface(EGL_NO_SURFACE)
|
, m_config(q_configFromGLFormat(m_eglDisplay, format, true))
|
||||||
, mConfig(q_configFromQWindowFormat(mEglDisplay,format,true))
|
, m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
|
||||||
, mFormat(q_windowFormatFromConfig(mEglDisplay,mConfig))
|
|
||||||
{
|
{
|
||||||
EGLContext shareEGLContext = EGL_NO_CONTEXT;
|
EGLContext shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
|
||||||
|
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
@ -66,55 +66,38 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat
|
|||||||
eglContextAttrs.append(2);
|
eglContextAttrs.append(2);
|
||||||
eglContextAttrs.append(EGL_NONE);
|
eglContextAttrs.append(EGL_NONE);
|
||||||
|
|
||||||
mContext = eglCreateContext(mEglDisplay, mConfig,
|
m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData());
|
||||||
shareEGLContext, eglContextAttrs.constData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandGLContext::QWaylandGLContext()
|
|
||||||
: QPlatformGLContext()
|
|
||||||
, mEglDisplay(0)
|
|
||||||
, mContext(EGL_NO_CONTEXT)
|
|
||||||
, mSurface(EGL_NO_SURFACE)
|
|
||||||
, mConfig(0)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QWaylandGLContext::~QWaylandGLContext()
|
QWaylandGLContext::~QWaylandGLContext()
|
||||||
{
|
{
|
||||||
eglDestroyContext(mEglDisplay,mContext);
|
eglDestroyContext(m_eglDisplay, m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandGLContext::makeCurrent()
|
bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
|
||||||
{
|
{
|
||||||
if (mSurface == EGL_NO_SURFACE) {
|
EGLSurface eglSurface = static_cast<QWaylandEglWindow *>(surface)->eglSurface();
|
||||||
qWarning("makeCurrent with EGL_NO_SURFACE");
|
return eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context);
|
||||||
}
|
|
||||||
eglMakeCurrent(mEglDisplay, mSurface, mSurface, mContext);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandGLContext::doneCurrent()
|
void QWaylandGLContext::doneCurrent()
|
||||||
{
|
{
|
||||||
QPlatformGLContext::doneCurrent();
|
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandGLContext::swapBuffers()
|
void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
|
||||||
{
|
{
|
||||||
eglSwapBuffers(mEglDisplay,mSurface);
|
EGLSurface eglSurface = static_cast<QWaylandEglWindow *>(surface)->eglSurface();
|
||||||
|
eglSwapBuffers(m_eglDisplay, eglSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *QWaylandGLContext::getProcAddress(const QString &string)
|
void (*QWaylandGLContext::getProcAddress(const QByteArray &procName)) ()
|
||||||
{
|
{
|
||||||
return (void *) eglGetProcAddress(string.toLatin1().data());
|
return eglGetProcAddress(procName.constData());
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandGLContext::setEglSurface(EGLSurface surface)
|
|
||||||
{
|
|
||||||
doneCurrent();
|
|
||||||
mSurface = surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EGLConfig QWaylandGLContext::eglConfig() const
|
EGLConfig QWaylandGLContext::eglConfig() const
|
||||||
{
|
{
|
||||||
return mConfig;
|
return m_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,27 +53,27 @@ class QWaylandGLWindowSurface;
|
|||||||
|
|
||||||
class QWaylandGLContext : public QPlatformGLContext {
|
class QWaylandGLContext : public QPlatformGLContext {
|
||||||
public:
|
public:
|
||||||
QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format);
|
QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformGLContext *share);
|
||||||
~QWaylandGLContext();
|
~QWaylandGLContext();
|
||||||
void makeCurrent();
|
|
||||||
|
void swapBuffers(QPlatformSurface *surface);
|
||||||
|
|
||||||
|
bool makeCurrent(QPlatformSurface *surface);
|
||||||
void doneCurrent();
|
void doneCurrent();
|
||||||
void swapBuffers();
|
|
||||||
void* getProcAddress(const QString&);
|
|
||||||
|
|
||||||
QWindowFormat windowFormat() const { return mFormat; }
|
void (*getProcAddress(const QByteArray &procName)) ();
|
||||||
|
|
||||||
|
QSurfaceFormat format() const { return m_format; }
|
||||||
|
|
||||||
void setEglSurface(EGLSurface surface);
|
|
||||||
EGLConfig eglConfig() const;
|
EGLConfig eglConfig() const;
|
||||||
|
EGLContext eglContext() const { return m_context; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EGLDisplay mEglDisplay;
|
EGLDisplay m_eglDisplay;
|
||||||
|
|
||||||
EGLContext mContext;
|
|
||||||
EGLSurface mSurface;
|
|
||||||
EGLConfig mConfig;
|
|
||||||
QWindowFormat mFormat;
|
|
||||||
|
|
||||||
QWaylandGLContext();
|
|
||||||
|
|
||||||
|
EGLContext m_context;
|
||||||
|
EGLConfig m_config;
|
||||||
|
QSurfaceFormat m_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,21 @@ public:
|
|||||||
|
|
||||||
Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap)
|
Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap)
|
||||||
|
|
||||||
|
void *QXcbNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QGuiGLContext *context)
|
||||||
|
{
|
||||||
|
QByteArray lowerCaseResource = resourceString.toLower();
|
||||||
|
ResourceType resource = qXcbResourceMap()->value(lowerCaseResource);
|
||||||
|
void *result = 0;
|
||||||
|
switch(resource) {
|
||||||
|
case EglContext:
|
||||||
|
result = eglContextForContext(context);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
||||||
{
|
{
|
||||||
QByteArray lowerCaseResource = resourceString.toLower();
|
QByteArray lowerCaseResource = resourceString.toLower();
|
||||||
@ -94,9 +109,6 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
|
|||||||
case GraphicsDevice:
|
case GraphicsDevice:
|
||||||
result = graphicsDeviceForWindow(window);
|
result = graphicsDeviceForWindow(window);
|
||||||
break;
|
break;
|
||||||
case EglContext:
|
|
||||||
result = eglContextForWindow(window);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
@ -161,8 +173,13 @@ void *QXcbNativeInterface::graphicsDeviceForWindow(QWindow *window)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void * QXcbNativeInterface::eglContextForWindow(QWindow *window)
|
void * QXcbNativeInterface::eglContextForContext(QGuiGLContext *context)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(context);
|
||||||
|
#if defined(XCB_USE_EGL)
|
||||||
|
QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(context->handle());
|
||||||
|
return eglPlatformContext->eglContext();
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
Q_ASSERT(window);
|
Q_ASSERT(window);
|
||||||
QPlatformGLContext *platformContext = window->glContext()->handle();
|
QPlatformGLContext *platformContext = window->glContext()->handle();
|
||||||
|
@ -59,6 +59,7 @@ public:
|
|||||||
EglContext
|
EglContext
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void *nativeResourceForContext(const QByteArray &resourceString, QGuiGLContext *context);
|
||||||
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
|
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
|
||||||
|
|
||||||
void *displayForWindow(QWindow *window);
|
void *displayForWindow(QWindow *window);
|
||||||
@ -66,7 +67,8 @@ public:
|
|||||||
void *connectionForWindow(QWindow *window);
|
void *connectionForWindow(QWindow *window);
|
||||||
void *screenForWindow(QWindow *window);
|
void *screenForWindow(QWindow *window);
|
||||||
void *graphicsDeviceForWindow(QWindow *window);
|
void *graphicsDeviceForWindow(QWindow *window);
|
||||||
void *eglContextForWindow(QWindow *window);
|
|
||||||
|
void *eglContextForContext(QGuiGLContext *context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
|
static QXcbScreen *qPlatformScreenForWindow(QWindow *window);
|
||||||
|
@ -114,7 +114,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isComposing() const { return false; }
|
virtual bool isComposing() const { return false; }
|
||||||
|
|
||||||
private:
|
|
||||||
enum StandardFormat {
|
enum StandardFormat {
|
||||||
PreeditFormat,
|
PreeditFormat,
|
||||||
SelectionFormat
|
SelectionFormat
|
||||||
|
Loading…
x
Reference in New Issue
Block a user