From 6bd03762d457ed7bea3cd4e856f629430c475553 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 30 Jan 2013 09:01:05 +0100 Subject: Refactor QEglFSPandaHooks and add physicalScreenSize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5a198af5347cc1fdce97031e0a1be99b2120c3ac Reviewed-by: Samuel Rødal --- .../android-g++/qeglfshooks_surfaceflinger.cpp | 65 +--------------------- 1 file changed, 1 insertion(+), 64 deletions(-) (limited to 'mkspecs/unsupported/android-g++') 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; -- cgit v1.2.3