All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [IGT PATCH] tests/kms_setmode: Add tests when not stealing encoders on same crtc.
Date: Tue, 23 Feb 2016 16:23:26 +0100	[thread overview]
Message-ID: <56CC796E.8080700@linux.intel.com> (raw)

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>
---
The patches from drm/atomic: Fix encoder stealing fixes it, but I'll resend those soon,
I came up with another approach that's cleaner.

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 531ce8391fa7..6afe00c126fe 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"

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

                 reply	other threads:[~2016-02-23 15:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CC796E.8080700@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.