From patchwork Mon Feb 20 11:02:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Starkey X-Patchwork-Id: 9582541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9FF3604A0 for ; Mon, 20 Feb 2017 11:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC6C5287FA for ; Mon, 20 Feb 2017 11:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE14C287E9; Mon, 20 Feb 2017 11:03:00 +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=-4.2 required=2.0 tests=BAYES_00, 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 6A021287E9 for ; Mon, 20 Feb 2017 11:03:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F14636E3A7; Mon, 20 Feb 2017 11:02:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by gabe.freedesktop.org (Postfix) with ESMTP id 735A16E3A3 for ; Mon, 20 Feb 2017 11:02:55 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5851D54C; Mon, 20 Feb 2017 03:02:55 -0800 (PST) Received: from e106950-lin.cambridge.arm.com (e106950-lin.cambridge.arm.com [10.2.138.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB6123F23B; Mon, 20 Feb 2017 03:02:54 -0800 (PST) From: Brian Starkey To: intel-gfx@lists.freedesktop.org Date: Mon, 20 Feb 2017 11:02:45 +0000 Message-Id: <1487588568-5033-2-git-send-email-brian.starkey@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1487588568-5033-1-git-send-email-brian.starkey@arm.com> References: <1487588568-5033-1-git-send-email-brian.starkey@arm.com> Subject: [Intel-gfx] [PATCH i-g-t v2 2/5] lib/igt_kms: Neaten up pipe->planes[] assignment X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Remove a bunch of branches, functionally equivalent. Changes since v1: - Added back display->has_cursor_plane assignment Signed-off-by: Brian Starkey Reviewed-by: Robert Foss --- lib/igt_kms.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 9e59e35f2e2f..585aad7aafb3 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1639,32 +1639,19 @@ void igt_display_init(igt_display_t *display, int drm_fd) type = get_drm_plane_type(display->drm_fd, plane_resources->planes[j]); - switch (type) { - case DRM_PLANE_TYPE_PRIMARY: - if (pipe->plane_primary == -1) { - plane = &pipe->planes[0]; - plane->index = 0; - pipe->plane_primary = 0; - } else { - plane = &pipe->planes[p]; - plane->index = p++; - } - break; - case DRM_PLANE_TYPE_CURSOR: - if (pipe->plane_cursor == -1) { - plane = &pipe->planes[last_plane]; - plane->index = last_plane; - pipe->plane_cursor = last_plane; - } else { - plane = &pipe->planes[p]; - plane->index = p++; - } + + if (type == DRM_PLANE_TYPE_PRIMARY && pipe->plane_primary == -1) { + plane = &pipe->planes[0]; + plane->index = 0; + pipe->plane_primary = 0; + } else if (type == DRM_PLANE_TYPE_CURSOR && pipe->plane_cursor == -1) { + plane = &pipe->planes[last_plane]; + plane->index = last_plane; + pipe->plane_cursor = last_plane; display->has_cursor_plane = true; - break; - default: + } else { plane = &pipe->planes[p]; plane->index = p++; - break; } igt_assert_f(plane->index < n_planes, "n_planes < plane->index failed\n");