intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Yi Sun <yi.sun@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] tests/testdisplay.c: Remove the variable only_one_mode.
Date: Fri,  1 Feb 2013 14:40:24 +0800	[thread overview]
Message-ID: <1359700824-8822-1-git-send-email-yi.sun@intel.com> (raw)

That variable is useless, instead the variables specified_mode_num and specified_disp_id can cover all the situation.
For parameter -o, all three instances should work:

./testdisplay -o 21,4 only test the 4th mode on the connector with id 21.
./testdisplay -o 21   test all the mode lines on the connector wiht id 21.
./testdisplay -o ,4   the -o is ignored, just like -a.

Signed-off-by: Yi Sun <yi.sun@intel.com>

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index f2711ae..4d29ddb 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -72,7 +72,7 @@ int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
 int sleep_between_modes = 5;
 uint32_t depth = 24, stride, bpp;
 int qr_code = 0;
-int only_one_mode = 0, specified_mode_num = 0, specified_disp_id = 0;
+int specified_mode_num = -1, specified_disp_id = -1;
 
 drmModeModeInfo force_timing;
 
@@ -278,7 +278,7 @@ static void connector_find_preferred_mode(struct connector *c)
 		}
 	}
 
-	if ( only_one_mode ){
+	if ( specified_mode_num != -1 ){
 		c->mode = connector->modes[specified_mode_num];
 		if (c->mode.type & DRM_MODE_TYPE_PREFERRED)
 			c->mode_valid = 1;
@@ -327,7 +327,7 @@ static void connector_find_preferred_mode(struct connector *c)
 	c->crtc = resources->crtcs[i];
 	c->pipe = i;
 
-	if(test_preferred_mode || force_mode || only_one_mode)
+	if(test_preferred_mode || force_mode || specified_mode_num != -1)
 		resources->crtcs[i] = 0;
 
 	c->connector = connector;
@@ -594,11 +594,11 @@ int update_display(void)
 		dump_crtcs_fd(drm_fd);
 	}
 
-	if (test_preferred_mode || test_all_modes || force_mode || only_one_mode) {
+	if (test_preferred_mode || test_all_modes || force_mode || specified_disp_id != -1) {
 		/* Find any connected displays */
 		for (c = 0; c < resources->count_connectors; c++) {
 			connectors[c].id = resources->connectors[c];
-			if ( only_one_mode == 1 && connectors[c].id != specified_disp_id )
+			if ( specified_disp_id != -1 && connectors[c].id != specified_disp_id )
 				continue;
 
 			set_mode(&connectors[c]);
@@ -717,7 +717,6 @@ int main(int argc, char **argv)
 			qr_code = 1;
 			break;
 		case 'o':
-			only_one_mode = 1;
 			sscanf(optarg, "%d,%d", &specified_disp_id, &specified_mode_num);
 			break;
 		default:
@@ -729,7 +728,7 @@ int main(int argc, char **argv)
 		}
 	}
 	if (!test_all_modes && !force_mode && !dump_info &&
-	    !test_preferred_mode && !only_one_mode)
+	    !test_preferred_mode && specified_mode_num == -1)
 		test_all_modes = 1;
 
 	drm_fd = drm_open_any();
-- 
1.7.10.1

                 reply	other threads:[~2013-02-01  6:43 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=1359700824-8822-1-git-send-email-yi.sun@intel.com \
    --to=yi.sun@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).