Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17258389ybl; Thu, 2 Jan 2020 01:52:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxUh2ni0Je7rNERJdEDX18yzHz4nmPR+wcpniG3rafvV789qT/inCIbfsZSlrXRja099MF+ X-Received: by 2002:a9d:7999:: with SMTP id h25mr91264494otm.347.1577958727751; Thu, 02 Jan 2020 01:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577958727; cv=none; d=google.com; s=arc-20160816; b=Lxqecbf8Qolp33ZNoAZB7tjkFcJUEpsN4b1LSHG540qgOpuheAJrM0xPYS23KpCl6B KNtTpWoIbpGLWtk96Y8n9NaXXt5pW/WyzFKlAHZK1lwIKwF0wghMkcqgS6k6hE3incBz ilY5UY+TaCROy6smx54YHU6DiJd3bdXpY1xuTGbB3Vf537rL0W0JSaDt0D9mbM5GFYtA 2wrvPQZWtqJ1vxEVy4W26B46UysF77UHZNsJLdMHgkARFMAFlkLeqGchUw06U1sBP9Pg qYUAeILbGvmKK1JPvO0k1bHCIHPHKVsv6C3p0uQEX8+NkQj/wzf+dRRVTVbolBpmnU/k SRzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZLFV3KPZN1lL2gR//KKQTAgXRtjGbQ0YmPBDQqK8uBM=; b=wh+vY29RIwQWeq487EorXuggxbTaap5OyOHqzcLfDmPXX7WPtZMP/75l/1zUDPZLts Huah6DK72hBGX6K624CbJiWNpA2rP7Z6Zk4LpUuYEUACoEVl1VPWda4+uGbW481wVMVx QW6kX/0M8D7mF4Zt8LKJGzq2U8GOSiFbIw9AGelKlSnUAaVllIMmA7eVgnphIo2qM2p2 WU45D+eOEJO1MUP0062ZdEihTNo8dQnZ+UDJw7ej20u0MKQ5BJy7W94I6wrTqc67ry18 9+IEMBcjoHDPstibzn7L/23MuvcOpK27wPLG8nFT6v/ikwKoeEmhHLFOXgqnusMy/qpc CkJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uJewPHQY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o16si29224941otp.289.2020.01.02.01.51.55; Thu, 02 Jan 2020 01:52:07 -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; dkim=pass header.i=@kernel.org header.s=default header.b=uJewPHQY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbgABJtw (ORCPT + 99 others); Thu, 2 Jan 2020 04:49:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:41478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727924AbgABJtw (ORCPT ); Thu, 2 Jan 2020 04:49:52 -0500 Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C03B42085B; Thu, 2 Jan 2020 09:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577958591; bh=e2aX0MJhewGki2xBt4YdOc9opVq/Rid8prxQy6m/Ask=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uJewPHQYBFbKV0Yfqi2AR4j6BhCuhjlhYdZMDjjUE6+7iSWBWg6lBV4hQS7nYnUWU YqXJCeuwQfjnjsTt9fnunSdiA2+Bmr9xmhIs9X1uEWPd6aRNk6HmdG9x4pa1Z1yBw1 bCOoXERIIbmROz7TTCinfFclzPOVwGeV1S8Fbd34= Date: Thu, 2 Jan 2020 10:49:48 +0100 From: Maxime Ripard To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: Roman Stratiienko , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 3/4] drm/sun4i: Reimplement plane z position setting logic Message-ID: <20200102094948.2u56oiv6b3e4ekmb@gilmour.lan> References: <20191228202818.69908-1-roman.stratiienko@globallogic.com> <1775324.taCxCBeP46@jernej-laptop> <2015568.Icojqenx9y@jernej-laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="de3mzsbuwly2nscs" Content-Disposition: inline In-Reply-To: <2015568.Icojqenx9y@jernej-laptop> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --de3mzsbuwly2nscs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 29, 2019 at 02:02:33PM +0100, Jernej =C5=A0krabec wrote: > Dne nedelja, 29. december 2019 ob 13:47:38 CET je Roman Stratiienko > napisal(a): > > On Sun, Dec 29, 2019 at 2:18 PM Jernej =C5=A0krabec > wrote: > > > Dne nedelja, 29. december 2019 ob 13:08:19 CET je Roman Stratiienko > > > > > > napisal(a): > > > > Hello Jernej, > > > > > > > > Thank you for review. > > > > > > > > On Sun, Dec 29, 2019 at 11:40 AM Jernej =C5=A0krabec > > > > > > > > > > wrote: > > > > > Hi! > > > > > > > > > > Dne sobota, 28. december 2019 ob 21:28:17 CET je > > > > > > > > > > roman.stratiienko@globallogic.com napisal(a): > > > > > > From: Roman Stratiienko > > > > > > > > > > > > To set blending channel order register software needs to know s= tate > > > > > > and > > > > > > position of each channel, which impossible at plane commit stag= e. > > > > > > > > > > > > Move this procedure to atomic_flush stage, where all necessary > > > > > > information > > > > > > is available. > > > > > > > > > > > > Signed-off-by: Roman Stratiienko > > > > > > --- > > > > > > > > > > > > drivers/gpu/drm/sun4i/sun8i_mixer.c | 47 > > > > > > +++++++++++++++++++++++++- > > > > > > drivers/gpu/drm/sun4i/sun8i_mixer.h | 3 ++ > > > > > > drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 42 ++++--------------= ----- > > > > > > drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 39 +++---------------= --- > > > > > > 4 files changed, 60 insertions(+), 71 deletions(-) > > > > > > > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c > > > > > > b/drivers/gpu/drm/sun4i/sun8i_mixer.c index > > > > > > bb9a665fd053..da84fccf7784 > > > > > > 100644 > > > > > > --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c > > > > > > +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c > > > > > > @@ -307,8 +307,47 @@ static void sun8i_atomic_begin(struct > > > > > > sunxi_engine > > > > > > *engine, > > > > > > > > > > > > static void sun8i_mixer_commit(struct sunxi_engine *engine) > > > > > > { > > > > > > > > > > > > - DRM_DEBUG_DRIVER("Committing changes\n"); > > > > > > + struct sun8i_mixer *mixer =3D engine_to_sun8i_mixer(engin= e); > > > > > > + u32 base =3D sun8i_blender_base(mixer); > > > > > > + int i, j; > > > > > > + int channel_by_zpos[4] =3D {-1, -1, -1, -1}; > > > > > > + u32 route =3D 0, pipe_ctl =3D 0; > > > > > > + > > > > > > + DRM_DEBUG_DRIVER("Update blender routing\n"); > > > > > > > > > > Use drm_dbg(). > > > > > > > > > > > + for (i =3D 0; i < 4; i++) { > > > > > > + int zpos =3D mixer->channel_zpos[i]; > > > > > > > > > > channel_zpos can hold 5 elements which is also theoretical maximu= m for > > > > > current HW design. Why do you check only 4 elements? > > > > > > > > I'll use plane_cnt as it done in mixer_bind > > > > > > > > > It would be great to introduce a macro like SUN8I_MIXER_MAX_LAYER= S so > > > > > everyone would understand where this number comes from. > > > > > > > > Will do. > > > > > > > > > > + > > > > > > + if (zpos >=3D 0 && zpos < 4) > > > > > > + channel_by_zpos[zpos] =3D i; > > > > > > + } > > > > > > + > > > > > > + j =3D 0; > > > > > > + for (i =3D 0; i < 4; i++) { > > > > > > + int ch =3D channel_by_zpos[i]; > > > > > > + > > > > > > + if (ch >=3D 0) { > > > > > > + pipe_ctl |=3D SUN8I_MIXER_BLEND_PIPE_CTL_= EN(j); > > > > > > + route |=3D ch << > > > > > > > > > > SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(j); > > > > > > > > > > > + j++; > > > > > > + } > > > > > > + } > > > > > > + > > > > > > + for (i =3D 0; i < 4 && j < 4; i++) { > > > > > > + int zpos =3D mixer->channel_zpos[i]; > > > > > > > > > > > > + if (zpos < 0) { > > > > > > + route |=3D i << > > > > > > > > > > SUN8I_MIXER_BLEND_ROUTE_PIPE_SHIFT(j); > > > > > > > > > > > + j++; > > > > > > + } > > > > > > + } > > > > > > + > > > > > > + regmap_update_bits(mixer->engine.regs, > > > > > > > > > > SUN8I_MIXER_BLEND_PIPE_CTL(base), > > > > > > > > > > > + SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK, > > > > > > > > > > pipe_ctl); > > > > > > > > > > > + > > > > > > + regmap_write(mixer->engine.regs, > > > > > > + SUN8I_MIXER_BLEND_ROUTE(base), route); > > > > > > + > > > > > > + DRM_DEBUG_DRIVER("Committing changes\n"); > > > > > > > > > > Use drm_dbg(). > > > > > > > > According to > > > > https://github.com/torvalds/linux/commit/99a954874e7b9f0c8058476575= 593b3 > > > > beb > > > > 5731a5#diff-b0cd2d683c6afbab7bd54173cfd3d3ecR289 , > > > > DRM_DEBUG_DRIVER uses drm_dbg. > > > > Also, using drm_dbg with category macro would require larger indent, > > > > making harder to fit in 80 chars limit. > > > > > > From what I can see, category is already defined by macro name. Check > > > here: > > > https://cgit.freedesktop.org/drm/drm-misc/tree/include/drm/drm_print.= h#n46 > > > 5 > > > > > > So it should be actually shorter. > > > > Ah, it something very recent. > > drm_dbg also require drm_device struct > > Do you know the best way to extract it from `struct engine`? > > I don't think there is a way. I guess we can solve this later. Maxime, any > thoughts? There's no way at the moment, but it would make sense to add a pointer to it. Maximey --de3mzsbuwly2nscs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXg28vAAKCRDj7w1vZxhR xU6hAQCE+KlOly8mijq6chKdZDCcSW8wUtYhuO+CaIIU7J53xQEAuD9An1CTC6G1 3+SsZAX+/ykUpdWbkwliqwhgmDmdKgU= =2asc -----END PGP SIGNATURE----- --de3mzsbuwly2nscs--