summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp5
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h2
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp21
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp14
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.h1
5 files changed, 12 insertions, 31 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index 7e874bee0e..1a16b36696 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -50,15 +50,12 @@ QT_BEGIN_NAMESPACE
QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share,
EGLDisplay display, EGLenum eglApi)
- : QEGLPlatformContext(format, share, display, eglApi)
+ : QEGLPlatformContext(hooks->surfaceFormatFor(format), share, display, eglApi)
{
}
bool QEglFSContext::makeCurrent(QPlatformSurface *surface)
{
- // create the native window surface. this makes sure that
- // we create surfaces only for painted widgets (unlike QDesktopWidget)
- (static_cast<QEglFSWindow *>(surface))->create();
return QEGLPlatformContext::makeCurrent(surface);
}
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index baaa90aa91..3e40d16f38 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -61,7 +61,7 @@ public:
virtual QSize screenSize() const;
virtual int screenDepth() const;
virtual QImage::Format screenFormat() const;
- virtual QSurfaceFormat defaultSurfaceFormat() const;
+ virtual QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const;
virtual EGLNativeWindowType createNativeWindow(const QSize &size);
virtual void destroyNativeWindow(EGLNativeWindowType window);
virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index fbc02d1a01..fe622e1c1b 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -72,26 +72,9 @@ QImage::Format QEglFSHooks::screenFormat() const
return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32;
}
-QSurfaceFormat QEglFSHooks::defaultSurfaceFormat() const
+QSurfaceFormat QEglFSHooks::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
{
- QSurfaceFormat format;
- if (screenDepth() == 16) {
- format.setDepthBufferSize(16);
- format.setRedBufferSize(5);
- format.setGreenBufferSize(6);
- format.setBlueBufferSize(5);
- } else {
- format.setDepthBufferSize(24);
- format.setStencilBufferSize(8);
- format.setRedBufferSize(8);
- format.setGreenBufferSize(8);
- format.setBlueBufferSize(8);
- }
-
- static int samples = qgetenv("QT_QPA_EGLFS_MULTISAMPLE").toInt();
- format.setSamples(samples);
-
- return format;
+ return inputFormat;
}
EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 5e6d09a637..6cb9fc6edf 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -61,6 +61,8 @@ QEglFSWindow::QEglFSWindow(QWindow *w)
#endif
setWindowState(Qt::WindowFullScreen);
+
+ create();
}
QEglFSWindow::~QEglFSWindow()
@@ -70,19 +72,17 @@ QEglFSWindow::~QEglFSWindow()
void QEglFSWindow::create()
{
- if (m_window) {
- return;
- }
+ Q_ASSERT(!m_window);
EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
- QSurfaceFormat platformFormat = hooks->defaultSurfaceFormat();
+ QSurfaceFormat platformFormat = hooks->surfaceFormatFor(window()->requestedFormat());
EGLConfig config = q_configFromGLFormat(display, platformFormat);
+ m_format = q_glFormatFromConfig(display, config);
m_window = hooks->createNativeWindow(hooks->screenSize());
m_surface = eglCreateWindowSurface(display, config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
- qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError());
eglTerminate(display);
- qFatal("EGL error");
+ qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", eglGetError());
}
}
@@ -122,7 +122,7 @@ WId QEglFSWindow::winId() const
QSurfaceFormat QEglFSWindow::format() const
{
- return hooks->defaultSurfaceFormat();
+ return m_format;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.h b/src/plugins/platforms/eglfs/qeglfswindow.h
index f8c594b2a6..85866e492c 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.h
+++ b/src/plugins/platforms/eglfs/qeglfswindow.h
@@ -69,6 +69,7 @@ private:
WId m_winid;
EGLSurface m_surface;
EGLNativeWindowType m_window;
+ QSurfaceFormat m_format;
};
QT_END_NAMESPACE
#endif // QEGLFSWINDOW_H