From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] Add option -o , which can test only one specified mode. Date: Wed, 26 Sep 2012 14:47:36 +0200 Message-ID: <20120926124736.GG1980@bremse> References: <1348564397-10638-1-git-send-email-yi.sun@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 554569E797 for ; Wed, 26 Sep 2012 05:47:52 -0700 (PDT) Received: by lbbgi11 with SMTP id gi11so910910lbb.36 for ; Wed, 26 Sep 2012 05:47:51 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1348564397-10638-1-git-send-email-yi.sun@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Yi Sun Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Sep 25, 2012 at 05:13:17PM +0800, Yi Sun wrote: > 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 Merged, thanks for the patch. -Daniel > > 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\tonly test specified mode\n"); > fprintf(stderr, "\t-f\t,,,,,\n"); > fprintf(stderr, "\t\t,,,\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 > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch