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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 27217C4361B for ; Fri, 11 Dec 2020 10:13:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 BD28B23C18 for ; Fri, 11 Dec 2020 10:13:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD28B23C18 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:Date:Message-ID:Subject:From:References:To:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QJ1qcYR0YodubjpCIWRnNAT0p+IXhMHcxPm49qvKPPw=; b=aMK2/bG2GpdYKyMRoz5wjzU+h Oa53YGKLr0FiLM0R5JOt2YdStbv9PRCSRNnGhSH537dDOjB8wTLyt0cmcPgCZLRS3AI11E9atqIKP iUM7qj/W8tvJkNzqYvtM4L0Mm7eP00JwtVOgPNY+7h/anikMnr7RhOZ0/pvCY7ac+RF3mQxER2vPT k/08wUB9vFZdS1Rtp0dGGEG4tDhStn1m/hK5gA3BZyRRfbJqXwGyNAywPK8RJ7w39uwqV59neskHI rpF5DvVBVLE39NGwQmZiU1UyJwMkNN8ya2nwL6WMJAS0PyRate4F+PDZuFp5ZepBpO1D0hFbpGfGR oo1Jza/5w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knfOv-0003tv-BQ; Fri, 11 Dec 2020 10:11:49 +0000 Received: from mx2.suse.de ([195.135.220.15]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knfOt-0003tM-1b; Fri, 11 Dec 2020 10:11:48 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A584FAC10; Fri, 11 Dec 2020 10:11:43 +0000 (UTC) To: Maxime Ripard , Daniel Vetter , David Airlie , Maarten Lankhorst , Mark Rutland , Rob Herring , Frank Rowand , Eric Anholt References: <20201204151138.1739736-1-maxime@cerno.tech> <20201204151138.1739736-6-maxime@cerno.tech> From: Thomas Zimmermann Subject: Re: [PATCH v2 5/7] drm/vc4: kms: Remove unassigned_channels from the HVS state Message-ID: Date: Fri, 11 Dec 2020 11:11:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201204151138.1739736-6-maxime@cerno.tech> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201211_051147_321479_9BED5E8A X-CRM114-Status: GOOD ( 33.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Tim Gover , Dave Stevenson , dri-devel@lists.freedesktop.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Phil Elwell , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============7540315496356311080==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============7540315496356311080== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8CsgVUlgHggoOS5UjO2qw1YdQd699lHX7" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8CsgVUlgHggoOS5UjO2qw1YdQd699lHX7 Content-Type: multipart/mixed; boundary="G9X4LYRXmU4IZQdRg06F3vjoA4wRm3WWo"; protected-headers="v1" From: Thomas Zimmermann To: Maxime Ripard , Daniel Vetter , David Airlie , Maarten Lankhorst , Mark Rutland , Rob Herring , Frank Rowand , Eric Anholt Cc: devicetree@vger.kernel.org, Tim Gover , Dave Stevenson , dri-devel@lists.freedesktop.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Phil Elwell , linux-arm-kernel@lists.infradead.org Message-ID: Subject: Re: [PATCH v2 5/7] drm/vc4: kms: Remove unassigned_channels from the HVS state References: <20201204151138.1739736-1-maxime@cerno.tech> <20201204151138.1739736-6-maxime@cerno.tech> In-Reply-To: <20201204151138.1739736-6-maxime@cerno.tech> --G9X4LYRXmU4IZQdRg06F3vjoA4wRm3WWo Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Am 04.12.20 um 16:11 schrieb Maxime Ripard: > The HVS state now has both unassigned_channels that reflects the > channels that are not used in the associated state, and the in_use > boolean for each channel that says whether or not a particular channel > is in use. >=20 > Both express pretty much the same thing, and we need the in_use variabl= e > to properly track the commits, so let's get rid of unassigned_channels.= >=20 > Suggested-by: Thomas Zimmermann > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/vc4/vc4_kms.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_km= s.c > index fdd698df5fbe..fa40c44eb770 100644 > --- a/drivers/gpu/drm/vc4/vc4_kms.c > +++ b/drivers/gpu/drm/vc4/vc4_kms.c > @@ -39,7 +39,6 @@ static struct vc4_ctm_state *to_vc4_ctm_state(struct = drm_private_state *priv) > =20 > struct vc4_hvs_state { > struct drm_private_state base; > - unsigned int unassigned_channels; > =20 > struct { > unsigned in_use: 1; > @@ -798,7 +797,6 @@ vc4_hvs_channels_duplicate_state(struct drm_private= _obj *obj) > =20 > __drm_atomic_helper_private_obj_duplicate_state(obj, &state->base); > =20 > - state->unassigned_channels =3D old_state->unassigned_channels; > =20 > for (i =3D 0; i < HVS_NUM_CHANNELS; i++) { > state->fifo_state[i].in_use =3D old_state->fifo_state[i].in_use; > @@ -849,7 +847,6 @@ static int vc4_hvs_channels_obj_init(struct vc4_dev= *vc4) > if (!state) > return -ENOMEM; > =20 > - state->unassigned_channels =3D GENMASK(HVS_NUM_CHANNELS - 1, 0); > drm_atomic_private_obj_init(&vc4->base, &vc4->hvs_channels, > &state->base, > &vc4_hvs_state_funcs); > @@ -893,12 +890,17 @@ static int vc4_pv_muxing_atomic_check(struct drm_= device *dev, > struct vc4_hvs_state *hvs_new_state; > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > struct drm_crtc *crtc; > + unsigned int unassigned_channels; > unsigned int i; > =20 > hvs_new_state =3D vc4_hvs_get_global_state(state); > if (!hvs_new_state) > return -EINVAL; > =20 > + for (i =3D 0; i < HVS_NUM_CHANNELS; i++) > + if (!hvs_new_state->fifo_state[i].in_use) > + unassigned_channels |=3D BIT(i); > + More of a nit: I'd turn this block into a helper of struct=20 vc4_hvs_state. That would also remove the need to initialize=20 unassigned_channels to 0 here. For the loop's condition, it might be less error prone to use=20 ARRAY_SIZE(hvs_new_state->fifo_state) instead of HVS_NUM_CHANNEL. In any case Reviewed-by: Thomas Zimmermann Best regards Thomas > for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_= state, i) { > struct vc4_crtc_state *old_vc4_crtc_state =3D > to_vc4_crtc_state(old_crtc_state); > @@ -918,8 +920,6 @@ static int vc4_pv_muxing_atomic_check(struct drm_de= vice *dev, > /* If we're disabling our CRTC, we put back our channel */ > if (!new_crtc_state->enable) { > channel =3D old_vc4_crtc_state->assigned_channel; > - > - hvs_new_state->unassigned_channels |=3D BIT(channel); > hvs_new_state->fifo_state[channel].in_use =3D false; > new_vc4_crtc_state->assigned_channel =3D VC4_HVS_CHANNEL_DISABLED;= > continue; > @@ -949,13 +949,13 @@ static int vc4_pv_muxing_atomic_check(struct drm_= device *dev, > * the future, we will need to have something smarter, > * but it works so far. > */ > - matching_channels =3D hvs_new_state->unassigned_channels & vc4_crtc-= >data->hvs_available_channels; > + matching_channels =3D unassigned_channels & vc4_crtc->data->hvs_avai= lable_channels; > if (!matching_channels) > return -EINVAL; > =20 > channel =3D ffs(matching_channels) - 1; > new_vc4_crtc_state->assigned_channel =3D channel; > - hvs_new_state->unassigned_channels &=3D ~BIT(channel); > + unassigned_channels &=3D ~BIT(channel); > hvs_new_state->fifo_state[channel].in_use =3D true; > } > =20 >=20 --=20 Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany (HRB 36809, AG N=C3=BCrnberg) Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6rffer --G9X4LYRXmU4IZQdRg06F3vjoA4wRm3WWo-- --8CsgVUlgHggoOS5UjO2qw1YdQd699lHX7 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEExndm/fpuMUdwYFFolh/E3EQov+AFAl/TRd4FAwAAAAAACgkQlh/E3EQov+Ad hg/+LwZ84Lwjy07PhFjbTd60a3jpQm1OvCVjP8AL55ES53f6oRzz+iNXT1IoAEK32Rb9CFY6btlB XhKHqQZKLoCw31BxrTKZUkmz2/3sSQYYhL3BlJxXOZXxtbvNk1pOJGeVsHw4knvqblqX4UCRhszV XDdVkRFX2zSaPGhUMFI6aj3ZFba9tdsxrtVuK2Hf3kAnvf8BZC3YXbiy9OBimLxtFcFBRb5IeUOt MvhShryE/QVDB3LeBWNngj1eC6AGqsFO2JOV0KxW/4KTER8kL4QYAORdHxgfokUVIHbYlKTC+9UN D2bcevLoZdyGjb0YTKxXed9RYP3AjBwnOrb3Ty9ej/1YXwiupacQ5dr+LUiCLLJ5UpsWZeEf/ogx ue0AsRavyy+3FnMxiiujN/JKmXOdjEuq7jMG3XsxmHhEaLaPKf52tFFtQlX2URIzwAQSS+HjuWus cx9OBRsPlySu7uZc5wxZDq2jviRVfkdfdskF3/98V6kMrDIGQkwabBza+zcOWTEaaWR8SZLsGknp QNU/eqirNq5Do9PjemK1MB5dgFtOjt4JhpaDLyKD5NtcY8vsabK2htqfjhKFFvtEMyE2Bil8ipOH uG5u87hxTbkz3d3yVN2uYFNU6m7ZScpVsem9yYetsyEsFZoCMjh+zqMHfLSx4nSbZ5vzEVerYjou 2Z0= =9P8q -----END PGP SIGNATURE----- --8CsgVUlgHggoOS5UjO2qw1YdQd699lHX7-- --===============7540315496356311080== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7540315496356311080==--