From patchwork Fri Feb 1 06:40:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Sun X-Patchwork-Id: 2076821 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id DC250DFE75 for ; Fri, 1 Feb 2013 06:51:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FD90E6AF1 for ; Thu, 31 Jan 2013 22:51:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A3DEE6AE3 for ; Thu, 31 Jan 2013 22:43:57 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 31 Jan 2013 22:43:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,579,1355126400"; d="scan'208";a="279546677" Received: from sunyi-pc.sh.intel.com ([10.239.13.42]) by orsmga002.jf.intel.com with ESMTP; 31 Jan 2013 22:43:44 -0800 From: Yi Sun To: intel-gfx@lists.freedesktop.org Date: Fri, 1 Feb 2013 14:40:24 +0800 Message-Id: <1359700824-8822-1-git-send-email-yi.sun@intel.com> X-Mailer: git-send-email 1.7.6.4 Subject: [Intel-gfx] [PATCH] tests/testdisplay.c: Remove the variable only_one_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 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 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();