Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp455342imu; Tue, 27 Nov 2018 01:03:05 -0800 (PST) X-Google-Smtp-Source: AJdET5f4HXxeb1mx9w2SfAZyp1AcEZTYgUiW5DeluGWyPppTj0bWVy0oq91ywpHDGAb/O/wGiE8Q X-Received: by 2002:a62:d449:: with SMTP id u9-v6mr32239185pfl.116.1543309385278; Tue, 27 Nov 2018 01:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543309385; cv=none; d=google.com; s=arc-20160816; b=n8V7VZKDcNXN5aT/jRvfc9csmsFmuie3nt5FdlTA63+/HvELtr8U7QWw85docYFmGd DWFODl+eeFvz+itFCmKclpNjOId1VpKrwjdI70zHv5B1XVSXkM566vHX3Nd4jbyh1cuo /r1SQBgikO28vFYb4/GN7oQxVP7sVyc8Fm3UtsFxB7Gax1bbZ1AlhDEVcmjEv5hW2iOG uJcij2XqBBlCS6zpnSSXC3V3skYzXzuNMDbAhaKWNN7y2Pi1tnvzuivw8YA0V6VO1vdw nuV4XJ1dYbEjz4mCeeedBtVRono/Sb1sW9Xrax/bgrDmRyW4apjMu58zK0wWdYglBDLd L5RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uIyrKvAgObFKmHdWx3jxL3mg8TX2TrtN54M6gcVzetg=; b=AqyzWENsHIr09xFrrqmAt27xb4g9kr4H/XJmHxIHjsfJ6QiQlLcCHQzN07glK2cJYG o6hAmuJ2JWS8OAtOlcHpCsbEChv9k2TzQ9Hwkxypo4wdRk7gdeJJy9xGq1EuRFEyWSI6 O+q3UzJRFAj5tRDzGyw+tNLrv/2RQYpbTRn6Ko7/94S6E2Ub7QQO6gsbOAEKvQm17ejA ylcAukHj9rnW4N4LJ2LN0Cr12XElmigouZ2Znmqb7GJlgT4w1Ej9+vXOzGr+HgEBGFNH 4Ftf6AonBdSc94ps0JYmK76IWyLjVw4Y105U8Us1KlDeof6Vwc922KYCV7qA92hBKYB0 Jl2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si3268086pld.194.2018.11.27.01.02.49; Tue, 27 Nov 2018 01:03:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729933AbeK0T5w (ORCPT + 99 others); Tue, 27 Nov 2018 14:57:52 -0500 Received: from mail.bootlin.com ([62.4.15.54]:58252 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729387AbeK0T5v (ORCPT ); Tue, 27 Nov 2018 14:57:51 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id A73AA207BC; Tue, 27 Nov 2018 10:00:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id 72C2520DC6; Tue, 27 Nov 2018 10:00:27 +0100 (CET) Date: Tue, 27 Nov 2018 10:00:27 +0100 From: Maxime Ripard To: Paul Kocialkowski Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Maarten Lankhorst , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter Subject: Re: [PATCH v2 27/43] drm/sun4i: frontend: Add support for semi-planar YUV input formats Message-ID: <20181127090027.mezxdx4s77ylj762@flea> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> <20181123092515.2511-28-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vxfwkkzihqxp66re" Content-Disposition: inline In-Reply-To: <20181123092515.2511-28-paul.kocialkowski@bootlin.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --vxfwkkzihqxp66re Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 23, 2018 at 10:24:59AM +0100, Paul Kocialkowski wrote: > Semi-planar YUV formats use two distinct planes, one for luminance and > one for chrominance. To add support for them, we need to configure the > second line stride and buffer address registers to setup the second YUV > plane. >=20 > New definitions are introduced to configure the input format register > for the YUV420 and YUV422 semi-planar formats. >=20 > Signed-off-by: Paul Kocialkowski > --- > drivers/gpu/drm/sun4i/sun4i_frontend.c | 52 +++++++++++++++++++++++--- > drivers/gpu/drm/sun4i/sun4i_frontend.h | 6 +++ > drivers/gpu/drm/sun4i/sun4i_layer.c | 4 ++ > 3 files changed, 57 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun= 4i/sun4i_frontend.c > index f443e8e1d8ec..e31438e5cabd 100644 > --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c > +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c > @@ -118,11 +118,23 @@ void sun4i_frontend_update_buffer(struct sun4i_fron= tend *frontend, > regmap_write(frontend->regs, SUN4I_FRONTEND_LINESTRD0_REG, > fb->pitches[0]); > =20 > + if (fb->format->num_planes > 1) > + regmap_write(frontend->regs, SUN4I_FRONTEND_LINESTRD1_REG, > + fb->pitches[1]); > + > /* Set the physical address of the buffer in memory */ > paddr =3D drm_fb_cma_get_gem_addr(fb, state, 0); > paddr -=3D PHYS_OFFSET; > - DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); > + DRM_DEBUG_DRIVER("Setting buffer #0 address to %pad\n", &paddr); > regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR0_REG, paddr); > + > + if (fb->format->num_planes > 1) { > + paddr =3D drm_fb_cma_get_gem_addr(fb, state, 1); > + paddr -=3D PHYS_OFFSET; > + DRM_DEBUG_DRIVER("Setting buffer #1 address to %pad\n", &paddr); > + regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR1_REG, > + paddr); > + } > } > EXPORT_SYMBOL(sun4i_frontend_update_buffer); > =20 > @@ -130,6 +142,8 @@ static int sun4i_frontend_drm_format_to_input_fmt(uin= t32_t fmt, u32 *val) > { > if (!drm_format_is_yuv(fmt)) > *val =3D SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; > + else if (drm_format_is_yuv_sampling_420(fmt)) > + *val =3D SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420; > else if (drm_format_is_yuv_sampling_422(fmt)) > *val =3D SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422; > else > @@ -140,12 +154,20 @@ static int sun4i_frontend_drm_format_to_input_fmt(u= int32_t fmt, u32 *val) > =20 > static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *va= l) > { > - if (drm_format_num_planes(fmt) =3D=3D 1) > + int num_planes =3D drm_format_num_planes(fmt); > + > + switch (num_planes) { > + case 1: You seem to use either the helper or retrieve the structure field directly to access the number of planes. I'm fine either way, but this should be consistent. Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --vxfwkkzihqxp66re Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCW/0HqwAKCRDj7w1vZxhR xbL+AP0YNFEOwKION6NLQar+VdHTyGaMgjc7CSU4sydadCOxpgEAhnJA3+6VKTWP QarWr/1yP6h2jgabeVhxvLTLu0qykwg= =BeQR -----END PGP SIGNATURE----- --vxfwkkzihqxp66re--