From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Farnsworth Subject: Re: [PATCH 04/12] drm: Add support for alternate clocks of 4k modes Date: Wed, 14 Aug 2013 10:33:09 +0100 Message-ID: <3226662.4VVUcXLonY@f17simon> References: <1376435848-14584-1-git-send-email-damien.lespiau@intel.com> <1376435848-14584-5-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0878284243==" Return-path: In-Reply-To: <1376435848-14584-5-git-send-email-damien.lespiau@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0878284243== Content-Type: multipart/signed; boundary="nextPart1438393.8QNH8klo04"; micalg="pgp-sha1"; protocol="application/pgp-signature" --nextPart1438393.8QNH8klo04 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" A few minor things: On Wednesday 14 August 2013 00:17:20 Damien Lespiau wrote: > Suggested-by: Ville Syrj=E4l=E4 > Signed-off-by: Damien Lespiau > --- > drivers/gpu/drm/drm_edid.c | 68 ++++++++++++++++++++++++++++++++++++= ++++++---- > 1 file changed, 62 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 0faa08e..606335f 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -2409,6 +2409,54 @@ u8 drm_match_cea_mode(const struct drm_display= _mode *to_match) > } > EXPORT_SYMBOL(drm_match_cea_mode); > =20 > +/* > + * Calculate the alternate clock for HDMI modes (those from the HDMI= vendor > + * specific block). > + * > + * It's almost like cea_mode_alternate_clock(), we just need to add = an > + * exception for the VIC 4 mode (4096x2160@24Hz): no alternate clock= for this > + * one. > + */ > +static unsigned int > +hdmi_mode_alternate_clock(const struct drm_display_mode *hdmi_mode) > +{ > +=09if (hdmi_mode->vdisplay =3D=3D 4096 && hdmi_mode->hdisplay =3D=3D= 2160) > +=09=09return hdmi_mode->clock; > + > +=09return cea_mode_alternate_clock(hdmi_mode); > +} > + > +/* > + * drm_match_cea_mode - look for a HDMI mode matching given mode Here we document drm_match_cea_mode, but the function is drm_match_hdmi= _mode. > + * @to_match: display mode > + * > + * An HDMI mode is one defined in the HDMI vendor specific block. > + * > + * Returns the HDMI Video ID (VIC) of the mode or 0 if it isn't one.= > + */ > +static u8 drm_match_hmdi_mode(const struct drm_display_mode *to_matc= h) ^^^^ Surely should be hdmi, not hmdi? > +{ > +=09u8 mode; > + > +=09if (!to_match->clock) > +=09=09return 0; > + > +=09for (mode =3D 0; mode < ARRAY_SIZE(edid_4k_modes); mode++) { > +=09=09const struct drm_display_mode *hdmi_mode =3D &edid_4k_modes[mo= de]; > +=09=09unsigned int clock1, clock2; > + > +=09=09/* Make sure to also match alternate clocks */ > +=09=09clock1 =3D hdmi_mode->clock; > +=09=09clock2 =3D hdmi_mode_alternate_clock(hdmi_mode); > + > +=09=09if ((KHZ2PICOS(to_match->clock) =3D=3D KHZ2PICOS(clock1) || > +=09=09 KHZ2PICOS(to_match->clock) =3D=3D KHZ2PICOS(clock2)) && > +=09=09 drm_mode_equal_no_clocks(to_match, hdmi_mode)) > +=09=09=09return mode + 1; > +=09} > +=09return 0; > +} > + > static int > add_alternate_cea_modes(struct drm_connector *connector, struct edid= *edid) > { > @@ -2426,18 +2474,26 @@ add_alternate_cea_modes(struct drm_connector = *connector, struct edid *edid) > =09 * with the alternate clock for certain CEA modes. > =09 */ > =09list_for_each_entry(mode, &connector->probed_modes, head) { > -=09=09const struct drm_display_mode *cea_mode; > +=09=09const struct drm_display_mode *cea_mode =3D NULL; > =09=09struct drm_display_mode *newmode; > -=09=09u8 cea_mode_idx =3D drm_match_cea_mode(mode) - 1; > +=09=09u8 mode_idx =3D drm_match_cea_mode(mode) - 1; > =09=09unsigned int clock1, clock2; > =20 > -=09=09if (cea_mode_idx >=3D ARRAY_SIZE(edid_cea_modes)) > -=09=09=09continue; > +=09=09if (mode_idx < ARRAY_SIZE(edid_cea_modes)) { > +=09=09=09cea_mode =3D &edid_cea_modes[mode_idx]; > +=09=09=09clock2 =3D cea_mode_alternate_clock(cea_mode); > +=09=09} else { > +=09=09=09mode_idx =3D drm_match_hmdi_mode(mode) - 1; ^^^^ Same typo here - hmdi for hdmi. > +=09=09=09if (mode_idx < ARRAY_SIZE(edid_4k_modes)) { > +=09=09=09=09cea_mode =3D &edid_4k_modes[mode_idx]; > +=09=09=09=09clock2 =3D hdmi_mode_alternate_clock(cea_mode); > +=09=09=09} > +=09=09} > =20 > -=09=09cea_mode =3D &edid_cea_modes[cea_mode_idx]; > +=09=09if (!cea_mode) > +=09=09=09continue; > =20 > =09=09clock1 =3D cea_mode->clock; > -=09=09clock2 =3D cea_mode_alternate_clock(cea_mode); > =20 > =09=09if (clock1 =3D=3D clock2) > =09=09=09continue; >=20 --=20 Simon Farnsworth Software Engineer ONELAN Ltd http://www.onelan.com --nextPart1438393.8QNH8klo04 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQEcBAABAgAGBQJSC07VAAoJELb1E1yQPsc0b+QH/3MMZ4v0Y5F00PI20R253r9C ITmR8T05RyhVv2VmZ9mGSw/YS9nBLqG1rVfglwG2HB/wvTc5NJf4wmhwQLzCaCdI aDT90QfUix7UYkhjQdMZ9XGUyNK7vt0M09KLK0vXy6YsQ4moUs4lNuAzNELFtMaQ Q/evTiIqDCk2/xC7ruXAj9x4cBMsFkeBOKx/bpbH2nAIJB0mtVp3K1WaZUnvSsPI tV3H2ZjItp0dEmhlRASD42bePNJr+OiSWAJACbolxITtUAyStF4Z1BCQCPkwIqB+ vw6NGqsl9FBZcM9jiN/MQ52zoBgbB7CpUgWncXnvCQSgnfqAUHkD4fbVb1Q8rXc= =65kp -----END PGP SIGNATURE----- --nextPart1438393.8QNH8klo04-- --===============0878284243== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0878284243==--