From: "Souza, Jose" Subject: Re: [PATCH 6/9] drm/i915/psr: Check if source supports sink specific SU granularity Date: Fri, 30 Nov 2018 00:00:05 +0000 Message-ID: <1fb5caeedbe91e889ff8b646e62c2d0738569b5f.camel@intel.com> References: <20181127003710.18618-1-jose.souza@intel.com> <20181127003710.18618-6-jose.souza@intel.com> <20181129230351.GR8630@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1953479257==" Return-path: In-Reply-To: <20181129230351.GR8630@intel.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: "Vivi, Rodrigo" Cc: "intel-gfx@lists.freedesktop.org" , "Pandiyan, Dhinakaran" , "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org --===============1953479257== Content-Language: en-US Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="=-DFcbiCdBGxgYaWfdXI+Z" --=-DFcbiCdBGxgYaWfdXI+Z Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2018-11-29 at 15:03 -0800, Rodrigo Vivi wrote: > On Mon, Nov 26, 2018 at 04:37:07PM -0800, Jos=C3=A9 Roberto de Souza > wrote: > > According to eDP spec, sink can required specific selective update > > granularity that source must comply. > > Here caching the value if required and checking source supports it. > >=20 > > Cc: Rodrigo Vivi > > Cc: Dhinakaran Pandiyan > > Signed-off-by: Jos=C3=A9 Roberto de Souza > > --- > > drivers/gpu/drm/i915/i915_drv.h | 1 + > > drivers/gpu/drm/i915/intel_psr.c | 32 > > ++++++++++++++++++++++++++++++++ > > 2 files changed, 33 insertions(+) > >=20 > > diff --git a/drivers/gpu/drm/i915/i915_drv.h > > b/drivers/gpu/drm/i915/i915_drv.h > > index f763b30f98d9..cbcd85af95bf 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.h > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > @@ -506,6 +506,7 @@ struct i915_psr { > > ktime_t last_exit; > > bool sink_not_reliable; > > bool irq_aux_error; > > + u16 su_x_granularity; > > }; > > =20 > > enum intel_pch { > > diff --git a/drivers/gpu/drm/i915/intel_psr.c > > b/drivers/gpu/drm/i915/intel_psr.c > > index 7607a58a6ec0..9215c9052381 100644 > > --- a/drivers/gpu/drm/i915/intel_psr.c > > +++ b/drivers/gpu/drm/i915/intel_psr.c > > @@ -257,6 +257,21 @@ static u8 > > intel_dp_get_sink_sync_latency(struct intel_dp *intel_dp) > > return val; > > } > > =20 > > +static u16 intel_dp_get_su_x_granulartiy(struct intel_dp > > *intel_dp) > > +{ > > + u16 val =3D 0; > > + ssize_t r; > > + > > + if (!(intel_dp->psr_dpcd[1] & DP_PSR2_SU_GRANULARITY_REQUIRED)) > > + return val; > > + > > + r =3D drm_dp_dpcd_read(&intel_dp->aux, DP_PSR2_SU_X_GRANULARITY, > > &val, 2); > > + if (r !=3D 2) > > + DRM_WARN("Unable to read DP_PSR2_SU_X_GRANULARITY\n"); > > + > > + return val; > > +} > > + > > void intel_psr_init_dpcd(struct intel_dp *intel_dp) > > { > > struct drm_i915_private *dev_priv =3D > > @@ -311,6 +326,8 @@ void intel_psr_init_dpcd(struct intel_dp > > *intel_dp) > > if (dev_priv->psr.sink_psr2_support) { > > dev_priv->psr.colorimetry_support =3D > > intel_dp_get_colorimetry_status(intel_d > > p); > > + dev_priv->psr.su_x_granularity =3D > > + intel_dp_get_su_x_granulartiy(intel_dp) > > ; > > } > > } > > } > > @@ -525,6 +542,21 @@ static bool intel_psr2_config_valid(struct > > intel_dp *intel_dp, > > return false; > > } > > =20 > > + if (dev_priv->psr.su_x_granularity) { > > + /* > > + * HW will always send full lines in SU blocks, so X > > will > > + * always be 0 and we only need to check the width to > > validate > > + * horizontal granularity. > > + * About vertical granularity HW works by SU blocks > > starting > > + * at each 4 lines with height of 4 lines, what eDP > > states > > + * that sink should support. > > + */ > > + if (crtc_hdisplay % dev_priv->psr.su_x_granularity) { > > + DRM_DEBUG_KMS("PSR2 not enabled, HW can not > > match sink SU granularity requirement\n"); > > + return false; >=20 > I wonder if regardless this bit we still need to do a sort of > check anyway because spec states: >=20 > " > Sets the grid pattern granularity in the X direction. > A value of 0 indicates that no X-coordinate granularity requirement > exists other than > the standard restrictions, wherein the: > =E2=80=A2 > Starting X-coordinate must be evenly divisible by 16 > =E2=80=A2 > Rectangle width must be evenly divisible by 4 > " Hum, the x will always be 0 so it will always be divisible by 16 but the width could not be divisible by 4 in the odd resolutions. I will add this check, thanks. >=20 > Also, why we are just checking X granularity and not Y? (0074h) >=20 > (maybe it would be useful to introduce along with previous patch > that I had just reviewed) It is in the comment above but coping from eDP spec: A value of 00h, 01h, 02h, or 04h should be supported by the Sink device to ensure interoperability with various Source devices. A value of 08h or 10h may be considered for system-specific implementations. Our height is multiple of 4 so we are safe even if sink have a y granularity set. >=20 > > + } > > + } > > + > > return true; > > } > > =20 > > --=20 > > 2.19.2 > >=20 --=-DFcbiCdBGxgYaWfdXI+Z 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/mOWkkFAlwAfYMACgkQVenbO/mO WkmYmggApgj3vYyVJuQy9eqrt/9feqQSRAvTD5pBqBYBIIizZ5b8XB2/uHDemPWx BBSMuUff6MG2atkpao5Cr1+1DL1+9KpYTSJkLzPyIVJkqcKymB4zjrgGcBfvcElM 07MatLbQpBXpyKsn2hB1JUxh+UorfBKMc9mHyKJdPnq5il642d6KLlx8FglucHZx +hxsXgLDpMYQeAY0em2p2/4iCmcDfkJ2+oNhZaHcofiXJqbulFAOL02RpYB+dIQL sl5gzIxPuhjsO3X+HZNwdeGK0cz8x90KYFTuUIrtz9FY/dKLreP+Uio3P6bqLEBL zhIEpWlI4jyR2B5Yvp5u9kDVTQ1/jw== =WVAp -----END PGP SIGNATURE----- --=-DFcbiCdBGxgYaWfdXI+Z-- --===============1953479257== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1953479257==--