summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranknight <andrew.knight@digia.com>2013-02-14 14:52:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-18 13:34:25 +0100
commitf8fdeb68b6e1a710438fc9084a2a3b1b9b6744fa (patch)
tree24c7a35e16281ce4bd60147d78e2d7a7e2b991a6
parent936aceb5f204e6f51b69de5555d7d8337677c9c3 (diff)
KMS QPA Plugin: use preferred mode when selecting mode
This should select the best mode (likely the currently running mode) for the display instead of the first one found. The built-in mode was left as a fallback. Change-Id: I4e1bc798df6f310b001566ab76cb9def3224a7ed Reviewed-by: Andy Nichols <andy.nichols@digia.com>
-rw-r--r--src/plugins/platforms/kms/qkmsscreen.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/kms/qkmsscreen.cpp b/src/plugins/platforms/kms/qkmsscreen.cpp
index 123dcc283f..892f7bb01f 100644
--- a/src/plugins/platforms/kms/qkmsscreen.cpp
+++ b/src/plugins/platforms/kms/qkmsscreen.cpp
@@ -124,10 +124,14 @@ void QKmsScreen::initializeScreenMode()
drmModeConnector *connector = drmModeGetConnector(m_device->fd(), m_connectorId);
drmModeModeInfo *mode = 0;
- if (connector->count_modes > 0)
- mode = &connector->modes[0];
- else
- mode = &builtin_1024x768;
+ for (int i = 0; i < connector->count_modes; ++i) {
+ if (connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) {
+ mode = &connector->modes[i];
+ break;
+ }
+ }
+ if (!mode)
+ mode = mode = &builtin_1024x768;
drmModeEncoder *encoder = drmModeGetEncoder(m_device->fd(), connector->encoders[0]);
if (encoder == 0)