Return-Path: Received: from mail.windriver.com ([147.11.1.11]:37376 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbdJLJve (ORCPT ); Thu, 12 Oct 2017 05:51:34 -0400 Date: Thu, 12 Oct 2017 17:53:16 +0800 From: Kevin Hao To: Jyri Sarha CC: , , , , Subject: Re: [PATCH] drm/tilcdc: Force recalculation of vrefresh in tilcdc_crtc_set_mode() Message-ID: <20171012095316.GA18038@pek-khao-d1> References: <1507801165-21285-1-git-send-email-jsarha@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline In-Reply-To: <1507801165-21285-1-git-send-email-jsarha@ti.com> Sender: stable-owner@vger.kernel.org List-ID: --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 12, 2017 at 12:39:25PM +0300, Jyri Sarha wrote: > We are using the vrefresh to check if we are too close to vertical > sync to update the two framebuffer DMA registers and risk a > collision. The vrefresh is coming from user space and normally it is > not used for anything. For instance xserver leaves vrefresh to zero > causing a division by zero when setting the mode. We want to make sure > the value is valid and force its recalculation in > tilcdc_crtc_set_mode(). >=20 > Reported-by: Kevin Hao > Fixes: 11abbc9f39e0 ("drm/tilcdc: Set framebuffer DMA address to HW only = if CRTC is enabled") > Cc: # v4.11+ > Signed-off-by: Jyri Sarha > --- > drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcd= c/tilcdc_crtc.c > index 704db24..aa5e87c 100644 > --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c > +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c > @@ -459,6 +459,16 @@ static void tilcdc_crtc_set_mode(struct drm_crtc *cr= tc) > drm_framebuffer_get(fb); > =20 > crtc->hwmode =3D crtc->state->adjusted_mode; > + > + /* We are using the vrefresh to check if we are too close to > + * vertical sync to update the two framebuffer DMA registers > + * and risk a collision. The vrefresh is coming from user > + * space and normally it is not used for anything. We want to > + * make sure the value is valid and force its recalculation > + * here. > + */ > + crtc->hwmode.vrefresh =3D 0; Why do we need this? Thanks, Kevin > + crtc->hwmode.vrefresh =3D drm_mode_vrefresh(&crtc->hwmode); > } > =20 > static void tilcdc_crtc_enable(struct drm_crtc *crtc) > --=20 > 1.9.1 >=20 >=20 > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/= Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki >=20 >=20 --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJZ3zuMAAoJEJNY7TDerrFxteUIAKi0t9O97lu8Ffm/oaJ8K+AC TslMiLB30hT8Cia/AykoXzst2mLEAQj5MX84VJoSffV6N7h9ep2hitwQqx0yU7O5 WScVl8f+lH98F140xsMzTq4aiNo/hfVi9UBXfm00JmWse3NjVJ946sj4wxugtPvk eyaWLH0QpTwLCtxQoWX6fWtVv02tnUo3ZeQQwAEp1r30/FQOInOuMiTvy64IeZ7J awvuqdLBdC72Wr1WI2UMwi/RUZTSZcO7aH0feha6MjilFCEFxYCit2WrLGmMzC+8 8cIMqhYP4eqUYdizbMPClI+IjRt/N4y40Ckd2pSN8dz3Zxev59T+OmTrKgu8Bug= =FpZK -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO--