diff options
author | Robin Burchell <robin.burchell@collabora.co.uk> | 2012-07-05 14:44:22 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-06 00:37:39 +0200 |
commit | 56e751a0c9892c1a334a10746e67958209be5b51 (patch) | |
tree | 97b1599ff60598b33609375ff52c668df5c573a8 | |
parent | 0823fa2c61b9105a9729fbeb3f5c411143e27760 (diff) |
eglfs: Allow setting screen size through environment variables.
This adds:
- QT_QPA_EGLFS_WIDTH
- QT_QPA_EGLFS_HEIGHT
If both are set, fb0 detection is completely bypassed, otherwise, the
environment variables act as an override for the fb0 values.
Change-Id: Iaf38c8b0d40ce0a921bb6c5dbf31af788802d3fa
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 25bf1fdfea..3c944e68b9 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -66,6 +66,16 @@ QSize QEglFSHooks::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/fb0", O_RDONLY); @@ -79,6 +89,12 @@ QSize QEglFSHooks::screenSize() const } else { qWarning("Failed to open /dev/fb0 to detect screen resolution."); } + + // override fb0 from environment var setting + if (width) + size.setWidth(width); + if (height) + size.setHeight(height); } return size; |