From: "Souza, Jose" Subject: Re: [PATCH v5 8/9] drm/i915: Force PSR exit when getting pipe CRC Date: Thu, 7 Mar 2019 23:46:36 +0000 Message-ID: References: <20190306064728.8234-1-jose.souza@intel.com> <20190306064728.8234-8-jose.souza@intel.com> <6cd70d243fc064614da94f838e04e08d2325cf2c.camel@intel.com> <3ef74586d2c40e8972bc8d9ecac86df33df630a2.camel@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1991988065==" Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id F0B2D6E24A for ; Thu, 7 Mar 2019 23:46:38 +0000 (UTC) In-Reply-To: <3ef74586d2c40e8972bc8d9ecac86df33df630a2.camel@intel.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" , "Pandiyan, Dhinakaran" List-Id: intel-gfx@lists.freedesktop.org --===============1991988065== Content-Language: en-US Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-GtoZpExRHp335ECUUbFS" --=-GtoZpExRHp335ECUUbFS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2019-03-07 at 14:30 -0800, Dhinakaran Pandiyan wrote: > On Thu, 2019-03-07 at 13:57 -0800, Souza, Jose wrote: > > On Thu, 2019-03-07 at 13:25 -0800, Dhinakaran Pandiyan wrote: > > > On Tue, 2019-03-05 at 22:47 -0800, Jos=C3=A9 Roberto de Souza wrote: > > > > If PSR is active when pipe CRC is enabled the CRC calculations > > > > will > > > > be inhibit by the transition to low power states that PSR > > > > brings. > > >=20 > > > The MMIO write to enable CRCs should bring the hardware out from > > > PSR, > > > but I can imagine some initial CRCs are going to be corrupt or > > > unavailable. > >=20 > > That do not happen, if PSR is active and CRC is configured PSR will > > remain active and no CRC will be calculated. >=20 > Odd, MMIO writes should trigger DC6 exit, which always results in PSR > exit. If the hardware isnt't in DC6, then I can imagine CRC enabling > not causing a PSR exit.=20 > > > > So lets for a PSR exit and as soon as pipe CRC is enabled it > > > > will > > >=20 > > > There is a missing word. > >=20 > > Thanks > >=20 > > "So lets force a PSR exit and as soon as pipe CRC is enabled it > > will > > block PSR activation and avoid CRC timeouts when running IGT > > tests." > >=20 > >=20 > > > > block PSR activation avoid CRC timeouts when running IGT tests. > > >=20 > > > This surely has fdo bugs, please include them in the commit > > > message. > >=20 > > I did this patch because of the regressions that I got from CI in > > my > > testings,=20 > Can you include the test name and platform in the commit message? Done >=20 > > the only bug that I found related is=20 > > https://bugs.freedesktop.org/show_bug.cgi?id=3D107814 but we don't > > have > > PSR enabled by default on HSW. >=20 > Jani S had reported the issue, Cc'ing him. As said the issue don't look related to this. >=20 > > > > Cc: Dhinakaran Pandiyan > > > > Cc: Ville Syrj=C3=A4l=C3=A4 > > > > Signed-off-by: Jos=C3=A9 Roberto de Souza > > > > --- > > > > drivers/gpu/drm/i915/intel_psr.c | 36 ++++++++++++++++++++---- > > > > ---- > > > > ---- > > > > 1 file changed, 23 insertions(+), 13 deletions(-) > > > >=20 > > > > diff --git a/drivers/gpu/drm/i915/intel_psr.c > > > > b/drivers/gpu/drm/i915/intel_psr.c > > > > index d3e3996551c6..5d66e7313c75 100644 > > > > --- a/drivers/gpu/drm/i915/intel_psr.c > > > > +++ b/drivers/gpu/drm/i915/intel_psr.c > > > > @@ -452,6 +452,7 @@ static void hsw_activate_psr1(struct > > > > intel_dp > > > > *intel_dp) > > > > * frames, we'll go with 9 frames for now > > > > */ > > > > idle_frames =3D max(idle_frames, dev_priv- > > > > >psr.sink_sync_latency > > > > + 1); > > > > + > > > > val |=3D idle_frames << EDP_PSR_IDLE_FRAME_SHIFT; > > > > =20 > > > > val |=3D max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; > > > > @@ -851,6 +852,20 @@ void intel_psr_disable(struct intel_dp > > > > *intel_dp, > > > > cancel_work_sync(&dev_priv->psr.work); > > > > } > > > > =20 > > > > +static void psr_force_hw_tracking_exit(struct drm_i915_private > > > > *dev_priv) > > > > +{ > > > > + /* > > > > + * Display WA #0884: all > > > > + * This documented WA for bxt can be safely applied > > > > + * broadly so we can force HW tracking to exit PSR > > > > + * instead of disabling and re-enabling. > > > > + * Workaround tells us to write 0 to CUR_SURFLIVE_A, > > > > + * but it makes more sense write to the current active > > > > + * pipe. > > > > + */ > > > > + I915_WRITE(CURSURFLIVE(dev_priv->psr.pipe), 0); > > > > +} > > > > + > > > > /** > > > > * intel_psr_update - Update PSR state > > > > * @intel_dp: Intel DP > > > > @@ -875,8 +890,13 @@ void intel_psr_update(struct intel_dp > > > > *intel_dp, > > > > enable =3D crtc_state->has_psr && psr_global_enabled(psr- > > > > >debug); > > > > psr2_enable =3D intel_psr2_enabled(dev_priv, crtc_state); > > > > =20 > > > > - if (enable =3D=3D psr->enabled && psr2_enable =3D=3D psr- > > > > >psr2_enabled) > > > > + if (enable =3D=3D psr->enabled && psr2_enable =3D=3D psr- > > > > > psr2_enabled)=20 > > > >=20 > > > > { > > >=20 > > > PSR2 is enabled, then user requests CRCs, the mode_changed commit > > > switches to PSR1. The above condition isn't true in that case. > >=20 > > Not sure if I understood the question but if PSR2 is enabled and > > user > > request CRC it will switch to PSR1 already forcing a PSR exit so we > > don't need to call psr_force_hw_tracking_exit() in this case. > The PSR2->PSR1 switching gives us the same window before CRC enabling > as force_hw_tracking_exit(). My question was about if that window is > sufficient. > > > Also, since the CRC workaround is done before enabling pipe CRC, > > > isn't > > > there a possibility that the idle frame counter times out and > > > activates > > > PSR1 before CRC is enabled? > >=20 > > There still the possibility since syscalls can be preempted too but > > this is a huge improvement over current scenario, now it will give > > at > > least the time of 6 idle frames between > > intel_crtc_crc_setup_workarounds() and the I915_WRITE() to the PIPE > > CRC > > registers and it happens right after > > intel_crtc_crc_setup_workarounds() > > returns. >=20 > Yeah, it should be okay. Please document in the commit message the > idea > is that we rely on the idle frame counter to have not expired before > CRC is enabled and we are only kicking the hardware out of PSR1. > Since > what this patch does is different from what psr_exit() implements, I > think it makes sense to clarify what exit means. >=20 > With the commit message fixed, this looks okay to me but let's see if > the timeouts go away. Done, thanks. >=20 > Reviewed-by: Dhinakaran Pandiyan >=20 > > > > + /* Force a PSR exit when enabling CRC to avoid > > > > CRC > > > > timeouts */ > > > > + if (crtc_state->crc_enabled && psr->enabled) > > > > + psr_force_hw_tracking_exit(dev_priv); > > >=20 > > > The patch fixes a PSR1 issue, why isn't there any reference to > > > PSR1 > > > anywhere? > >=20 > > fair, going to update the commit message. > >=20 > > >=20 > > > > + > > > > goto unlock; > > > > + } > > > > =20 > > > > if (psr->enabled) > > > > intel_psr_disable_locked(intel_dp); > > > > @@ -1146,18 +1166,8 @@ void intel_psr_flush(struct > > > > drm_i915_private > > > > *dev_priv, > > > > dev_priv->psr.busy_frontbuffer_bits &=3D > > > > ~frontbuffer_bits; > > > > =20 > > > > /* By definition flush =3D invalidate + flush */ > > > > - if (frontbuffer_bits) { > > > > - /* > > > > - * Display WA #0884: all > > > > - * This documented WA for bxt can be safely > > > > applied > > > > - * broadly so we can force HW tracking to exit > > > > PSR > > > > - * instead of disabling and re-enabling. > > > > - * Workaround tells us to write 0 to > > > > CUR_SURFLIVE_A, > > > > - * but it makes more sense write to the current > > > > active > > > > - * pipe. > > > > - */ > > > > - I915_WRITE(CURSURFLIVE(dev_priv->psr.pipe), 0); > > > > - } > > > > + if (frontbuffer_bits) > > > > + psr_force_hw_tracking_exit(dev_priv); > > > > =20 > > > > if (!dev_priv->psr.active && !dev_priv- > > > > > psr.busy_frontbuffer_bits) > > > >=20 > > > > schedule_work(&dev_priv->psr.work); --=-GtoZpExRHp335ECUUbFS 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/mOWkkFAlyBrVoACgkQVenbO/mO WkkDbgf/aVuD2cIdNH2jc+QjPRIS8Lv9LIIg4aAFiYY9h2qErvoqIlKFstetGwIp n158DS+idmG0v/uD0iep7qUX21oSEMrKoAqD0Ss5gBjIP0fLPQqWko2u61V30msq okJkByshZHyn/cx1WJNln7ynD7cVSB6CECyy1Tq2EhOmStjPd9nBm4sknemvCDpJ WHsVCvz2NqtzRz2st/U7ij4WoznDC+rIqpvz8dEJBVWyh6YHKAhVqZDOU0sOg9EY YzMf12atGsCZh/kOj0PFUFh8yg+zO8//WwxPRWOjekLHTogyYvvOsKHOAAcRkjPt jcYLtsteIEvKKoGqzHzpAJ5brAkdPw== =qhc5 -----END PGP SIGNATURE----- --=-GtoZpExRHp335ECUUbFS-- --===============1991988065== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============1991988065==--