From patchwork Tue Sep 25 09:13:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 1503461 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id AB7143FC71 for ; Tue, 25 Sep 2012 09:43:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A907C9F71D for ; Tue, 25 Sep 2012 02:43:44 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 828A39E86C for ; Tue, 25 Sep 2012 02:16:22 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 25 Sep 2012 02:16:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,481,1344236400"; d="scan'208";a="226380120" Received: from sunyi-pc.sh.intel.com ([10.239.13.42]) by fmsmga002.fm.intel.com with ESMTP; 25 Sep 2012 02:15:56 -0700 From: Yi Sun To: daniel@ffwll.ch Date: Tue, 25 Sep 2012 17:13:17 +0800 Message-Id: <1348564397-10638-1-git-send-email-yi.sun@intel.com> X-Mailer: git-send-email 1.7.6.4 Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] Add option -o , which can test only one specified mode. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 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();