From: "Souza, Jose" Subject: Re: [PATCH] drm/i915: Fix PSR2 selective update corruption after PSR1 setup Date: Tue, 12 Mar 2019 21:28:39 +0000 Message-ID: References: <20190312204217.31034-1-jose.souza@intel.com> <20190312205322.GY24277@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0746595193==" Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF11C89D5B for ; Tue, 12 Mar 2019 21:28:41 +0000 (UTC) In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "Vivi, Rodrigo" , "Pandiyan, Dhinakaran" Cc: "intel-gfx@lists.freedesktop.org" , "Runyan, Arthur J" , "Aigal, Pavana A" List-Id: intel-gfx@lists.freedesktop.org --===============0746595193== Content-Language: en-US Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-ONRaY1d6kNt67RREHvbj" --=-ONRaY1d6kNt67RREHvbj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2019-03-12 at 14:14 -0700, Dhinakaran Pandiyan wrote: > On Tue, 2019-03-12 at 13:53 -0700, Rodrigo Vivi wrote: > > On Tue, Mar 12, 2019 at 01:42:17PM -0700, Jos=C3=A9 Roberto de Souza > > wrote: > > > For some reason if the PSR1 EDP_PSR_TP1_TP3_SEL register is kept > > > set > > > while PSR2 is enabled, it causes some selective updates to fail > > > after > > > got back from DC6 for the first time. >=20 > That's suspicious, why does a PSR1 control register have any effect > on > PSR2. Was PSR1 enabled before PSR2?=20 Yes it only happens when switching from PSR1 -> PSR2, I caught this issue now because I had a external connector attached so display was never going to DC6. >=20 >=20 >=20 > > > So lets clear this register before enabled PSR2, as it could be > > > set > > > by a previous i915 module, firmware/BIOS or by a previous mode > > > that > > > is not compatible with PSR2. > >=20 > > Does it happen when you don't have DMC loaded? > >=20 > > Because It looks like a DMC bug for me... > >=20 > > If by removing DMC we don't see the issue, could we please file > > this bug to DMC while adding a FIXME with DMC bugged version on it? > >=20 > > Aa: Pavana > >=20 > > If it doesn't happen with DMC loaded than maybe a HSD would for hw > > team would be good anyway. > >=20 > > Cc: Art. > >=20 > > Thanks, > > Rodrigo. > >=20 > > > Cc: Dhinakaran Pandiyan > > > Cc: Rodrigo Vivi > > > Signed-off-by: Jos=C3=A9 Roberto de Souza > > > --- > > > drivers/gpu/drm/i915/intel_psr.c | 12 ++++++++++-- > > > 1 file changed, 10 insertions(+), 2 deletions(-) > > >=20 > > > diff --git a/drivers/gpu/drm/i915/intel_psr.c > > > b/drivers/gpu/drm/i915/intel_psr.c > > > index 7bab6a009e0d..ae62f8124558 100644 > > > --- a/drivers/gpu/drm/i915/intel_psr.c > > > +++ b/drivers/gpu/drm/i915/intel_psr.c > > > @@ -494,12 +494,20 @@ static void hsw_activate_psr2(struct > > > intel_dp > > > *intel_dp) > > > { > > > struct drm_i915_private *dev_priv =3D dp_to_i915(intel_dp); > > > u32 val; > > > + int idle_frames; > > > + > > > + /* > > > + * Keeping this PSR1 register set while PSR2 is enabled causes > > > some > > > + * PSR2 selective updates to fail, corrupting screen. > > > + */ > > > + val =3D I915_READ(EDP_PSR_CTL); > > > + if (val & EDP_PSR_TP1_TP3_SEL) > > > + I915_WRITE(EDP_PSR_CTL, val & ~EDP_PSR_TP1_TP3_SEL); >=20 > Since PSR1 should be disabled at this point, a rmw is not necessary. > Does this work?=20 > I915_WRITE(EDP_PSR_CTL, 0); >=20 > We could do the same thing in psr_exit() as well. Write 0 also works and I'm doing RMW because I always try to save any writes. No need to do it in psr_exit(), the important is do it here because other i915 module or BIOS could leave it set. >=20 > > > =20 > > > /* Let's use 6 as the minimum to cover all known cases > > > including the > > > * off-by-one issue that HW has in some cases. > > > */ > > > - int idle_frames =3D max(6, dev_priv->vbt.psr.idle_frames); > > > - > > > + idle_frames =3D max(6, dev_priv->vbt.psr.idle_frames); > > > idle_frames =3D max(idle_frames, dev_priv->psr.sink_sync_latency > > > + 1); > > > val =3D idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT; > > > =20 > > > --=20 > > > 2.21.0 > > >=20 --=-ONRaY1d6kNt67RREHvbj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEVNG051EijGa0MiaQVenbO/mOWkkFAlyIJIUACgkQVenbO/mO WkmJTQf/fzIAYd/0YxKLvlOKGJaCtN3yEBRdsvFFLbGBcDtlUlR4PBS8DN+m/0yl vvyLXzs7oqb7pjy6VV/VSmv3WVJD8i3Lbm5dmcKH8pNeXSj7Zp3wAl/ZMjlIGBV+ GJw0JWUldLceE0U0j35koyx9uV7qAWdGKL5mB7Zd9TzPUOCkaKi3RlE0hsti0+aD 773qlnExfj0i0IeIsvvkpG5u59ei0Qpr6NIejU11MhfNdv9RU9CZzn8BcrqC0cNi +H8AittyLMKeKlcsQ/sHpYekiMvGfDWgRHaQoszy6ROMKmuWQMoYwuEa09RKUxcw UppiKaVbEfijunn3wzexDROfVP33YA== =Asz+ -----END PGP SIGNATURE----- --=-ONRaY1d6kNt67RREHvbj-- --===============0746595193== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============0746595193==--