Fix the egl path for xcb and wayland plugins
Reviewed-by: Samuel Rødal
This commit is contained in:
parent
9bd270f64d
commit
d0beb0d95b
@ -195,7 +195,7 @@ bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes)
|
||||
return false;
|
||||
}
|
||||
|
||||
EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat, int surfaceType)
|
||||
EGLConfig q_configFromQWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat, int surfaceType)
|
||||
{
|
||||
EGLConfig cfg = 0;
|
||||
QVector<EGLint> configureAttributes = q_createConfigAttributesFromFormat(format);
|
||||
|
@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QVector<EGLint> q_createConfigAttributesFromFormat(const QWindowFormat &format);
|
||||
bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes);
|
||||
EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
|
||||
EGLConfig q_configFromQWindowFormat(EGLDisplay display, const QWindowFormat &format, bool highestPixelFormat = false, int surfaceType = EGL_WINDOW_BIT);
|
||||
QWindowFormat q_windowFormatFromConfig(EGLDisplay display, const EGLConfig config);
|
||||
bool q_hasEglExtension(EGLDisplay display,const char* extensionName);
|
||||
|
||||
|
@ -43,12 +43,14 @@
|
||||
|
||||
#include "../../../eglconvenience/qeglconvenience.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QWindowContext>
|
||||
|
||||
#include <QtOpenGL/QGLContext>
|
||||
#include <QtOpenGL/private/qglextensions_p.h>
|
||||
|
||||
#include "qwaylandshmsurface.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
static inline void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
|
||||
{
|
||||
@ -77,7 +79,7 @@ QWaylandReadbackEglContext::QWaylandReadbackEglContext(QWaylandReadbackEglIntegr
|
||||
, mWindow(window)
|
||||
, mBuffer(0)
|
||||
, mPixmap(0)
|
||||
, mConfig(q_configFromQPlatformWindowFormat(eglIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_PIXMAP_BIT))
|
||||
, mConfig(q_configFromQWindowFormat(eglIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_PIXMAP_BIT))
|
||||
, mPixmapSurface(EGL_NO_SURFACE)
|
||||
{
|
||||
QVector<EGLint> eglContextAttrs;
|
||||
@ -112,7 +114,7 @@ void QWaylandReadbackEglContext::swapBuffers()
|
||||
{
|
||||
eglSwapBuffers(mEglIntegration->eglDisplay(),mPixmapSurface);
|
||||
|
||||
if (QWindowContext::currentContext().handle() != this) {
|
||||
if (QWindowContext::currentContext()->handle() != this) {
|
||||
makeCurrent();
|
||||
}
|
||||
|
||||
@ -141,7 +143,7 @@ void * QWaylandReadbackEglContext::getProcAddress(const QString &procName)
|
||||
return (void *) eglGetProcAddress(procName.toLatin1().data());
|
||||
}
|
||||
|
||||
QPlatformWindowFormat QWaylandReadbackEglContext::platformWindowFormat() const
|
||||
QWindowFormat QWaylandReadbackEglContext::windowFormat() const
|
||||
{
|
||||
return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
void swapBuffers();
|
||||
void* getProcAddress(const QString& procName);
|
||||
|
||||
virtual QPlatformWindowFormat platformWindowFormat() const;
|
||||
virtual QWindowFormat windowFormat() const;
|
||||
|
||||
void geometryChanged();
|
||||
|
||||
|
@ -83,7 +83,7 @@ void QWaylandReadbackEglIntegration::initialize()
|
||||
|
||||
QWaylandWindow * QWaylandReadbackEglIntegration::createEglWindow(QWindow *window)
|
||||
{
|
||||
return new QWaylandReadbackEglWindow(widget,this);
|
||||
return new QWaylandReadbackEglWindow(window,this);
|
||||
}
|
||||
|
||||
EGLDisplay QWaylandReadbackEglIntegration::eglDisplay()
|
||||
|
@ -48,6 +48,8 @@
|
||||
#include <QtCore/QDataStream>
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QCursor>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
|
@ -44,6 +44,8 @@
|
||||
#include "qwaylandscreen.h"
|
||||
#include "qwaylandglcontext.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
|
||||
: QWaylandWindow(window)
|
||||
, mGLContext(0)
|
||||
@ -83,7 +85,7 @@ QPlatformGLContext * QWaylandEglWindow::glContext() const
|
||||
{
|
||||
if (!mGLContext) {
|
||||
QWaylandEglWindow *that = const_cast<QWaylandEglWindow *>(this);
|
||||
that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),widget()->platformWindowFormat());
|
||||
that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),this->window()->requestedWindowFormat());
|
||||
|
||||
EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
|
||||
EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
|
||||
@ -98,7 +100,7 @@ void QWaylandEglWindow::newSurfaceCreated()
|
||||
if (mWaylandEglWindow) {
|
||||
wl_egl_window_destroy(mWaylandEglWindow);
|
||||
}
|
||||
wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual();
|
||||
wl_visual *visual = QWaylandScreen::waylandScreenFromWindow(window())->visual();
|
||||
QSize size = geometry().size();
|
||||
if (!size.isValid())
|
||||
size = QSize(0,0);
|
||||
|
@ -47,22 +47,17 @@
|
||||
#include "../../../eglconvenience/qeglconvenience.h"
|
||||
|
||||
#include <QtGui/QPlatformGLContext>
|
||||
#include <QtGui/QPlatformWindowFormat>
|
||||
#include <QtGui/QWindowFormat>
|
||||
#include <QtCore/QMutex>
|
||||
|
||||
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format)
|
||||
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format)
|
||||
: QPlatformGLContext()
|
||||
, mEglDisplay(eglDisplay)
|
||||
, mSurface(EGL_NO_SURFACE)
|
||||
, mConfig(q_configFromQPlatformWindowFormat(mEglDisplay,format,true))
|
||||
, mConfig(q_configFromQWindowFormat(mEglDisplay,format,true))
|
||||
, mFormat(q_windowFormatFromConfig(mEglDisplay,mConfig))
|
||||
{
|
||||
QPlatformGLContext *sharePlatformContext = 0;
|
||||
sharePlatformContext = format.sharedGLContext();
|
||||
mFormat.setSharedContext(sharePlatformContext);
|
||||
EGLContext shareEGLContext = EGL_NO_CONTEXT;
|
||||
if (sharePlatformContext)
|
||||
shareEGLContext = static_cast<const QWaylandGLContext*>(sharePlatformContext)->mContext;
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
|
@ -53,14 +53,14 @@ class QWaylandGLWindowSurface;
|
||||
|
||||
class QWaylandGLContext : public QPlatformGLContext {
|
||||
public:
|
||||
QWaylandGLContext(EGLDisplay eglDisplay, const QPlatformWindowFormat &format);
|
||||
QWaylandGLContext(EGLDisplay eglDisplay, const QWindowFormat &format);
|
||||
~QWaylandGLContext();
|
||||
void makeCurrent();
|
||||
void doneCurrent();
|
||||
void swapBuffers();
|
||||
void* getProcAddress(const QString&);
|
||||
|
||||
QPlatformWindowFormat platformWindowFormat() const { return mFormat; }
|
||||
QWindowFormat windowFormat() const { return mFormat; }
|
||||
|
||||
void setEglSurface(EGLSurface surface);
|
||||
EGLConfig eglConfig() const;
|
||||
@ -70,7 +70,7 @@ private:
|
||||
EGLContext mContext;
|
||||
EGLSurface mSurface;
|
||||
EGLConfig mConfig;
|
||||
QPlatformWindowFormat mFormat;
|
||||
QWindowFormat mFormat;
|
||||
|
||||
QWaylandGLContext();
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "wayland-xcomposite-client-protocol.h"
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QRegion>
|
||||
|
||||
#include "qeglconvenience.h"
|
||||
#include "qxlibeglintegration.h"
|
||||
@ -58,7 +59,7 @@ QWaylandXCompositeEGLContext::QWaylandXCompositeEGLContext(QWaylandXCompositeEGL
|
||||
, mWindow(window)
|
||||
, mBuffer(0)
|
||||
, mXWindow(0)
|
||||
, mConfig(q_configFromQPlatformWindowFormat(glxIntegration->eglDisplay(),window->widget()->platformWindowFormat(),true,EGL_WINDOW_BIT))
|
||||
, mConfig(q_configFromQWindowFormat(glxIntegration->eglDisplay(),window->window()->requestedWindowFormat(),true,EGL_WINDOW_BIT))
|
||||
, mWaitingForSync(false)
|
||||
{
|
||||
QVector<EGLint> eglContextAttrs;
|
||||
@ -98,7 +99,7 @@ void * QWaylandXCompositeEGLContext::getProcAddress(const QString &procName)
|
||||
return (void *)eglGetProcAddress(qPrintable(procName));
|
||||
}
|
||||
|
||||
QPlatformWindowFormat QWaylandXCompositeEGLContext::platformWindowFormat() const
|
||||
QWindowFormat QWaylandXCompositeEGLContext::windowFormat() const
|
||||
{
|
||||
return q_windowFormatFromConfig(mEglIntegration->eglDisplay(),mConfig);
|
||||
}
|
||||
|
@ -44,8 +44,6 @@
|
||||
|
||||
#include <QtGui/QPlatformGLContext>
|
||||
|
||||
#include <QtCore/QWaitCondition>
|
||||
|
||||
#include "qwaylandbuffer.h"
|
||||
#include "qwaylandxcompositeeglintegration.h"
|
||||
|
||||
@ -61,7 +59,7 @@ public:
|
||||
void swapBuffers();
|
||||
void* getProcAddress(const QString& procName);
|
||||
|
||||
QPlatformWindowFormat platformWindowFormat() const;
|
||||
QWindowFormat windowFormat() const;
|
||||
|
||||
void geometryChanged();
|
||||
|
||||
|
@ -150,7 +150,7 @@ void QXcbWindow::create()
|
||||
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window()->requestedWindowFormat());
|
||||
#elif defined(XCB_USE_EGL)
|
||||
EGLDisplay eglDisplay = connection()->egl_display();
|
||||
EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,window()->requestedWindowFormat(),true);
|
||||
EGLConfig eglConfig = q_configFromQWindowFormat(eglDisplay,window()->requestedWindowFormat(),true);
|
||||
VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this), eglDisplay, eglConfig);
|
||||
|
||||
XVisualInfo visualInfoTemplate;
|
||||
@ -890,7 +890,7 @@ QPlatformGLContext *QXcbWindow::glContext() const
|
||||
that->m_context = new QGLXContext(m_window, m_screen, window()->requestedWindowFormat());
|
||||
#elif defined(XCB_USE_EGL)
|
||||
EGLDisplay display = connection()->egl_display();
|
||||
EGLConfig config = q_configFromQPlatformWindowFormat(display,window()->requestedWindowFormat(),true);
|
||||
EGLConfig config = q_configFromQWindowFormat(display,window()->requestedWindowFormat(),true);
|
||||
QVector<EGLint> eglContextAttrs;
|
||||
eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
|
||||
eglContextAttrs.append(2);
|
||||
|
Loading…
Reference in New Issue
Block a user