summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r--src/plugins/platforms/eglfs/qeglfscontext.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h13
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp14
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp10
-rw-r--r--src/plugins/platforms/eglfs/qeglfswindow.cpp8
6 files changed, 25 insertions, 24 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp
index 44bc9b2344..6bd0d35191 100644
--- a/src/plugins/platforms/eglfs/qeglfscontext.cpp
+++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp
@@ -79,7 +79,7 @@ void QEglFSContext::swapBuffers(QPlatformSurface *surface)
cursor->paintOnScreen();
}
- hooks->waitForVSync();
+ QEglFSHooks::hooks()->waitForVSync();
QEGLPlatformContext::swapBuffers(surface);
}
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index fc1ee16073..c4ac7185fb 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -72,15 +72,18 @@ public:
virtual void waitForVSync() const;
virtual const char *fbDeviceName() const;
-};
+ static QEglFSHooks *hooks()
+ {
#ifdef EGLFS_PLATFORM_HOOKS
-extern QEglFSHooks *platformHooks;
-static QEglFSHooks *hooks = platformHooks;
+ extern QEglFSHooks *platformHooks;
+ return platformHooks;
#else
-extern QEglFSHooks stubHooks;
-static QEglFSHooks *hooks = &stubHooks;
+ extern QEglFSHooks stubHooks;
+ return &stubHooks;
#endif
+ }
+};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index 6c036cd680..5298eb47ea 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -62,8 +62,6 @@ const char *QEglFSHooks::fbDeviceName() const
void QEglFSHooks::platformInit()
{
- Q_UNUSED(hooks);
-
framebuffer = qt_safe_open(fbDeviceName(), O_RDONLY);
if (framebuffer == -1)
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index dd212c80a0..0fc4c44629 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -83,7 +83,7 @@ QEglFSIntegration::QEglFSIntegration()
new QEvdevTouchScreenHandlerThread(QString() /* spec */, this);
#endif
- hooks->platformInit();
+ QEglFSHooks::hooks()->platformInit();
EGLint major, minor;
@@ -92,7 +92,7 @@ QEglFSIntegration::QEglFSIntegration()
qFatal("EGL error");
}
- mDisplay = eglGetDisplay(hooks ? hooks->platformDisplay() : EGL_DEFAULT_DISPLAY);
+ mDisplay = eglGetDisplay(QEglFSHooks::hooks() ? QEglFSHooks::hooks()->platformDisplay() : EGL_DEFAULT_DISPLAY);
if (mDisplay == EGL_NO_DISPLAY) {
qWarning("Could not open egl display\n");
qFatal("EGL error");
@@ -122,13 +122,13 @@ QEglFSIntegration::~QEglFSIntegration()
delete mScreen;
eglTerminate(mDisplay);
- hooks->platformDestroy();
+ QEglFSHooks::hooks()->platformDestroy();
}
bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const
{
// We assume that devices will have more and not less capabilities
- if (hooks && hooks->hasCapability(cap))
+ if (QEglFSHooks::hooks() && QEglFSHooks::hooks()->hasCapability(cap))
return true;
switch (cap) {
@@ -153,13 +153,13 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi
QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
- return new QEglFSContext(hooks->surfaceFormatFor(context->format()), context->shareHandle(), mDisplay);
+ return new QEglFSContext(QEglFSHooks::hooks()->surfaceFormatFor(context->format()), context->shareHandle(), mDisplay);
}
QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
{
QEglFSScreen *screen = static_cast<QEglFSScreen *>(surface->screen()->handle());
- return new QEGLPbuffer(screen->display(), hooks->surfaceFormatFor(surface->requestedFormat()), surface);
+ return new QEGLPbuffer(screen->display(), QEglFSHooks::hooks()->surfaceFormatFor(surface->requestedFormat()), surface);
}
QPlatformFontDatabase *QEglFSIntegration::fontDatabase() const
@@ -230,7 +230,7 @@ EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceForm
QEglFSHooks *m_hooks;
};
- Chooser chooser(display, hooks);
+ Chooser chooser(display, QEglFSHooks::hooks());
chooser.setSurfaceFormat(format);
return chooser.chooseConfig();
}
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 43d7cb3b1f..83f50dd382 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -56,7 +56,7 @@ QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
static int hideCursor = qgetenv("QT_QPA_EGLFS_HIDECURSOR").toInt();
if (!hideCursor) {
- if (QEglFSCursor *customCursor = hooks->createCursor(this))
+ if (QEglFSCursor *customCursor = QEglFSHooks::hooks()->createCursor(this))
m_cursor = customCursor;
else
m_cursor = new QEglFSCursor(this);
@@ -70,22 +70,22 @@ QEglFSScreen::~QEglFSScreen()
QRect QEglFSScreen::geometry() const
{
- return QRect(QPoint(0, 0), hooks->screenSize());
+ return QRect(QPoint(0, 0), QEglFSHooks::hooks()->screenSize());
}
int QEglFSScreen::depth() const
{
- return hooks->screenDepth();
+ return QEglFSHooks::hooks()->screenDepth();
}
QImage::Format QEglFSScreen::format() const
{
- return hooks->screenFormat();
+ return QEglFSHooks::hooks()->screenFormat();
}
QSizeF QEglFSScreen::physicalSize() const
{
- return hooks->physicalScreenSize();
+ return QEglFSHooks::hooks()->physicalScreenSize();
}
QPlatformCursor *QEglFSScreen::cursor() const
diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp
index 26f701d7ba..4a0e2a9a7d 100644
--- a/src/plugins/platforms/eglfs/qeglfswindow.cpp
+++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp
@@ -76,18 +76,18 @@ void QEglFSWindow::create()
return;
if (window()->type() == Qt::Desktop) {
- QRect rect(QPoint(), hooks->screenSize());
+ QRect rect(QPoint(), QEglFSHooks::hooks()->screenSize());
QPlatformWindow::setGeometry(rect);
QWindowSystemInterface::handleGeometryChange(window(), rect);
return;
}
EGLDisplay display = (static_cast<QEglFSScreen *>(window()->screen()->handle()))->display();
- QSurfaceFormat platformFormat = hooks->surfaceFormatFor(window()->requestedFormat());
+ QSurfaceFormat platformFormat = QEglFSHooks::hooks()->surfaceFormatFor(window()->requestedFormat());
EGLConfig config = QEglFSIntegration::chooseConfig(display, platformFormat);
m_format = q_glFormatFromConfig(display, config);
- m_window = hooks->createNativeWindow(hooks->screenSize(), m_format);
+ m_window = QEglFSHooks::hooks()->createNativeWindow(QEglFSHooks::hooks()->screenSize(), m_format);
m_surface = eglCreateWindowSurface(display, config, m_window, NULL);
if (m_surface == EGL_NO_SURFACE) {
EGLint error = eglGetError();
@@ -105,7 +105,7 @@ void QEglFSWindow::destroy()
}
if (m_window) {
- hooks->destroyNativeWindow(m_window);
+ QEglFSHooks::hooks()->destroyNativeWindow(m_window);
m_window = 0;
}
}