From: Yi Sun <yi.sun@intel.com>
To: daniel@ffwll.ch
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH] Add option -o <number>, which can test only one specified mode.
Date: Tue, 25 Sep 2012 17:13:17 +0800 [thread overview]
Message-ID: <1348564397-10638-1-git-send-email-yi.sun@intel.com> (raw)
Each mode line has a number just like '[i]'. So we can only test the specified mode with giving the number of mode to '-o' parameter.
Signed-off-by: Yi Sun <yi.sun@intel.com>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index c52bb2f..39c4265 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -72,6 +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;
drmModeModeInfo force_timing;
@@ -193,8 +194,10 @@ static void dump_connectors_fd(int drmfd)
printf(" modes:\n");
printf(" name refresh (Hz) hdisp hss hse htot vdisp "
"vss vse vtot flags type clock\n");
- for (j = 0; j < connector->count_modes; j++)
+ for (j = 0; j < connector->count_modes; j++){
+ fprintf(stdout, "[%d]", j );
kmstest_dump_mode(&connector->modes[j]);
+ }
drmModeFreeConnector(connector);
}
@@ -275,6 +278,12 @@ static void connector_find_preferred_mode(struct connector *c)
}
}
+ if ( only_one_mode ){
+ c->mode = connector->modes[specified_mode_num];
+ if (c->mode.type & DRM_MODE_TYPE_PREFERRED)
+ c->mode_valid = 1;
+ }
+
if (!c->mode_valid) {
if (connector->count_modes > 0) {
/* use the first mode as test mode */
@@ -318,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)
+ if(test_preferred_mode || force_mode || only_one_mode)
resources->crtcs[i] = 0;
c->connector = connector;
@@ -525,7 +534,7 @@ set_mode(struct connector *c)
gem_close(drm_fd, fb_info.gem_handle);
- fprintf(stdout, "CRTS(%u):",c->crtc);
+ fprintf(stdout, "CRTS(%u):[%d]",c->crtc, j);
kmstest_dump_mode(&c->mode);
if (drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0,
&c->id, 1, &c->mode)) {
@@ -585,7 +594,7 @@ int update_display(void)
dump_crtcs_fd(drm_fd);
}
- if (test_preferred_mode || test_all_modes || force_mode) {
+ if (test_preferred_mode || test_all_modes || force_mode || only_one_mode) {
/* Find any connected displays */
for (c = 0; c < resources->count_connectors; c++) {
connectors[c].id = resources->connectors[c];
@@ -596,7 +605,7 @@ int update_display(void)
return 1;
}
-static char optstr[] = "hiaf:s:d:p:mrt";
+static char optstr[] = "hiaf:s:d:p:mrto:";
static void __attribute__((noreturn)) usage(char *name)
{
@@ -609,6 +618,7 @@ static void __attribute__((noreturn)) usage(char *name)
fprintf(stderr, "\t-m\ttest the preferred mode\n");
fprintf(stderr, "\t-t\tuse a tiled framebuffer\n");
fprintf(stderr, "\t-r\tprint a QR code on the screen whose content is \"pass\" for the automatic test\n");
+ fprintf(stderr, "\t-o\t<number of the mode>\tonly test specified mode\n");
fprintf(stderr, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
fprintf(stderr, "\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
fprintf(stderr, "\t\ttest force mode\n");
@@ -701,6 +711,10 @@ int main(int argc, char **argv)
case 'r':
qr_code = 1;
break;
+ case 'o':
+ only_one_mode = 1;
+ specified_mode_num = atoi(optarg);
+ break;
default:
fprintf(stderr, "unknown option %c\n", c);
/* fall through */
@@ -710,7 +724,7 @@ int main(int argc, char **argv)
}
}
if (!test_all_modes && !force_mode && !dump_info &&
- !test_preferred_mode)
+ !test_preferred_mode && !only_one_mode)
test_all_modes = 1;
drm_fd = drm_open_any();
--
1.7.6.4
next reply other threads:[~2012-09-25 9:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-25 9:13 Yi Sun [this message]
2012-09-26 12:47 ` [PATCH] Add option -o <number>, which can test only one specified mode Daniel Vetter
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=1348564397-10638-1-git-send-email-yi.sun@intel.com \
--to=yi.sun@intel.com \
--cc=daniel@ffwll.ch \
--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