diff options
Diffstat (limited to 'mkspecs/devices/linux-rasp-pi-g++')
-rw-r--r-- | mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp (renamed from mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp) | 42 | ||||
-rw-r--r-- | mkspecs/devices/linux-rasp-pi-g++/qmake.conf | 2 |
2 files changed, 35 insertions, 9 deletions
diff --git a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp index 2cbd297a90..21052a5b63 100644 --- a/mkspecs/devices/linux-rasp-pi-g++/qeglfs_hooks.cpp +++ b/mkspecs/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qeglfs_hooks.h" +#include "qeglfshooks.h" #include <bcm_host.h> @@ -55,23 +55,35 @@ static DISPMANX_DISPLAY_HANDLE_T dispman_display = 0; static DISPMANX_UPDATE_HANDLE_T dispman_update = 0; -void QEglFSHooks::platformInit() +class QEglFSPiHooks : public QEglFSHooks +{ +public: + virtual void platformInit(); + virtual void platformDestroy(); + virtual EGLNativeDisplayType platformDisplay() const; + virtual QSize screenSize() const; + virtual EGLNativeWindowType createNativeWindow(const QSize &size); + virtual void destroyNativeWindow(EGLNativeWindowType window); + virtual bool hasCapability(QPlatformIntegration::Capability cap) const; +}; + +void QEglFSPiHooks::platformInit() { bcm_host_init(); } -EGLNativeDisplayType QEglFSHooks::platformDisplay() const +EGLNativeDisplayType QEglFSPiHooks::platformDisplay() const { dispman_display = vc_dispmanx_display_open(0/* LCD */); return EGL_DEFAULT_DISPLAY; } -void QEglFSHooks::platformDestroy() +void QEglFSPiHooks::platformDestroy() { vc_dispmanx_display_close(dispman_display); } -QSize QEglFSHooks::screenSize() const +QSize QEglFSPiHooks::screenSize() const { //both mechanisms work #if 1 @@ -98,7 +110,7 @@ QSize QEglFSHooks::screenSize() const #endif } -EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size) +EGLNativeWindowType QEglFSPiHooks::createNativeWindow(const QSize &size) { VC_RECT_T dst_rect; dst_rect.x = 0; @@ -133,11 +145,25 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size) return eglWindow; } -void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window) +void QEglFSPiHooks::destroyNativeWindow(EGLNativeWindowType window) { EGL_DISPMANX_WINDOW_T *eglWindow = static_cast<EGL_DISPMANX_WINDOW_T *>(window); vc_dispmanx_element_remove(dispman_update, eglWindow->element); delete eglWindow; } -QEglFSHooks platform_hooks; +bool QEglFSPiHooks::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case QPlatformIntegration::ThreadedPixmaps: + case QPlatformIntegration::OpenGL: + case QPlatformIntegration::ThreadedOpenGL: + case QPlatformIntegration::BufferQueueingOpenGL: + return true; + default: + return false; + } +} + +QEglFSPiHooks eglFSPiHooks; +QEglFSHooks *platformHooks = &eglFSPiHooks; diff --git a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf index 326d6b3b61..4c75e0b0b2 100644 --- a/mkspecs/devices/linux-rasp-pi-g++/qmake.conf +++ b/mkspecs/devices/linux-rasp-pi-g++/qmake.conf @@ -48,7 +48,7 @@ QMAKE_CFLAGS_RELEASE += \ QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks.cpp +EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_pi.cpp # Sanity check deviceSanityCheckCompiler() |