diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-01-30 09:01:05 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-30 13:00:02 +0100 |
commit | 6bd03762d457ed7bea3cd4e856f629430c475553 (patch) | |
tree | 87ad84e959d1bc9052c06ec4ce5f571ef715673c /mkspecs/unsupported/android-g++ | |
parent | 07843b1b120f04487adb192bd377dcc874f06bbb (diff) |
Refactor QEglFSPandaHooks and add physicalScreenSize()
Change-Id: I5a198af5347cc1fdce97031e0a1be99b2120c3ac
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'mkspecs/unsupported/android-g++')
-rw-r--r-- | mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp index 689300dbde..78a1eb183e 100644 --- a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp +++ b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp @@ -63,9 +63,8 @@ class QEglFSPandaHooks : public QEglFSHooks public: QEglFSPandaHooks(); virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); - virtual QSize screenSize() const; - virtual int screenDepth() const; virtual bool filterConfig(EGLDisplay display, EGLConfig config) const; + virtual const char *fbDeviceName() const { return "/dev/graphics/fb0"; } private: EGLNativeWindowType createNativeWindowSurfaceFlinger(const QSize &size, const QSurfaceFormat &format); @@ -152,68 +151,6 @@ bool QEglFSPandaHooks::filterConfig(EGLDisplay display, EGLConfig config) const return nativeVisualId == mFramebufferVisualId; } -QSize QEglFSPandaHooks::screenSize() const -{ - static QSize size; - - if (size.isEmpty()) { - int width = qgetenv("QT_QPA_EGLFS_WIDTH").toInt(); - int height = qgetenv("QT_QPA_EGLFS_HEIGHT").toInt(); - - if (width && height) { - // no need to read fb0 - size.setWidth(width); - size.setHeight(height); - return size; - } - - struct fb_var_screeninfo vinfo; - int fd = open("/dev/graphics/fb0", O_RDONLY); - - if (fd != -1) { - if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) - qWarning("Could not query variable screen info."); - else - size = QSize(vinfo.xres, vinfo.yres); - - close(fd); - } else { - qWarning("Failed to open /dev/graphics/fb0 to detect screen resolution."); - } - - // override fb0 from environment var setting - if (width) - size.setWidth(width); - if (height) - size.setHeight(height); - } - - return size; -} - -int QEglFSPandaHooks::screenDepth() const -{ - static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); - - if (depth == 0) { - struct fb_var_screeninfo vinfo; - int fd = open("/dev/graphics/fb0", O_RDONLY); - - if (fd != -1) { - if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) - qWarning("Could not query variable screen info."); - else - depth = vinfo.bits_per_pixel; - - close(fd); - } else { - qWarning("Failed to open /dev/graphics/fb0 to detect screen depth."); - } - } - - return depth == 0 ? 32 : depth; -} - static QEglFSPandaHooks eglFSPandaHooks; QEglFSHooks *platformHooks = &eglFSPandaHooks; |