summaryrefslogtreecommitdiffstats
path: root/mkspecs/devices/linux-arm-amlogic-8726M-g++
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish.1.ramakrishnan@nokia.com>2012-04-10 22:06:48 -0700
committerQt by Nokia <qt-info@nokia.com>2012-04-11 09:24:58 +0200
commite60ca0de6015a8ee16c7be54d0d430252ef525c1 (patch)
tree0ec0d9f8b5160806ccfda4255105d8f29e2d008f /mkspecs/devices/linux-arm-amlogic-8726M-g++
parent42f3bf772bab75d639b9211d66a0e085538526e2 (diff)
eglfs: rework hooks design
There are two problems with the current design: 1. if (hooks) hooks->foo() doesn't work in debug mode when no platform hook is defined. The problem doesn't arise in release mode because the compiler optimizes away the if (hooks) into a no-op since hooks is NULL when no platform hook is defined. 2. Adding a new hook requires changing every platform's hook implementation. New approach: 1. Define QEglFSHooks as a class with virtual functions. A stub file provides the default implementation. 2. Platform hooks derive from above class and reimplement whatever is needed. The filenames and variables have been changed to be more in line with the Qt style. Change-Id: I2eaaa5ad7c8b48a06361c4747d4f210c428c983f Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'mkspecs/devices/linux-arm-amlogic-8726M-g++')
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp (renamed from mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp)32
-rw-r--r--mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf2
2 files changed, 13 insertions, 21 deletions
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
index 40fb2a336b..6655c50573 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfs_hooks_8726m.cpp
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qeglfshooks_8726m.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <EGL/fbdev_window.h>
#include <stdio.h>
#include <sys/ioctl.h>
@@ -48,20 +48,15 @@
#include <fcntl.h>
#include <linux/fb.h>
-void QEglFSHooks::platformInit()
+class QEglFS8726MHooks : public QEglFSHooks
{
-}
+public:
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+};
-void QEglFSHooks::platformDestroy()
-{
-}
-
-EGLNativeDisplayType QEglFSHooks::platformDisplay() const
-{
- return EGL_DEFAULT_DISPLAY;
-}
-
-QSize QEglFSHooks::screenSize() const
+QSize QEglFS8726MHooks::screenSize() const
{
int fd = open("/dev/fb0", O_RDONLY);
if (fd == -1) {
@@ -78,7 +73,7 @@ QSize QEglFSHooks::screenSize() const
return QSize(vinfo.xres, vinfo.yres);
}
-EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+EGLNativeWindowType QEglFS8726MHooks::createNativeWindow(const QSize &size)
{
fbdev_window *window = new fbdev_window;
window->width = size.width();
@@ -87,14 +82,11 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
return window;
}
-void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFS8726MHooks::destroyNativeWindow(EGLNativeWindowType window)
{
delete window;
}
-bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
-{
- return false;
-}
+QEglFS8726MHooks eglFS8726MHooks;
+QEglFSHooks *platformHooks = &eglFS8726MHooks;
-QEglFSHooks platform_hooks;
diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
index b0b02f32e6..7525397a65 100644
--- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
+++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf
@@ -31,6 +31,6 @@ QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
deviceSanityCheckCompiler()
-EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfs_hooks_8726m.cpp
+EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_8726m.cpp
load(qt_config)