summaryrefslogtreecommitdiff
path: root/tests/kms_setmode.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2016-02-23 16:23:26 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2016-03-07 09:47:44 +0100
commitb33a78b9b1bb5e0f718dfaf44497b07bd468372f (patch)
treef38e94b2edba6104be97d3487e14b8f9522fc780 /tests/kms_setmode.c
parent364d3785bfa240a56c350970d4523c5e59390184 (diff)
tests/kms_setmode: Add tests when not stealing encoders on same crtc.
Excercise connector stealing harder. There is a border case in atomic currently where encoder stealing is not prevented on the same crtc when the encoder is not reassigned. The following testcase excercises that path and causes a OOPS on my system with nightly. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/kms_setmode.c')
-rw-r--r--tests/kms_setmode.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 531ce839..6afe00c1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -70,6 +70,7 @@ enum test_flags {
TEST_CLONE = 0x02,
TEST_SINGLE_CRTC_CLONE = 0x04,
TEST_EXCLUSIVE_CRTC_CLONE = 0x08,
+ TEST_STEALING = 0x10,
};
struct test_config {
@@ -380,6 +381,34 @@ static uint32_t *get_connector_ids(struct crtc_config *crtc)
return ids;
}
+static int test_stealing(int drm_fd, const struct crtc_config *crtc, uint32_t *ids)
+{
+ int i, ret = 0;
+
+ if (!crtc->connector_count)
+ return drmModeSetCrtc(drm_fd, crtc->crtc_id,
+ crtc->fb_info.fb_id, 0, 0,
+ ids, crtc->connector_count, &crtc->mode);
+
+ for (i = 0; i < crtc->connector_count; ++i) {
+ ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,
+ crtc->fb_info.fb_id, 0, 0,
+ &ids[i], 1, &crtc->mode);
+
+ igt_assert_eq(ret, 0);
+
+ ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,
+ crtc->fb_info.fb_id, 0, 0,
+ ids, crtc->connector_count, &crtc->mode);
+
+ /* This should fail with -EINVAL */
+ if (!ret)
+ return 0;
+ }
+
+ return ret;
+}
+
static void test_crtc_config(const struct test_config *tconf,
struct crtc_config *crtcs, int crtc_count)
{
@@ -422,9 +451,13 @@ static void test_crtc_config(const struct test_config *tconf,
paint_fb(&crtc->fb_info, tconf->name, crtc_strs, crtc_count, i);
ids = get_connector_ids(crtc);
- ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,
- crtc->fb_info.fb_id, 0, 0, ids,
- crtc->connector_count, &crtc->mode);
+ if (tconf->flags & TEST_STEALING)
+ ret = test_stealing(drm_fd, crtc, ids);
+ else
+ ret = drmModeSetCrtc(drm_fd, crtc->crtc_id,
+ crtc->fb_info.fb_id, 0, 0, ids,
+ crtc->connector_count, &crtc->mode);
+
free(ids);
if (ret < 0) {
@@ -623,6 +656,9 @@ static void test_combinations(const struct test_config *tconf,
struct connector_config *cconfs;
int i;
+ if (connector_count > 2 && (tconf->flags & TEST_STEALING))
+ return;
+
get_combinations(tconf->resources->count_connectors, connector_count,
false, &connector_combs);
get_combinations(tconf->resources->count_crtcs, connector_count,
@@ -700,6 +736,8 @@ int main(int argc, char **argv)
"invalid-clone-exclusive-crtc" },
{ TEST_CLONE | TEST_EXCLUSIVE_CRTC_CLONE,
"clone-exclusive-crtc" },
+ { TEST_INVALID | TEST_CLONE | TEST_SINGLE_CRTC_CLONE | TEST_STEALING,
+ "invalid-clone-single-crtc-stealing" }
};
const char *help_str =
" -d\t\tDon't run any test, only print what would be done. (still needs DRM access)\n"