From: Tomi Valkeinen Subject: Re: [PATCH v2] drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled Date: Tue, 14 Mar 2017 11:58:59 +0200 Message-ID: <1925c3f3-c330-6f42-edb2-efb3512fbc12@ti.com> References: <1489397370-7640-1-git-send-email-jsarha@ti.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0973530590==" Return-path: Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF9086E6D9 for ; Tue, 14 Mar 2017 09:59:08 +0000 (UTC) In-Reply-To: <1489397370-7640-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: khilman@baylibre.com, laurent.pinchart@ideasonboard.com List-Id: dri-devel@lists.freedesktop.org --===============0973530590== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K5AxA6qIXQqR7gxCKuQFJdmHHRJpD5aBK" --K5AxA6qIXQqR7gxCKuQFJdmHHRJpD5aBK Content-Type: multipart/mixed; boundary="mtlIQKJOaupB9iobG2ncpoEl5rMNAkPf0"; 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, robdclark@gmail.com, khilman@baylibre.com Message-ID: <1925c3f3-c330-6f42-edb2-efb3512fbc12@ti.com> Subject: Re: [PATCH v2] drm/tilcdc: Set framebuffer DMA address to HW only if CRTC is enabled References: <1489397370-7640-1-git-send-email-jsarha@ti.com> In-Reply-To: <1489397370-7640-1-git-send-email-jsarha@ti.com> --mtlIQKJOaupB9iobG2ncpoEl5rMNAkPf0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 13/03/17 11:29, 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 had made it almost unreadable. There 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 correctly initialized the division by zero warning is > quite appropriate. >=20 > Signed-off-by: Jyri Sarha > --- > Since first version: > - Restored the accidentally removed comment begin mark to beginning o= f file > - Fixed two typos and one broken sentence, pointed out by Tomi Valkei= nen >=20 > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 35 +++++++++++++++++++++++-----= ------- > 1 file changed, 23 insertions(+), 12 deletions(-) Reviewed-by: Tomi Valkeinen Tomi --mtlIQKJOaupB9iobG2ncpoEl5rMNAkPf0-- --K5AxA6qIXQqR7gxCKuQFJdmHHRJpD5aBK 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 iQIcBAEBCAAGBQJYx77jAAoJEPo9qoy8lh71QrEP/2uUR0rjByFicDI+ERn8ofrH vby4ceGcc4/zpTNxRFg3Eh+eELHzwcZI0VpStSqGL+M41Cyf6rxZCNMtQ+cJ9p9I xYZwdNFtFpdwnhRbGSZCn9sI0+mUX4tI9p9UL+5RkzpTACE1URT1+lGyUJ92qWqp Td9lmIIdOlg0QTfSGzMAshVXn0wwjYDgOW7KPprEysJ2AzH4mqBKlVrxJX7pFNqa fimuG5mhNwQshmq5AlqRmB7qeIQUk6KYSqiuPCKepceDLyLi7JQtnAbvwsBDLArA uQPdBvvCFZegmImlS+KUs57UIvTLcY90uCODwjqd6zF7lQuYfHRdsI0NrQzuoSKa tz0QKcoXTJfkP/MgFoPPFQZvf/z3qswXuzyN/s9E30nasgawS6+fmWt2QrLa6gYL L7LHa75Wq6/A3rK6wZ0PqpuZRYd/ePh5ViX+hgYluCybc/wbNTq1lxZDrFFbluym QO7m8+96wXGDRKZafNMgH2HJEgVJfbx3lta1PSaVI4OGzG15VlJdiY89+RcJdN4O Yz2JhEZuQ43TWs609CBZc6GtdoEBHx01vZAr4rCI6iVAay6g/ynvldZYlYSEYG4U zT2zD3L+4PUbhW7TelocvggY9tVlzugn9z3VfWY1PYJiPJoL6lfFhLwk48V/TnfB wPmzt2DBGlZCqpheFh4m =igMm -----END PGP SIGNATURE----- --K5AxA6qIXQqR7gxCKuQFJdmHHRJpD5aBK-- --===============0973530590== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0973530590==--