From patchwork Mon Mar 4 15:31:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10837967 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 A7D3514DE for ; Mon, 4 Mar 2019 15:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EFAF2A5EC for ; Mon, 4 Mar 2019 15:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2072A5C8; Mon, 4 Mar 2019 15:31:52 +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 4DDA92A758 for ; Mon, 4 Mar 2019 15:31:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9332589D39; Mon, 4 Mar 2019 15:31:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 347C089D39; Mon, 4 Mar 2019 15:31:50 +0000 (UTC) Received: by mail-qt1-x82c.google.com with SMTP id j36so5529376qta.7; Mon, 04 Mar 2019 07:31:50 -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=d2oEUZbDzyryZRfqwkJ4GakXhe9FwHDLRMrWLv1jRaU=; b=J4v4NUBFkgDtlyd2RrdBsVtG/nNa1/bKNO3p+EQSUF3oFXJJgiaEbO5D05PAVXlJfc UiKkeFcLZXWuHQ6Yqv5L1SXo9Mc/dwIhHkAOLJjKyI06xjYrHTYABzu/+/4hQuSfBUey siJVpYE1jFSaTYxQrZnKqoYSg5Lzt52isgnbRcOsFzyWqEqTeUNb8HoFaNPPgVCtIGYn KCnHhtJQGkApkl/SNfOUCldscusrXZ+5AJ88q2KEysfatOeIY2p3B1BkvaljB4LyzqdT 2i0C8N7FL0n3GHppyVb8+EMb8kUV9jv4Z2SCsiykkJ1wemnXl6rjLesVfR6VsvlNw00D UmHQ== X-Gm-Message-State: APjAAAV2/Zg27NAlgsn41ZycHA+G8z2ZxnXISiFsvEu9GNYqu+jeDDdn /vIL45+khMYlan4AIJTiiGw= X-Google-Smtp-Source: APXvYqyhwkdS/xrVXCf8/SMr/p0wM7uzukNotQUukrTn5voamcdlEEZgW+FQU86bEKzrPqJkimB3kQ== X-Received: by 2002:ac8:2ef3:: with SMTP id i48mr14581565qta.316.1551713509307; Mon, 04 Mar 2019 07:31:49 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id q2sm3504637qtn.47.2019.03.04.07.31.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 04 Mar 2019 07:31:48 -0800 (PST) Date: Mon, 4 Mar 2019 12:31:46 -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=d2oEUZbDzyryZRfqwkJ4GakXhe9FwHDLRMrWLv1jRaU=; b=MFU/O/gZ/sNfdaywrDU6ri6EICcW8HHVQhn5yMWWCAex50SS9dN+ToZteSEsnJ6eQU KDoO9+qRORA814REDnbsMQoBccD96UHixUd2TwUHob1iE+zcOCiUQ0X65nzinuIyMa9/ RrlLD4fL1anttmuqlad5o3bZ3ewlt6B1e9AfwOuLdOlO10r2VHR3kqzBgOYV/v5YJve2 TJWFSmKKMopH1bGb4qiLb1VXVUuQlPznTk5v8/KrC+Wfzh/8qdljNCvZ3nHXOSaER/uX eHuzqYK0dCQCDdLao4iWxirnEvR/DP0rvg7dlyU4WoxQObAGputb9bkgrG3UVN03oRln I9UA== Subject: [Intel-gfx] [PATCH i-g-t 6/7] kms_flip: Rework set_mode() 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 This patch removes the duplicate code inside the function set_mode(). Signed-off-by: Rodrigo Siqueira --- tests/kms_flip.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 42ae3ebc..de3ab600 100755 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -609,22 +609,24 @@ static bool is_wedged(int fd) static int set_mode(struct test_output *o, uint32_t fb, int x, int y) { - int n; + int n, ret; for (n = o->count - 1; n >= 0; n--) { + uint32_t buffer_id = fb, x_crtc = x, y_crtc = y; + uint32_t *conn = &o->_connector[n]; + int count = 1; + drmModeModeInfoPtr mode = &o->kmode[n]; + if (fb == 0) { - int ret = drmModeSetCrtc(drm_fd, o->_crtc[n], - 0, 0, 0, - 0, 0, 0); - if (ret) - return ret; - } else { - int ret = drmModeSetCrtc(drm_fd, o->_crtc[n], - fb, x, y, - &o->_connector[n], 1, &o->kmode[n]); - if (ret) - return ret; + buffer_id = x_crtc = y_crtc = count = 0; + conn = NULL; mode = NULL; } + + ret = drmModeSetCrtc(drm_fd, o->_crtc[n], + buffer_id, x_crtc, y_crtc, + conn, count, mode); + if (ret) + return ret; } return 0;