Get the eglfs plugin compiling.
Change-Id: I5addb1a2593a670d559b9fbf9183f52af410895b Reviewed-on: http://codereview.qt.nokia.com/2176 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
parent
c7c8a38ec3
commit
e4042435ba
@ -180,6 +180,7 @@ bool QGuiGLContext::create()
|
|||||||
|
|
||||||
Q_D(QGuiGLContext);
|
Q_D(QGuiGLContext);
|
||||||
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformGLContext(this);
|
d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformGLContext(this);
|
||||||
|
d->platformGLContext->setContext(this);
|
||||||
return d->platformGLContext;
|
return d->platformGLContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,3 +79,31 @@
|
|||||||
|
|
||||||
Reimplement this function in a subclass to indicate what format the glContext actually has.
|
Reimplement this function in a subclass to indicate what format the glContext actually has.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct QPlatformGLContextPrivate
|
||||||
|
{
|
||||||
|
QGuiGLContext *context;
|
||||||
|
};
|
||||||
|
|
||||||
|
QPlatformGLContext::QPlatformGLContext()
|
||||||
|
: d_ptr(new QPlatformGLContextPrivate)
|
||||||
|
{
|
||||||
|
Q_D(QPlatformGLContext);
|
||||||
|
d->context = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlatformGLContext::~QPlatformGLContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QGuiGLContext *QPlatformGLContext::context() const
|
||||||
|
{
|
||||||
|
Q_D(const QPlatformGLContext);
|
||||||
|
return d->context;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QPlatformGLContext::setContext(QGuiGLContext *context)
|
||||||
|
{
|
||||||
|
Q_D(QPlatformGLContext);
|
||||||
|
d->context = context;
|
||||||
|
}
|
||||||
|
@ -67,10 +67,14 @@ private:
|
|||||||
friend class QPlatformWindow;
|
friend class QPlatformWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class QPlatformGLContextPrivate;
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPlatformGLContext
|
class Q_GUI_EXPORT QPlatformGLContext
|
||||||
{
|
{
|
||||||
|
Q_DECLARE_PRIVATE(QPlatformGLContext)
|
||||||
public:
|
public:
|
||||||
virtual ~QPlatformGLContext() {}
|
QPlatformGLContext();
|
||||||
|
virtual ~QPlatformGLContext();
|
||||||
|
|
||||||
virtual QSurfaceFormat format() const = 0;
|
virtual QSurfaceFormat format() const = 0;
|
||||||
|
|
||||||
@ -80,6 +84,17 @@ public:
|
|||||||
virtual void doneCurrent() = 0;
|
virtual void doneCurrent() = 0;
|
||||||
|
|
||||||
virtual void (*getProcAddress(const QByteArray &procName)) () = 0;
|
virtual void (*getProcAddress(const QByteArray &procName)) () = 0;
|
||||||
|
|
||||||
|
QGuiGLContext *context() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class QGuiGLContext;
|
||||||
|
|
||||||
|
QScopedPointer<QPlatformGLContextPrivate> d_ptr;
|
||||||
|
|
||||||
|
void setContext(QGuiGLContext *context);
|
||||||
|
|
||||||
|
Q_DISABLE_COPY(QPlatformGLContext)
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <QtGui/qwindowsysteminterface_qpa.h>
|
#include <QtGui/qwindowsysteminterface_qpa.h>
|
||||||
#include <QtGui/qwindow.h>
|
#include <QtGui/qwindow.h>
|
||||||
|
#include <QtGui/qscreen.h>
|
||||||
|
|
||||||
class QPlatformWindowPrivate
|
class QPlatformWindowPrivate
|
||||||
{
|
{
|
||||||
@ -88,6 +89,15 @@ QPlatformWindow *QPlatformWindow::parent() const
|
|||||||
return d->window->parent() ? d->window->parent()->handle() : 0;
|
return d->window->parent() ? d->window->parent()->handle() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the platform screen handle corresponding to this platform window.
|
||||||
|
*/
|
||||||
|
QPlatformScreen *QPlatformWindow::screen() const
|
||||||
|
{
|
||||||
|
Q_D(const QPlatformWindow);
|
||||||
|
return d->window->screen()->handle();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the actual surface format of the window.
|
Returns the actual surface format of the window.
|
||||||
*/
|
*/
|
||||||
|
@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
QT_MODULE(Gui)
|
QT_MODULE(Gui)
|
||||||
|
|
||||||
|
class QPlatformScreen;
|
||||||
class QPlatformWindowPrivate;
|
class QPlatformWindowPrivate;
|
||||||
class QWindow;
|
class QWindow;
|
||||||
|
|
||||||
@ -68,6 +69,8 @@ public:
|
|||||||
QWindow *window() const;
|
QWindow *window() const;
|
||||||
QPlatformWindow *parent() const;
|
QPlatformWindow *parent() const;
|
||||||
|
|
||||||
|
QPlatformScreen *screen() const;
|
||||||
|
|
||||||
virtual QSurfaceFormat format() const;
|
virtual QSurfaceFormat format() const;
|
||||||
|
|
||||||
virtual void setGeometry(const QRect &rect);
|
virtual void setGeometry(const QRect &rect);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
contains(QT_CONFIG,opengles2) {
|
contains(QT_CONFIG,opengles2) {
|
||||||
|
CONFIG += opengl
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/qeglconvenience_p.h \
|
$$PWD/qeglconvenience_p.h \
|
||||||
$$PWD/qeglplatformcontext_p.h
|
$$PWD/qeglplatformcontext_p.h
|
||||||
|
@ -2,7 +2,7 @@ TARGET = qeglfs
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
|
|
||||||
QT += opengl core-private gui-private opengl-private
|
QT += opengl core-private gui-private opengl-private platformsupport-private widgets-private
|
||||||
|
|
||||||
DESTDIR = $$QT.gui.plugins/platforms
|
DESTDIR = $$QT.gui.plugins/platforms
|
||||||
|
|
||||||
@ -12,17 +12,13 @@ DESTDIR = $$QT.gui.plugins/platforms
|
|||||||
|
|
||||||
SOURCES = main.cpp \
|
SOURCES = main.cpp \
|
||||||
qeglfsintegration.cpp \
|
qeglfsintegration.cpp \
|
||||||
../eglconvenience/qeglconvenience.cpp \
|
|
||||||
../eglconvenience/qeglplatformcontext.cpp \
|
|
||||||
qeglfswindow.cpp \
|
qeglfswindow.cpp \
|
||||||
qeglfswindowsurface.cpp \
|
qeglfsbackingstore.cpp \
|
||||||
qeglfsscreen.cpp
|
qeglfsscreen.cpp
|
||||||
|
|
||||||
HEADERS = qeglfsintegration.h \
|
HEADERS = qeglfsintegration.h \
|
||||||
../eglconvenience/qeglconvenience.h \
|
|
||||||
../eglconvenience/qeglplatformcontext.h \
|
|
||||||
qeglfswindow.h \
|
qeglfswindow.h \
|
||||||
qeglfswindowsurface.h \
|
qeglfsbackingstore.h \
|
||||||
qeglfsscreen.h
|
qeglfsscreen.h
|
||||||
|
|
||||||
load(qpa/fontdatabases/genericunix)
|
load(qpa/fontdatabases/genericunix)
|
||||||
|
@ -39,11 +39,13 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qeglfswindowsurface.h"
|
#include <QtOpenGL/private/qgl_p.h>
|
||||||
|
|
||||||
|
#include "qeglfsbackingstore.h"
|
||||||
|
|
||||||
#include <QtGui/QPlatformGLContext>
|
#include <QtGui/QPlatformGLContext>
|
||||||
|
#include <QtGui/QScreen>
|
||||||
|
|
||||||
#include <QtOpenGL/private/qgl_p.h>
|
|
||||||
#include <QtOpenGL/private/qglpaintdevice_p.h>
|
#include <QtOpenGL/private/qglpaintdevice_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -51,16 +53,16 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QEglFSPaintDevice : public QGLPaintDevice
|
class QEglFSPaintDevice : public QGLPaintDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QEglFSPaintDevice(QEglFSScreen *screen, QWidget *widget)
|
QEglFSPaintDevice(QEglFSScreen *screen)
|
||||||
:QGLPaintDevice(), m_screen(screen)
|
:QGLPaintDevice(), m_screen(screen)
|
||||||
{
|
{
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglPaintDevice %p, %p, %p",this, screen, widget);
|
qWarning("QEglPaintDevice %p, %p",this, screen);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize size() const { return m_screen->geometry().size(); }
|
QSize size() const { return m_screen->geometry().size(); }
|
||||||
QGLContext* context() const { return QGLContext::fromPlatformGLContext(m_screen->platformContext());}
|
QGLContext* context() const { return QGLContext::fromGuiGLContext(m_screen->platformContext()->context()); }
|
||||||
|
|
||||||
QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); }
|
QPaintEngine *paintEngine() const { return qt_qgl_paint_engine(); }
|
||||||
|
|
||||||
@ -73,29 +75,30 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
QEglFSWindowSurface::QEglFSWindowSurface( QEglFSScreen *screen, QWidget *window )
|
QEglFSBackingStore::QEglFSBackingStore(QWindow *window)
|
||||||
:QWindowSurface(window)
|
: QPlatformBackingStore(window)
|
||||||
{
|
{
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglWindowSurface %p, %p", window, screen);
|
qWarning("QEglBackingStore %p, %p", window, screen);
|
||||||
#endif
|
#endif
|
||||||
m_paintDevice = new QEglFSPaintDevice(screen,window);
|
m_paintDevice = new QEglFSPaintDevice(static_cast<QEglFSScreen *>(window->screen()->handle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QEglFSWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
|
void QEglFSBackingStore::flush(QWindow *widget, const QRegion ®ion, const QPoint &offset)
|
||||||
{
|
{
|
||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
Q_UNUSED(region);
|
Q_UNUSED(region);
|
||||||
Q_UNUSED(offset);
|
Q_UNUSED(offset);
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglWindowSurface::flush %p",widget);
|
qWarning("QEglBackingStore::flush %p",widget);
|
||||||
#endif
|
#endif
|
||||||
widget->platformWindow()->glContext()->swapBuffers();
|
static_cast<QEglFSPaintDevice *>(m_paintDevice)->context()->swapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QEglFSWindowSurface::resize(const QSize &size)
|
void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents)
|
||||||
{
|
{
|
||||||
Q_UNUSED(size);
|
Q_UNUSED(size);
|
||||||
|
Q_UNUSED(staticContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
@ -45,19 +45,20 @@
|
|||||||
#include "qeglfsintegration.h"
|
#include "qeglfsintegration.h"
|
||||||
#include "qeglfswindow.h"
|
#include "qeglfswindow.h"
|
||||||
|
|
||||||
#include <QtGui/private/qwindowsurface_p.h>
|
#include <QtGui/qplatformbackingstore_qpa.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QEglFSWindowSurface : public QWindowSurface
|
class QEglFSBackingStore : public QPlatformBackingStore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QEglFSWindowSurface(QEglFSScreen *screen, QWidget *window);
|
QEglFSBackingStore(QWindow *window);
|
||||||
~QEglFSWindowSurface() {}
|
~QEglFSBackingStore() {}
|
||||||
|
|
||||||
QPaintDevice *paintDevice() { return m_paintDevice; }
|
QPaintDevice *paintDevice() { return m_paintDevice; }
|
||||||
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset);
|
void flush(QWindow *window, const QRegion ®ion, const QPoint &offset);
|
||||||
void resize(const QSize &size);
|
void resize(const QSize &size, const QRegion &staticContents);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPaintDevice *m_paintDevice;
|
QPaintDevice *m_paintDevice;
|
||||||
};
|
};
|
@ -42,13 +42,15 @@
|
|||||||
#include "qeglfsintegration.h"
|
#include "qeglfsintegration.h"
|
||||||
|
|
||||||
#include "qeglfswindow.h"
|
#include "qeglfswindow.h"
|
||||||
#include "qeglfswindowsurface.h"
|
#include "qeglfsbackingstore.h"
|
||||||
|
|
||||||
#include "qgenericunixfontdatabase.h"
|
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
|
||||||
|
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
|
||||||
|
|
||||||
#include <QtGui/QPlatformWindow>
|
#include <QtGui/QPlatformWindow>
|
||||||
#include <QtGui/QPlatformWindowFormat>
|
#include <QtGui/QSurfaceFormat>
|
||||||
#include <QtGui/private/qpixmap_raster_p.h>
|
#include <QtGui/QGuiGLContext>
|
||||||
|
#include <QtGui/QScreen>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
|
|
||||||
@ -57,9 +59,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
QEglFSIntegration::QEglFSIntegration()
|
QEglFSIntegration::QEglFSIntegration()
|
||||||
: mFontDb(new QGenericUnixFontDatabase())
|
: mFontDb(new QGenericUnixFontDatabase())
|
||||||
{
|
{
|
||||||
m_primaryScreen = new QEglFSScreen(EGL_DEFAULT_DISPLAY);
|
screenAdded(new QEglFSScreen(EGL_DEFAULT_DISPLAY));
|
||||||
|
|
||||||
mScreens.append(m_primaryScreen);
|
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglIntegration\n");
|
qWarning("QEglIntegration\n");
|
||||||
#endif
|
#endif
|
||||||
@ -73,32 +74,26 @@ bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformPixmap *QEglFSIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
|
QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const
|
||||||
{
|
{
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglIntegration::createPlatformPixmap %d\n", type);
|
qWarning("QEglIntegration::createPlatformWindow %p\n",window);
|
||||||
#endif
|
#endif
|
||||||
return new QRasterPlatformPixmap(type);
|
return new QEglFSWindow(window);
|
||||||
}
|
|
||||||
|
|
||||||
QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(winId);
|
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
|
||||||
qWarning("QEglIntegration::createPlatformWindow %p\n",widget);
|
|
||||||
#endif
|
|
||||||
return new QEglFSWindow(widget, m_primaryScreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QWindowSurface *QEglFSIntegration::createWindowSurface(QWidget *widget, WId winId) const
|
QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *window) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(winId);
|
|
||||||
|
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
#ifdef QEGL_EXTRA_DEBUG
|
||||||
qWarning("QEglIntegration::createWindowSurface %p\n",widget);
|
qWarning("QEglIntegration::createWindowSurface %p\n",widget);
|
||||||
#endif
|
#endif
|
||||||
return new QEglFSWindowSurface(m_primaryScreen,widget);
|
return new QEglFSBackingStore(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPlatformGLContext *QEglFSIntegration::createPlatformGLContext(QGuiGLContext *context) const
|
||||||
|
{
|
||||||
|
return static_cast<QEglFSScreen *>(context->screen()->handle())->platformContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
|
QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
|
||||||
@ -106,4 +101,9 @@ QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
|
|||||||
return mFontDb;
|
return mFontDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAbstractEventDispatcher *QEglFSIntegration::createEventDispatcher() const
|
||||||
|
{
|
||||||
|
return createUnixEventDispatcher();
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -57,18 +57,17 @@ public:
|
|||||||
QEglFSIntegration();
|
QEglFSIntegration();
|
||||||
|
|
||||||
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||||
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
|
|
||||||
QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const;
|
|
||||||
QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const;
|
|
||||||
|
|
||||||
QList<QPlatformScreen *> screens() const { return mScreens; }
|
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||||
|
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||||
|
QPlatformGLContext *createPlatformGLContext(QGuiGLContext *context) const;
|
||||||
|
|
||||||
QPlatformFontDatabase *fontDatabase() const;
|
QPlatformFontDatabase *fontDatabase() const;
|
||||||
|
|
||||||
|
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPlatformFontDatabase *mFontDb;
|
QPlatformFontDatabase *mFontDb;
|
||||||
QList<QPlatformScreen *> mScreens;
|
|
||||||
QEglFSScreen *m_primaryScreen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -40,9 +40,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qeglfsscreen.h"
|
#include "qeglfsscreen.h"
|
||||||
|
#include "qeglfswindow.h"
|
||||||
|
|
||||||
#include "../eglconvenience/qeglconvenience.h"
|
#include <QtPlatformSupport/private/qeglconvenience_p.h>
|
||||||
#include "../eglconvenience/qeglplatformcontext.h"
|
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>
|
||||||
|
|
||||||
#ifdef Q_OPENKODE
|
#ifdef Q_OPENKODE
|
||||||
#include <KD/kd.h>
|
#include <KD/kd.h>
|
||||||
@ -86,6 +87,23 @@ static struct AttrInfo attrs[] = {
|
|||||||
{-1, 0}};
|
{-1, 0}};
|
||||||
#endif //QEGL_EXTRA_DEBUG
|
#endif //QEGL_EXTRA_DEBUG
|
||||||
|
|
||||||
|
class QEglFSContext : public QEGLPlatformContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QEglFSContext(const QSurfaceFormat &format, QPlatformGLContext *share, EGLDisplay display,
|
||||||
|
EGLint eglClientVersion = 2, EGLenum eglApi = EGL_OPENGL_ES_API)
|
||||||
|
: QEGLPlatformContext(format, share, display, eglClientVersion, eglApi)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface)
|
||||||
|
{
|
||||||
|
QEglFSWindow *window = static_cast<QEglFSWindow *>(surface);
|
||||||
|
QEglFSScreen *screen = static_cast<QEglFSScreen *>(window->screen());
|
||||||
|
return screen->surface();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
|
QEglFSScreen::QEglFSScreen(EGLNativeDisplayType display)
|
||||||
: m_depth(32)
|
: m_depth(32)
|
||||||
, m_format(QImage::Format_Invalid)
|
, m_format(QImage::Format_Invalid)
|
||||||
@ -136,32 +154,29 @@ void QEglFSScreen::createAndSetPlatformContext() const {
|
|||||||
|
|
||||||
void QEglFSScreen::createAndSetPlatformContext()
|
void QEglFSScreen::createAndSetPlatformContext()
|
||||||
{
|
{
|
||||||
QPlatformWindowFormat platformFormat = QPlatformWindowFormat::defaultFormat();
|
QSurfaceFormat platformFormat;
|
||||||
|
|
||||||
platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
|
|
||||||
|
|
||||||
QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH");
|
QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH");
|
||||||
if (depthString.toInt() == 16) {
|
if (depthString.toInt() == 16) {
|
||||||
platformFormat.setDepth(16);
|
platformFormat.setDepthBufferSize(16);
|
||||||
platformFormat.setRedBufferSize(5);
|
platformFormat.setRedBufferSize(5);
|
||||||
platformFormat.setGreenBufferSize(6);
|
platformFormat.setGreenBufferSize(6);
|
||||||
platformFormat.setBlueBufferSize(5);
|
platformFormat.setBlueBufferSize(5);
|
||||||
m_depth = 16;
|
m_depth = 16;
|
||||||
m_format = QImage::Format_RGB16;
|
m_format = QImage::Format_RGB16;
|
||||||
} else {
|
} else {
|
||||||
platformFormat.setDepth(32);
|
platformFormat.setDepthBufferSize(32);
|
||||||
platformFormat.setRedBufferSize(8);
|
platformFormat.setRedBufferSize(8);
|
||||||
platformFormat.setGreenBufferSize(8);
|
platformFormat.setGreenBufferSize(8);
|
||||||
platformFormat.setBlueBufferSize(8);
|
platformFormat.setBlueBufferSize(8);
|
||||||
m_depth = 32;
|
m_depth = 32;
|
||||||
m_format = QImage::Format_RGB32;
|
m_format = QImage::Format_RGB32;
|
||||||
}
|
}
|
||||||
if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty()) {
|
|
||||||
platformFormat.setSampleBuffers(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!qgetenv("QT_QPA_EGLFS_MULTISAMPLE").isEmpty())
|
||||||
|
platformFormat.setSamples(4);
|
||||||
|
|
||||||
EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat);
|
EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat);
|
||||||
|
|
||||||
EGLNativeWindowType eglWindow = 0;
|
EGLNativeWindowType eglWindow = 0;
|
||||||
#ifdef Q_OPENKODE
|
#ifdef Q_OPENKODE
|
||||||
@ -193,16 +208,7 @@ void QEglFSScreen::createAndSetPlatformContext()
|
|||||||
qWarning("\n");
|
qWarning("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EGLint temp;
|
QEGLPlatformContext *platformContext = new QEglFSContext(platformFormat, 0, m_dpy);
|
||||||
EGLint attribList[32];
|
|
||||||
|
|
||||||
temp = 0;
|
|
||||||
|
|
||||||
attribList[temp++] = EGL_CONTEXT_CLIENT_VERSION;
|
|
||||||
attribList[temp++] = 2; // GLES version 2
|
|
||||||
attribList[temp++] = EGL_NONE;
|
|
||||||
|
|
||||||
QEGLPlatformContext *platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API);
|
|
||||||
m_platformContext = platformContext;
|
m_platformContext = platformContext;
|
||||||
|
|
||||||
EGLint w,h; // screen size detection
|
EGLint w,h; // screen size detection
|
||||||
|
@ -64,6 +64,8 @@ public:
|
|||||||
|
|
||||||
QPlatformGLContext *platformContext() const;
|
QPlatformGLContext *platformContext() const;
|
||||||
|
|
||||||
|
EGLSurface surface() const { return m_surface; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createAndSetPlatformContext() const;
|
void createAndSetPlatformContext() const;
|
||||||
void createAndSetPlatformContext();
|
void createAndSetPlatformContext();
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QEglFSWindow::QEglFSWindow(QWidget *w, QEglFSScreen *screen)
|
QEglFSWindow::QEglFSWindow(QWindow *w)
|
||||||
: QPlatformWindow(w), m_screen(screen)
|
: QPlatformWindow(w)
|
||||||
{
|
{
|
||||||
static int serialNo = 0;
|
static int serialNo = 0;
|
||||||
m_winid = ++serialNo;
|
m_winid = ++serialNo;
|
||||||
@ -55,15 +55,11 @@ QEglFSWindow::QEglFSWindow(QWidget *w, QEglFSScreen *screen)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QEglFSWindow::setGeometry(const QRect &)
|
void QEglFSWindow::setGeometry(const QRect &)
|
||||||
{
|
{
|
||||||
// We only support full-screen windows
|
// We only support full-screen windows
|
||||||
QRect rect(m_screen->availableGeometry());
|
QRect rect(screen()->availableGeometry());
|
||||||
QWindowSystemInterface::handleGeometryChange(this->widget(), rect);
|
QWindowSystemInterface::handleGeometryChange(window(), rect);
|
||||||
|
|
||||||
// Since toplevels are fullscreen, propegate the screen size back to the widget
|
|
||||||
widget()->setGeometry(rect);
|
|
||||||
|
|
||||||
QPlatformWindow::setGeometry(rect);
|
QPlatformWindow::setGeometry(rect);
|
||||||
}
|
}
|
||||||
@ -73,15 +69,4 @@ WId QEglFSWindow::winId() const
|
|||||||
return m_winid;
|
return m_winid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QPlatformGLContext *QEglFSWindow::glContext() const
|
|
||||||
{
|
|
||||||
#ifdef QEGL_EXTRA_DEBUG
|
|
||||||
qWarning("QEglWindow::glContext %p\n", m_screen->platformContext());
|
|
||||||
#endif
|
|
||||||
Q_ASSERT(m_screen);
|
|
||||||
return m_screen->platformContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -53,15 +53,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QEglFSWindow : public QPlatformWindow
|
class QEglFSWindow : public QPlatformWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QEglFSWindow(QWidget *w, QEglFSScreen *screen);
|
QEglFSWindow(QWindow *w);
|
||||||
|
|
||||||
void setGeometry(const QRect &);
|
void setGeometry(const QRect &);
|
||||||
WId winId() const;
|
WId winId() const;
|
||||||
|
|
||||||
QPlatformGLContext *glContext() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QEglFSScreen *m_screen;
|
|
||||||
WId m_winid;
|
WId m_winid;
|
||||||
};
|
};
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user