From: Tomi Valkeinen Subject: Re: [PATCH] drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled Date: Mon, 13 Mar 2017 10:29:11 +0200 Message-ID: References: <1489253107-20438-1-git-send-email-jsarha@ti.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1157745380==" Return-path: Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BD5C6E355 for ; Mon, 13 Mar 2017 08:29:18 +0000 (UTC) In-Reply-To: <1489253107-20438-1-git-send-email-jsarha@ti.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Jyri Sarha , dri-devel@lists.freedesktop.org, bgolaszewski@baylibre.com Cc: laurent.pinchart@ideasonboard.com List-Id: dri-devel@lists.freedesktop.org --===============1157745380== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="auAp3oBc3S7g4skf25JuhXhU5rwoKA8n4" --auAp3oBc3S7g4skf25JuhXhU5rwoKA8n4 Content-Type: multipart/mixed; boundary="W1CpwT3H1WEgWtVo7tCRH0SBDsgUTLCSs"; protected-headers="v1" From: Tomi Valkeinen To: Jyri Sarha , dri-devel@lists.freedesktop.org, bgolaszewski@baylibre.com Cc: airlied@linux.ie, daniel@ffwll.ch, laurent.pinchart@ideasonboard.com Message-ID: Subject: Re: [PATCH] drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled References: <1489253107-20438-1-git-send-email-jsarha@ti.com> In-Reply-To: <1489253107-20438-1-git-send-email-jsarha@ti.com> --W1CpwT3H1WEgWtVo7tCRH0SBDsgUTLCSs Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/03/17 19:25, Jyri Sarha wrote: > Touching HW while clocks are off is a serious error and for instance > breaks suspend functionality. After this patch tilcdc_crtc_update_fb() > always updates the primary plane's framebuffer pointer, increases fb's > reference count and stores vblank event. tilcdc_crtc_update_fb() only > writes the fb's DMA address to HW if the crtc is enabled, as > tilcdc_crtc_enable() takes care of writing the address on enable. >=20 > This patch also refactors the tilcdc_crtc_update_fb() a bit. Number of > subsequent small changes to had made it almost unreadable. There Something is missing from the line above... > should be no other functional changes but checking the CRTC's enable > state. However, the locking goes a bit differently and some of the > redundant checks have been removed in this new version. >=20 > The enable_lock should be enough to protect the access to > tilcdc_crtc->enabled. The irq_lock protects the access to last_vblank > and next_fb. The check for vrefresh and last_vblank being valid is > redundant, as the vrefresh should be always valid if the CRTC is > enabled and now last_vblank should be too, because it is initialized > to current time when CRTC raster is enabled. If for some reason the > values are not corretly initialized the division by zero waning is 2 typoes above. > quite appropriate. >=20 > Signed-off-by: Jyri Sarha > --- > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 37 +++++++++++++++++++++++-----= -------- > 1 file changed, 24 insertions(+), 13 deletions(-) >=20 > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/til= cdc/tilcdc_crtc.c > index f80bf93..bd92c89 100644 > --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c > +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c > @@ -1,4 +1,4 @@ > -/* > +* This breaks the compilation of the whole driver... Tomi --W1CpwT3H1WEgWtVo7tCRH0SBDsgUTLCSs-- --auAp3oBc3S7g4skf25JuhXhU5rwoKA8n4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYxlhXAAoJEPo9qoy8lh714QAQAIDkCqYiPP17FbXYvV+ocdY3 ovmBXX8R2BOx4DBIx2FzBU35i3uTNYBKLihMZ8lsbUvh2MswSProiyFPbslGCO+Y /1SDiiD87Ee1te2wG4Or3beYoEDJMDK3JObuYIkhCzenAMU9kpAN4MRZ+mP4xvrh keYedPHSJcGfAJYGmZPHwqLCb+TRTE/rdBPzr1xmKPnt6bIYnjiqlPE28HA0vpte bs8Erg8rJhgCmX0pwYX30NOBHjQFaWyQFjw34onTOhxgEjSdCNXNUavFBcvtmdsd 2UuUYWjJZQo+4CKCJraG9EFoH/YtRbJc4md1jLhMQrH2r7pPFfz72q6K/yyxQbvx oeBdIJNw+MxyyHk/lwZ/MO51EJpZDjMHE/vmp20uBpxMdpxiqpDBjBM+fmxN+PEY MCk5JVxHxqY3xYEJEzELmz1iJEQCQYGicpScEwEqSa6uK4sDZwUv3ARRwa3reHK4 xEmx7pXrBA1G1ZOzwjqTkWzqN0jzrieP6iTtdUz2BwstIXATkJZsn9JI8Gm+65/X mA6d023YljnDNxR9fM+JGlIAox3iDIUHvOkp4x3X4k4grym7rSIqF0ptpXugmkEO iAP2jN06s1LkB5QYId/X5UdKpVidwGwoyul+sG/bkMa/xTnznEd+zJbuwXsiROhN /fj2CT2vLEo+4MT0R4cJ =A0O8 -----END PGP SIGNATURE----- --auAp3oBc3S7g4skf25JuhXhU5rwoKA8n4-- --===============1157745380== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1157745380==--