From 6f6cfda8c459ab9c0a311e8643ef2534c5e194c2 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Wed, 7 May 2014 11:04:36 +0200 Subject: [PATCH] kms plugin: use first returned mode if no preferred one is present The list of returned modes is scanned for the first one marked as preferred, and that is used. If no preferred mode was found then the builtin default mode of 1024x768 is used. Use that builtin mode only if no modes were returned at all, pick the first one if any were returned. Change-Id: Ib355cc92219ced093c605f49dae4e34ff244b639 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/kms/qkmsscreen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/kms/qkmsscreen.cpp b/src/plugins/platforms/kms/qkmsscreen.cpp index 2749139330..a930aa6545 100644 --- a/src/plugins/platforms/kms/qkmsscreen.cpp +++ b/src/plugins/platforms/kms/qkmsscreen.cpp @@ -124,8 +124,12 @@ void QKmsScreen::initializeScreenMode(const drmModeRes *resources, const drmMode break; } } - if (!mode) - mode = &builtin_1024x768; + if (!mode) { + if (connector->count_modes > 0) + mode = &connector->modes[0]; + else + mode = &builtin_1024x768; + } drmModeEncoder *encoder = drmModeGetEncoder(m_device->fd(), connector->encoders[0]); if (encoder == 0)