From 42f3bf772bab75d639b9211d66a0e085538526e2 Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Tue, 10 Apr 2012 17:20:31 +0000 Subject: Extend eglhooks to include hasCapability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add BufferQueueingOpenGL to Raspberry PI's numerous capabilities Change-Id: I1197c28a0c82df3ae2f6d5360791010e17373555 Reviewed-by: Girish Ramakrishnan Reviewed-by: Donald Carr Reviewed-by: Samuel Rødal --- .../linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp | 5 +++++ mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp | 13 +++++++++++++ src/plugins/platforms/eglfs/qeglfs_hooks.h | 8 ++++++++ src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp | 5 +++++ src/plugins/platforms/eglfs/qeglfsintegration.cpp | 4 ++++ src/plugins/platforms/eglfs/qeglfsscreen.cpp | 7 ------- 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp index 06cb424e4f..40fb2a336b 100644 --- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp +++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp @@ -92,4 +92,9 @@ void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window) delete window; } +bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const +{ + return false; +} + QEglFSHooks platform_hooks; diff --git a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp b/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp index 2cbd297a90..f17af55947 100644 --- a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp +++ b/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp @@ -140,4 +140,17 @@ void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window) delete eglWindow; } +bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case QPlatformIntegration::ThreadedPixmaps: + case QPlatformIntegration::OpenGL: + case QPlatformIntegration::ThreadedOpenGL: + case QPlatformIntegration::BufferQueueingOpenGL: + return true; + default: + return false; + } +} + QEglFSHooks platform_hooks; diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks.h b/src/plugins/platforms/eglfs/qeglfs_hooks.h index a30af9409f..628ef1f33b 100644 --- a/src/plugins/platforms/eglfs/qeglfs_hooks.h +++ b/src/plugins/platforms/eglfs/qeglfs_hooks.h @@ -54,8 +54,16 @@ struct QEglFSHooks { QSize screenSize() const; EGLNativeWindowType createNativeWindow(const QSize &size); void destroyNativeWindow(EGLNativeWindowType window); + bool hasCapability(QPlatformIntegration::Capability cap) const; }; +#ifdef EGLFS_PLATFORM_HOOKS +extern QEglFSHooks platform_hooks; +static QEglFSHooks *hooks = &platform_hooks; +#else +static QEglFSHooks *hooks = 0; +#endif + QT_END_NAMESPACE #endif diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp index baba3be492..594614e7a0 100644 --- a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp +++ b/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp @@ -88,3 +88,8 @@ void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window) XDestroyWindow(display, window); } +bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const +{ + return false; +} + diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index d9214f87fe..b1f5a69570 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -74,6 +74,10 @@ QEglFSIntegration::~QEglFSIntegration() bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { + // We assume that devices will have more and not less capabilities + if (hooks && hooks->hasCapability(cap)) + return true; + switch (cap) { case ThreadedPixmaps: return true; case OpenGL: return true; diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index c7e983b0fb..3c2f4c580d 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -53,13 +53,6 @@ QT_BEGIN_NAMESPACE -#ifdef EGLFS_PLATFORM_HOOKS -extern QEglFSHooks platform_hooks; -static QEglFSHooks *hooks = &platform_hooks; -#else -static QEglFSHooks *hooks = 0; -#endif - // #define QEGL_EXTRA_DEBUG #ifdef QEGL_EXTRA_DEBUG -- cgit v1.2.3