From patchwork Mon Mar 4 15:31:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10837965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB49F14DE for ; Mon, 4 Mar 2019 15:31:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 973042A833 for ; Mon, 4 Mar 2019 15:31:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 935AC2A842; Mon, 4 Mar 2019 15:31:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FFDE2A833 for ; Mon, 4 Mar 2019 15:31:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FEE889D40; Mon, 4 Mar 2019 15:31:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9FFCF89CF2; Mon, 4 Mar 2019 15:31:23 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id a15so2996422qkc.1; Mon, 04 Mar 2019 07:31:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=IOoRQhXw067ys5/u35L6S2JFPR9EliiCKY3XXqxBqvA=; b=azPRyWSQIFpNUkSJBnSI7X8z9c7ASauDcn+gPajP+G6Wo3a7+mJ/SLg9YcVfMdnb+6 MFyVzWQIE2S/QY9Duo2/LE44zQncf25rknXFcZSP4AxaNgHVriKU8hrRs33Mfb5ftf0s lIw4tEBHJMWi9d08YVL9v8hdTAbNRMbyJEwu7N9PrEav9cvP/bL8YLlWW6TwQvgei5t7 1QZj1yXqIXZaEN39HlzfvZ7ls9GX6KNP6pswiCkm5mI1VSdElHeltp3zIMaYPZ8Z3Cmj LCu22FpfBOCKNEFt6ckYgjdw93DqdyI18WytoJO8gUIrF6HS/imxLXSbD54ctZK0JG/n rk4Q== X-Gm-Message-State: APjAAAUqujk2O0axC5TL/e67tvZeCcdoAboYbNrPpbqzS4BE4FI4R6nz 3OzTBBBsy2uK8KVHCcCBcphXl/MQ X-Google-Smtp-Source: APXvYqx1ItoLnA/YrjZC7iBSCTwAFm+pAAd1NwM6J0IP6oQPiR1jF1w+8+H9WpWtAZKUmMQwiV/paA== X-Received: by 2002:a37:2fc1:: with SMTP id v184mr14030772qkh.71.1551713482756; Mon, 04 Mar 2019 07:31:22 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id v131sm3642066qka.95.2019.03.04.07.31.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 04 Mar 2019 07:31:22 -0800 (PST) Date: Mon, 4 Mar 2019 12:31:20 -0300 From: Rodrigo Siqueira To: Petri Latvala , Arkadiusz Hiler Message-ID: References: MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=IOoRQhXw067ys5/u35L6S2JFPR9EliiCKY3XXqxBqvA=; b=WErYaQn5F/aQAB9baFhHlDpDq3S+VWMhXQR/w14iDpo2cLuxyM0EgQN7CwqH7yMqYJ nOZDPfElGCY0nuvrM0e4JICzi533afJpC/faPKmVjTEpeqM1XQ9Vx8/dWUfXkCeGPnFH oLXo0rACI/O5Ani7rCLB8+9+k+XI/T1H+YwkjzB1lim50Dt8qpVrmWTtGXQXbFvbXiBe lhYpm8sGCiK+ss2yeqwpFgq8SvD7HngYBym3ef/DUs8ZjPO6Fi4z2/SplikS1HTq6VN7 inbtUR+9xT2YYWQBOGm+YFtchAv4zNksZkdk4PocLoUUBSUisIxPdmP5tjHi59beiJZA RlXg== Subject: [Intel-gfx] [PATCH i-g-t 5/7] kms_flip: Remove magic constant in run_test_on_crtc_set() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The function run_test_on_crtc_set() expects a parameter named crtc_count which slight changes the behavior of the test. If this crtc_count is ‘1’, the test will run in a single CRTC; otherwise, it will run in two different CRTC. However, this function uses hardcoded literal 1 and 2 for each case. This patch creates two constant with the goal to improve the readability. Signed-off-by: Rodrigo Siqueira --- tests/kms_flip.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 9ef77de9..42ae3ebc 100755 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -76,6 +76,9 @@ #define EVENT_FLIP (1 << 0) #define EVENT_VBLANK (1 << 1) +#define RUN_TEST 1 +#define RUN_PAIR 2 + #ifndef DRM_CAP_TIMESTAMP_MONOTONIC #define DRM_CAP_TIMESTAMP_MONOTONIC 6 #endif @@ -1164,7 +1167,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, int i; switch (crtc_count) { - case 1: + case RUN_TEST: connector_find_preferred_mode(o->_connector[0], crtc_idxs[0], o); if (!o->mode_valid) return; @@ -1175,7 +1178,7 @@ static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs, kmstest_connector_type_str(o->kconnector[0]->connector_type), o->kconnector[0]->connector_type_id); break; - case 2: + case RUN_PAIR: connector_find_compatible_mode(crtc_idxs[0], crtc_idxs[1], o); if (!o->mode_valid) return; @@ -1341,7 +1344,7 @@ static int run_test(int duration, int flags) o.depth = 24; crtc_idx = n; - run_test_on_crtc_set(&o, &crtc_idx, 1, duration); + run_test_on_crtc_set(&o, &crtc_idx, RUN_TEST, duration); } } @@ -1410,7 +1413,8 @@ static int run_pair(int duration, int flags) crtc_idxs[0] = n; crtc_idxs[1] = m; - run_test_on_crtc_set(&o, crtc_idxs, 2, + run_test_on_crtc_set(&o, crtc_idxs, + RUN_PAIR, duration); } }