public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/3] tests/kms_plane_lowres: Search for modes of the connector being tested
Date: Fri, 29 Mar 2019 18:03:26 -0700	[thread overview]
Message-ID: <20190330010328.28054-1-jose.souza@intel.com> (raw)

get_lowres_mode() was looking for the desired mode over all
connectors what could cause commit to fail due incompatibility.

Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 tests/kms_plane_lowres.c | 48 +++++++++-------------------------------
 1 file changed, 11 insertions(+), 37 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index b27e5e61..f7739b11 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -43,9 +43,8 @@ typedef struct {
 } data_t;
 
 static drmModeModeInfo
-get_lowres_mode(int drmfd, drmModeModeInfo *mode_default)
+get_lowres_mode(int drmfd, igt_output_t *output, drmModeModeInfo *mode_default)
 {
-	drmModeRes *mode_resources = drmModeGetResources(drmfd);
 	drmModeModeInfo mode;
 	drmModeModeInfo std_1024_mode = {
 		.clock = 65000,
@@ -64,43 +63,18 @@ get_lowres_mode(int drmfd, drmModeModeInfo *mode_default)
 		.type = 0x40,
 		.name = "Custom 1024x768",
 	};
-	bool found;
-	int limit = mode_default->vdisplay-SIZE;
-	int i, j;
-
-	if (!mode_resources) {
-		igt_warn("drmModeGetResources failed: %s\n", strerror(errno));
-		return std_1024_mode;
-	}
-
-	found = false;
-	for (i = 0; i < mode_resources->count_connectors; i++) {
-		drmModeConnector *connector;
-
-		connector = drmModeGetConnectorCurrent(drmfd,
-						       mode_resources->connectors[i]);
-		if (!connector) {
-			igt_warn("could not get connector %i: %s\n",
-				 mode_resources->connectors[i], strerror(errno));
-			continue;
+	bool found = false;
+	int limit = mode_default->vdisplay - SIZE;
+	int j;
+
+	for (j = 0; j < output->config.connector->count_modes; j++) {
+		mode = output->config.connector->modes[j];
+		if (mode.vdisplay < limit) {
+			found = true;
+			break;
 		}
-
-		if (!connector->count_modes)
-			continue;
-
-		for (j = 0; j < connector->count_modes; j++) {
-			mode = connector->modes[j];
-			if (mode.vdisplay < limit) {
-				found = true;
-				break;
-			}
-		}
-
-		drmModeFreeConnector(connector);
 	}
 
-	drmModeFreeResources(mode_resources);
-
 	if (!found)
 		return std_1024_mode;
 
@@ -217,7 +191,7 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	mode1 = test_setup(data, pipe, modifier, output);
 
-	mode_lowres = get_lowres_mode(data->drm_fd, mode1);
+	mode_lowres = get_lowres_mode(data->drm_fd, output, mode1);
 
 	ret = igt_display_try_commit2(&data->display, COMMIT_ATOMIC);
 	igt_skip_on(ret != 0);
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-03-30  1:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30  1:03 José Roberto de Souza [this message]
2019-03-30  1:03 ` [igt-dev] [PATCH i-g-t 2/3] lib: Share the 1024x768 mode among tests José Roberto de Souza
2019-04-01 13:21   ` Kahola, Mika
2019-03-30  1:03 ` [igt-dev] [PATCH i-g-t 3/3] tests/plane_lowres: Test each plane individually José Roberto de Souza
2019-04-01 13:18   ` Kahola, Mika
2019-04-01 19:47     ` Souza, Jose
2019-03-30  1:43 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/kms_plane_lowres: Search for modes of the connector being tested Patchwork
2019-03-30  5:03 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-01 13:10 ` [igt-dev] [PATCH i-g-t 1/3] " Kahola, Mika

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=20190330010328.28054-1-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=igt-dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox