summaryrefslogtreecommitdiff
path: root/tests/kms_setmode.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2019-04-25 10:41:02 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2019-06-03 17:53:58 +0200
commit6cfbf0365f39d68fcaabcd0498ffec28d1528d8f (patch)
tree195826d84084113efa6bd7cfd14decf9804531b1 /tests/kms_setmode.c
parent5aeacd5cc3fc37ff9e5dccb9e8ae63acdc12e521 (diff)
tests/kms_setmode: Handle eDP with fixed mode better.
When running the stealing tests, we set the same mode on the eDP and the other connector. If the eDP is 4k, we may try to set a mode that is not supported on the other connector, which might be 1080p. Fix this by selecting the smallest default mode, based on clock. Hopefully this is more likely to be supported on all connectors, instead always using the first connector's mode. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110391 [mlankhorst: Kill off 1 extra copy of mode (vsyrjala)] Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_setmode.c')
-rw-r--r--tests/kms_setmode.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 68b89b43..8ace587e 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -186,7 +186,7 @@ static void create_fb_for_crtc(struct crtc_config *crtc,
static void get_mode_for_crtc(struct crtc_config *crtc,
drmModeModeInfo *mode_ret)
{
- drmModeModeInfo mode;
+ drmModeModeInfo *mode;
int i;
/*
@@ -194,8 +194,8 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
* connectors.
*/
for (i = 0; i < crtc->connector_count; i++) {
- mode = crtc->cconfs[i].default_mode;
- if (crtc_supports_mode(crtc, &mode))
+ mode = &crtc->cconfs[i].default_mode;
+ if (crtc_supports_mode(crtc, mode))
goto found;
}
@@ -204,19 +204,22 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
* connectors.
*/
for (i = 0; i < crtc->cconfs[0].connector->count_modes; i++) {
- mode = crtc->cconfs[0].connector->modes[i];
- if (crtc_supports_mode(crtc, &mode))
+ mode = &crtc->cconfs[0].connector->modes[i];
+ if (crtc_supports_mode(crtc, mode))
goto found;
}
/*
- * If none is found then just pick the default mode of the first
- * connector and hope the other connectors can support it by scaling
- * etc.
+ * If none is found then just pick the default mode from all connectors
+ * with the smallest clock, hope the other connectors can support it by
+ * scaling etc.
*/
- mode = crtc->cconfs[0].default_mode;
+ mode = &crtc->cconfs[0].default_mode;
+ for (i = 1; i < crtc->connector_count; i++)
+ if (crtc->cconfs[i].default_mode.clock < mode->clock)
+ mode = &crtc->cconfs[i].default_mode;
found:
- *mode_ret = mode;
+ *mode_ret = *mode;
}
static int get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)