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 <laszlo.agocs@digia.com>
This commit is contained in:
Rolf Eike Beer 2014-05-07 11:04:36 +02:00 committed by The Qt Project
parent 9c4996b709
commit 6f6cfda8c4

View File

@ -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)