From: "Souza, Jose" Subject: Re: [PATCH 2/4] drm/i915: Disable PSR2 while getting pipe CRC Date: Mon, 25 Feb 2019 21:30:12 +0000 Message-ID: References: <20190214020206.26046-1-jose.souza@intel.com> <20190214020206.26046-2-jose.souza@intel.com> <43c7c58683d343eee195123b48d73f8916cb4f63.camel@intel.com> <9f2bd27a040f9b056eefd687286b1e4edaa3b326.camel@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1321421248==" Return-path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4190A89B98 for ; Mon, 25 Feb 2019 21:30:18 +0000 (UTC) In-Reply-To: <9f2bd27a040f9b056eefd687286b1e4edaa3b326.camel@gmail.com> 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: "intel-gfx@lists.freedesktop.org" , "dhinakaran.pandiyan@gmail.com" List-Id: intel-gfx@lists.freedesktop.org --===============1321421248== Content-Language: en-US Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-dGAM6u7xJ8BJMH2f7lcN" --=-dGAM6u7xJ8BJMH2f7lcN Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2019-02-22 at 22:14 -0800, Dhinakaran Pandiyan wrote: > On Sat, 2019-02-23 at 02:48 +0000, Souza, Jose wrote: > > On Fri, 2019-02-22 at 18:13 -0800, Dhinakaran Pandiyan wrote: > > > On Wed, 2019-02-13 at 18:02 -0800, Jos=C3=A9 Roberto de Souza wrote: > > > > As stated in CRC_CTL spec, after PSR entry state CRC will not > > > > be > > > > calculated anymore what is not a problem as IGT tests do some > > > > screen > > > > change and then request the pipe CRC right after the change so > > > > PSR > > > > will go to idle state and only will entry again after at least > > > > 6 > > > > idles frames. > > > >=20 > > > > But for PSR2 it is more problematic as any change to the screen > > > > could > > > > trigger a selective/partial update causing the CRC value not to > > > > be > > > > calculated over the full frame. > > > >=20 > > > > So here it disables PSR2 and keep it disabled while user is > > > > requesting pipe CRC. > > > >=20 > > > > BSpec: 7536 > > > >=20 > > > > Cc: Dhinakaran Pandiyan > > > > Cc: Ville Syrj=C3=A4l=C3=A4 > > > > Signed-off-by: Jos=C3=A9 Roberto de Souza > > > > --- > > > > drivers/gpu/drm/i915/i915_drv.h | 1 + > > > > drivers/gpu/drm/i915/intel_drv.h | 1 + > > > > drivers/gpu/drm/i915/intel_pipe_crc.c | 10 ++++++++++ > > > > drivers/gpu/drm/i915/intel_psr.c | 23 > > > > +++++++++++++++++++++++ > > > > 4 files changed, 35 insertions(+) > > > >=20 > > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h > > > > b/drivers/gpu/drm/i915/i915_drv.h > > > > index 17fe942eaafa..609e9c5bd453 100644 > > > > --- a/drivers/gpu/drm/i915/i915_drv.h > > > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > > > @@ -520,6 +520,7 @@ struct i915_psr { > > > > bool sink_not_reliable; > > > > bool irq_aux_error; > > > > u16 su_x_granularity; > > > > + bool pipe_crc_enabled; > > > > }; > > > > =20 > > > > enum intel_pch { > > > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > > > > b/drivers/gpu/drm/i915/intel_drv.h > > > > index 3398b28c053b..40ce7a600585 100644 > > > > --- a/drivers/gpu/drm/i915/intel_drv.h > > > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > > > @@ -2103,6 +2103,7 @@ void intel_psr_short_pulse(struct > > > > intel_dp > > > > *intel_dp); > > > > int intel_psr_wait_for_idle(const struct intel_crtc_state > > > > *new_crtc_state, > > > > u32 *out_value); > > > > bool intel_psr_enabled(struct intel_dp *intel_dp); > > > > +void intel_psr_crc_prepare_or_finish(struct drm_i915_private > > > > *dev_priv, enum pipe pipe, bool prepare); > > > > =20 > > > > /* intel_quirks.c */ > > > > void intel_init_quirks(struct drm_i915_private *dev_priv); > > > > diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c > > > > b/drivers/gpu/drm/i915/intel_pipe_crc.c > > > > index a8554dc4f196..5d8772399f60 100644 > > > > --- a/drivers/gpu/drm/i915/intel_pipe_crc.c > > > > +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c > > > > @@ -583,6 +583,14 @@ int intel_crtc_verify_crc_source(struct > > > > drm_crtc > > > > *crtc, const char *source_name, > > > > return -EINVAL; > > > > } > > > > =20 > > > > +static inline void intel_crtc_crc_prepare_or_finish(struct > > > > drm_crtc > > > > *crtc, bool prepare) > > > > +{ > > > > + struct drm_i915_private *dev_priv =3D to_i915(crtc->dev); > > > > + struct intel_crtc *intel_crtc =3D to_intel_crtc(crtc); > > > > + > > > > + intel_psr_crc_prepare_or_finish(dev_priv, intel_crtc- > > > > >pipe, > > > > prepare); > > > > +} > > > > + > > > > int intel_crtc_set_crc_source(struct drm_crtc *crtc, const > > > > char > > > > *source_name) > > > > { > > > > struct drm_i915_private *dev_priv =3D to_i915(crtc->dev); > > > > @@ -609,6 +617,8 @@ int intel_crtc_set_crc_source(struct > > > > drm_crtc > > > > *crtc, const char *source_name) > > > > if (ret !=3D 0) > > > > goto out; > > > > =20 > > > > + intel_crtc_crc_prepare_or_finish(crtc, source !=3D > > > > INTEL_PIPE_CRC_SOURCE_NONE); > > > > + > > > > pipe_crc->source =3D source; > > > > I915_WRITE(PIPE_CRC_CTL(crtc->index), val); > > > > POSTING_READ(PIPE_CRC_CTL(crtc->index)); > > > > diff --git a/drivers/gpu/drm/i915/intel_psr.c > > > > b/drivers/gpu/drm/i915/intel_psr.c > > > > index 08967836b48e..9c93138988aa 100644 > > > > --- a/drivers/gpu/drm/i915/intel_psr.c > > > > +++ b/drivers/gpu/drm/i915/intel_psr.c > > > > @@ -577,6 +577,9 @@ static bool intel_psr2_config_valid(struct > > > > intel_dp *intel_dp, > > > > return false; > > > > } > > > > =20 > > > > + if (dev_priv->psr.pipe_crc_enabled) > > > > + return false; > > > > + > > >=20 > > > Disabling PSR instead of switching to PSR1 is safer considering > > > the > > > past bug reports with PSR1. > >=20 > > I thought about that but it would break every PSR subtest in > > kms_frontbuffer_tracking, I guess is better start by disabling PSR2 > > and > > then discuss about PSR1 if decided to disable, we need to remove > > PSR1 > > from kms_frontbuffer_tracking first. >=20 > I see.=20 > > > =20 > > > > return true; > > > > } > > > > =20 > > > > @@ -1291,3 +1294,23 @@ bool intel_psr_enabled(struct intel_dp > > > > *intel_dp) > > > > =20 > > > > return ret; > > > > } > > > > + > > > > +void intel_psr_crc_prepare_or_finish(struct drm_i915_private > > > > *dev_priv, enum pipe pipe, bool prepare) > > > > +{ > > > > + bool fastset =3D false; > > > > + > > > > + if (!CAN_PSR(dev_priv)) > > > > + return; > > > > + > > > > + mutex_lock(&dev_priv->psr.lock); > > > > + > > > > + if (dev_priv->psr.pipe =3D=3D pipe) { > > > > + dev_priv->psr.pipe_crc_enabled =3D prepare; > > >=20 > > > .crc_enabled seems like it belongs in crtc_state rather than in > > > the > > > global atomic state. > > >=20 > > > Looks like we could rename and re-purpose > > > crtc_state.ips_force_disable > > > for this. I don't see that flag being used for anything other > > > working > > > around CRC issues. > > >=20 > >=20 > > My understanging is that we should not update crtc_state or any > > other > > state outside of atomic_check() call chain, if that is not true I > > will > > rename and reuse ips_force_disable. >=20 > I don't see it being any different from modifying=20 > crtc_state->mode_changed to do a fastset. Besides that, all that > needs > to be done is rename the flag and shuffle the code a bit. Ooh okay, I was thiking that you wanted to set it as psr.pipe_crc_enabled is set in this patch, okay I will do the shuffling and send other version. Thanks for the review. >=20 > > > > + fastset =3D !prepare || dev_priv- > > > > >psr.psr2_enabled; > > > > + } > > > > + > > > > + mutex_unlock(&dev_priv->psr.lock); > > > > + > > > > + if (fastset) > > > > + intel_psr_fastset_force(dev_priv); > > > > +} > >=20 > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx --=-dGAM6u7xJ8BJMH2f7lcN 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/mOWkkFAlx0XloACgkQVenbO/mO Wkl09gf+KEGZRmMa5N767gl8DWIUeGzkrsV95uMwnNt5LWS82s2yfUl+5W5/zdNn OqLY3sbj2ma+J8RZv1ooIFmXaDbiFH8hXmoUKCR/W5L3e753fHhfduulIGo8+Er7 kX/NJQAZoqQ0lEy3ZhNWvnzKgaWX7Hsv4sE5Pz+FZSt64+FM7w3tM0nr8XHVQnLG wzhv8DHaTzD07tySTTZiLnGPzjj6uzkpkwikbwoiQ51AFPCV5E0OLgo2eAmTtzDq JOzXzHESPE9kjvZFr9+lh0kZir3Q4jqXqaSmKH+jr5ZazKIkYXyzvn2yo80ClXdG M/S4Q4+YOH266+XaTJwUw95dau8N4g== =vPxr -----END PGP SIGNATURE----- --=-dGAM6u7xJ8BJMH2f7lcN-- --===============1321421248== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============1321421248==--