From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Farnsworth Subject: Re: [PATCH 03/12] drm/edid: Parse the HDMI CEA block and look for 4k modes Date: Wed, 14 Aug 2013 10:32:51 +0100 Message-ID: <3743488.ljDhOqH5Y9@f17simon> References: <1376435848-14584-1-git-send-email-damien.lespiau@intel.com> <1376435848-14584-4-git-send-email-damien.lespiau@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0151290743==" Return-path: In-Reply-To: <1376435848-14584-4-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: intel-gfx@lists.freedesktop.org --===============0151290743== Content-Type: multipart/signed; boundary="nextPart21510460.m2ekdbsz4Z"; micalg="pgp-sha1"; protocol="application/pgp-signature" --nextPart21510460.m2ekdbsz4Z Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Minor typo - feel free to ignore: On Wednesday 14 August 2013 00:17:19 Damien Lespiau wrote: > HDMI 1.4 adds 4 "4k x 2k" modes in the the CEA vendor specific block.= >=20 > With this commit, we now parse this block and expose the 4k modes tha= t > we find there. >=20 > v2: Fix the "4096x2160" string (nice catch!), add comments about > do_hdmi_vsdb_modes() arguments and make it clearer that offset is= > relative to the end of the required fields of the HDMI VSDB > (Ville Syrj=E4l=E4) >=20 > Signed-off-by: Damien Lespiau > Tested-by: Cancan Feng > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=3D67030 > --- > drivers/gpu/drm/drm_edid.c | 124 +++++++++++++++++++++++++++++++++++= ++++------ > 1 file changed, 109 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 9e9b6ed..0faa08e 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -2465,6 +2495,68 @@ do_cea_modes(struct drm_connector *connector, = const u8 *db, u8 len) > =09return modes; > } > =20 > +/* > + * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block > + * @connector: connector corresponding to the HDMI sink > + * @db: start of the CEA vendor specific block > + * @len: length of the CEA block payload, ie. one can access up to d= b[len] > + * > + * Parses the HDMI VSDB looking for modes to add to @connector. > + */ > +static int > +do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8= len) > +{ > +=09struct drm_device *dev =3D connector->dev; > +=09int modes =3D 0, offset =3D 0, i; > +=09u8 vic_len; > + > +=09if (len < 8) > +=09=09goto out; > + > +=09/* no HDMI_Video_Present */ > +=09if (!(db[8] & (1 << 5))) > +=09=09goto out; > + > +=09/* Latency_Fields_Present */ > +=09if (db[8] & (1 << 7)) > +=09=09offset +=3D 2; > + > +=09/* I_Latency_Fields_Present */ > +=09if (db[8] & (1 << 6)) > +=09=09offset +=3D 2; > + > +=09/* the declared length is not long enough for the 2 first bytes > +=09 * of additional video format capabilities */ > +=09offset +=3D 2; > +=09if (len < (8 + offset)) > +=09=09goto out; > + > +=09vic_len =3D db[8 + offset] >> 5; > + > +=09for (i =3D 0; i < vic_len && len >=3D (9 + offset + i); i++) { > +=09=09struct drm_display_mode *newmode; > +=09=09u8 vic; > + > +=09=09vic =3D db[9 + offset + i]; > + > +=09=09vic--; /* VICs start at 1 */ > +=09=09if (vic >=3D ARRAY_SIZE(edid_4k_modes)) { > +=09=09=09DRM_ERROR("Unknow HDMI VIC: %d\n", vic); ^^^^^^ Missing "n" - should be Unknown > +=09=09=09continue; > +=09=09} > + > +=09=09newmode =3D drm_mode_duplicate(dev, &edid_4k_modes[vic]); > +=09=09if (!newmode) > +=09=09=09continue; > + > +=09=09drm_mode_probed_add(connector, newmode); > +=09=09modes++; > +=09} > + > +out: > +=09return modes; > +} > + > static int > cea_db_payload_len(const u8 *db) > { --=20 Simon Farnsworth Software Engineer ONELAN Ltd http://www.onelan.com --nextPart21510460.m2ekdbsz4Z 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) iQEcBAABAgAGBQJSC07JAAoJELb1E1yQPsc03D0H/Aom/OkaS+1YHltVgamgjUVj d9XV4xeEx4Vyi5jApgjlWW8oC3Kyk3bqxptjad3uCKWNqjOYvGiEs6D7oohsITha 87Oqj1h0C7J/BELBVA7q+3UUncpmAyZ1AY5shXTuqeUsRuydJ6CZ8cNUOr8Hz0ZQ V23A9C92jVKJX1NlqcZKsR7bOcjQ2aYigGxRjxLCvXPCObF8gasi7jbso9pnmQTx C4/Jk3ZeTHA05EZY5G3upZJg0ziAL/MMVl1VVObSZGDiAk6+YXodO4l2YACjBtwc 6vM5HUh7eNx3rhk8R8Nfwo+8w2UOpHS6qmfJ2U0YgHccLbM/OtCB4g+OeQLZ1JM= =Gslf -----END PGP SIGNATURE----- --nextPart21510460.m2ekdbsz4Z-- --===============0151290743== 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 --===============0151290743==--