From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B834C04EB8 for ; Tue, 4 Dec 2018 14:26:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07DFA206B7 for ; Tue, 4 Dec 2018 14:26:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Dru/jEnY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07DFA206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Uv9YbsYYDF2k8s+ox6P9iJqs/04EGutEoDYXRKaMNZM=; b=Dru/jEnY4C7Zue cQb5dkNFJZH3K1p8clHrRmy3saj+mz+QuSbq9IvZnF3SNhehk5rcRVDGWQsYAsWdEezTyQHfqbz9D QiC9vMynRp1rZqIjNsiI7NQl4ttNHmOB5/Oje810YH5TqesgJscYLFHEckhGe6qviZ2X3TUrV60vO syBLBLM5gh5SUiH6/Ybz5STwp8FtYnKn2m9kwD1W0LDJhKLO8chrpbTaUP00v8CDTRgnHugkDH7Y/ CH4YiWGQi/3DaUe1DmCUQ/gJmtYtr0jabnt3D4zTPnIuvubFkswxSR5XFpsawjyQtWi1MUFs22yZg Kjo/Tam5ZVzVb2MzBqEA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUBex-00046J-0g; Tue, 04 Dec 2018 14:26:47 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUBbd-0007fe-3U for linux-arm-kernel@lists.infradead.org; Tue, 04 Dec 2018 14:23:30 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id E626220784; Tue, 4 Dec 2018 15:23:09 +0100 (CET) Received: from localhost.localdomain (aaubervilliers-681-1-79-44.w90-88.abo.wanadoo.fr [90.88.21.44]) by mail.bootlin.com (Postfix) with ESMTPSA id B7A6220A5B; Tue, 4 Dec 2018 15:22:39 +0100 (CET) From: Paul Kocialkowski To: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 04/21] drm/sun4i: frontend: Pass DRM format info to input mode helper Date: Tue, 4 Dec 2018 15:22:01 +0100 Message-Id: <20181204142218.16284-5-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204142218.16284-1-paul.kocialkowski@bootlin.com> References: <20181204142218.16284-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181204_062322_362023_8EF080FF X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Maxime Ripard , Maarten Lankhorst , linux-sunxi@googlegroups.com, Paul Kocialkowski , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , Sean Paul Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org The helper returning the input mode needs to know the number of planes for the provided format. Passing the fourcc requires iterating through the format info list in order to return the number of planes. Pass the DRM format info structure directly instead, since it's available to the caller. Also rename the input format in the caller function to keep things consistent. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 1a7ebc45747e..c436fa97928f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -116,9 +116,11 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) } } -static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) +static int +sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format, + u32 *val) { - if (drm_format_num_planes(fmt) == 1) + if (format->num_planes == 1) *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED; else return -EINVAL; @@ -183,12 +185,13 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, { struct drm_plane_state *state = plane->state; struct drm_framebuffer *fb = state->fb; - uint32_t format = fb->format->format; + const struct drm_format_info *format = fb->format; u32 out_fmt_val; u32 in_fmt_val, in_mod_val, in_ps_val; int ret; - ret = sun4i_frontend_drm_format_to_input_fmt(format, &in_fmt_val); + ret = sun4i_frontend_drm_format_to_input_fmt(format->format, + &in_fmt_val); if (ret) { DRM_DEBUG_DRIVER("Invalid input format\n"); return ret; @@ -200,7 +203,8 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, return ret; } - ret = sun4i_frontend_drm_format_to_input_sequence(format, &in_ps_val); + ret = sun4i_frontend_drm_format_to_input_sequence(format->format, + &in_ps_val); if (ret) { DRM_DEBUG_DRIVER("Invalid pixel sequence\n"); return ret; -- 2.19.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel