From b5e041d48d49ad684dcc8c922d47cbaa4e53574a Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 1 Jun 2012 12:18:45 -0700 Subject: eglfs refactor: Query screen and format info from hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows boards to customize what they really work best for without having to set environment variables. Change-Id: Ib40c3a870ade568f66e37e621a8abc6b17e39411 Reviewed-by: Samuel Rødal --- src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/plugins/platforms/eglfs/qeglfshooks_stub.cpp') diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index d0e3e4546d..fbc02d1a01 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -61,6 +61,39 @@ QSize QEglFSHooks::screenSize() const return QSize(); } +int QEglFSHooks::screenDepth() const +{ + static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); + return depth == 16 ? 16 : 32; +} + +QImage::Format QEglFSHooks::screenFormat() const +{ + return screenDepth() == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; +} + +QSurfaceFormat QEglFSHooks::defaultSurfaceFormat() const +{ + QSurfaceFormat format; + if (screenDepth() == 16) { + format.setDepthBufferSize(16); + format.setRedBufferSize(5); + format.setGreenBufferSize(6); + format.setBlueBufferSize(5); + } else { + format.setDepthBufferSize(24); + format.setStencilBufferSize(8); + format.setRedBufferSize(8); + format.setGreenBufferSize(8); + format.setBlueBufferSize(8); + } + + static int samples = qgetenv("QT_QPA_EGLFS_MULTISAMPLE").toInt(); + format.setSamples(samples); + + return format; +} + EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size) { Q_UNUSED(size); -- cgit v1.2.3