summaryrefslogtreecommitdiff
path: root/kmscube.c
diff options
context:
space:
mode:
authorGabriel Laskar <gabriel@lse.epita.fr>2014-11-04 15:12:07 +0100
committerRob Clark <robdclark@gmail.com>2014-11-04 17:10:13 -0500
commit4b9e31deeb184d028e95b26f5375e96ccdd17130 (patch)
treeb5322b8005aad3d8f948ca8a541b497903b2bc4a /kmscube.c
parentcdcfc7b4959542e7095e56353906d03f4be49a1c (diff)
downloadkmscube-4b9e31deeb184d028e95b26f5375e96ccdd17130.tar.gz
Prefer mode of type "DRM_MODE_TYPE_PREFERED"
On screen with native resolution of 1440x900, there is sometime a compatibility mode for 1280x1024, with shrinked output and vertical bands to maintain ratio. If we select the resolution with the higher area, we select the compatibility mode and not the native resolution. When using mode_type == DRM_MODE_TYPE_PREFERED, we avoid that issue. Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Diffstat (limited to 'kmscube.c')
-rw-r--r--kmscube.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kmscube.c b/kmscube.c
index 703c56e..6f551a8 100644
--- a/kmscube.c
+++ b/kmscube.c
@@ -121,9 +121,14 @@ static int init_drm(void)
return -1;
}
- /* find highest resolution mode: */
+ /* find prefered mode or the highest resolution mode: */
for (i = 0, area = 0; i < connector->count_modes; i++) {
drmModeModeInfo *current_mode = &connector->modes[i];
+
+ if (current_mode->type & DRM_MODE_TYPE_PREFERRED) {
+ drm.mode = current_mode;
+ }
+
int current_area = current_mode->hdisplay * current_mode->vdisplay;
if (current_area > area) {
drm.mode = current_mode;