From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v2 2/3] drm/edid: Implement SCDC support detection Date: Mon, 5 Dec 2016 08:57:43 +0100 Message-ID: <20161205075743.GE18069@ulmo.ba.sec> References: <20161202192415.16110-1-thierry.reding@gmail.com> <20161202192415.16110-2-thierry.reding@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0207936798==" Return-path: Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04CAC6E06F for ; Mon, 5 Dec 2016 07:57:46 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id u144so14106260wmu.0 for ; Sun, 04 Dec 2016 23:57:46 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: "Sharma, Shashank" Cc: Jose Abreu , "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org --===============0207936798== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Dzs2zDY0zgkG72+7" Content-Disposition: inline --Dzs2zDY0zgkG72+7 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 03, 2016 at 04:35:24AM +0000, Sharma, Shashank wrote: > Hi Thierry,=20 >=20 > If you can please have a look on this patch, I had written one to parse H= F-VSDB, which was covering SCDC detection too.=20 > https://patchwork.kernel.org/patch/9452259/=20 I think there had been pushback before about caching capabilities from EDID, so from that point of view my patch is more inline with existing EDID parsing API. Other than that the patches are mostly equivalent, except yours parses more information than just the SCDC bits. Thierry > -----Original Message----- > From: Thierry Reding [mailto:thierry.reding@gmail.com]=20 > Sent: Saturday, December 3, 2016 12:54 AM > To: dri-devel@lists.freedesktop.org > Cc: Jani Nikula ; Sharma, Shashank ; Ville Syrj=C3=A4l=C3=A4 ; Jose Abreu > Subject: [PATCH v2 2/3] drm/edid: Implement SCDC support detection >=20 > From: Thierry Reding >=20 > Sinks compliant with the HDMI 2.0 specification may support SCDC, a mecha= nism for the source and the sink to communicate. Sinks advertise support fo= r this feature in the HDMI Forum Vendor Specific Data Block as defined in t= he HDMI 2.0 specification, section 10.4 "Status and Control Data Channel". = Implement a small helper that find the HF-VSDB and parses it to check if th= e sink supports SCDC. >=20 > Signed-off-by: Thierry Reding > --- > Changes in v2: > - rename internal function to cea_db_is_hdmi_forum_vsdb() for more > clarity (Ville Syrj=C3=A4l=C3=A4) >=20 > drivers/gpu/drm/drm_edid.c | 49 ++++++++++++++++++++++++++++++++++++++++= ++++++ > include/drm/drm_edid.h | 1 + > include/linux/hdmi.h | 1 + > 3 files changed, 51 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c inde= x 336be31ff3de..369961597ee5 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3238,6 +3238,21 @@ static bool cea_db_is_hdmi_vsdb(const u8 *db) > return hdmi_id =3D=3D HDMI_IEEE_OUI; > } > =20 > +static bool cea_db_is_hdmi_forum_vsdb(const u8 *db) { > + unsigned int oui; > + > + if (cea_db_tag(db) !=3D VENDOR_BLOCK) > + return false; > + > + if (cea_db_payload_len(db) < 7) > + return false; > + > + oui =3D db[3] << 16 | db[2] << 8 | db[1]; > + > + return oui =3D=3D HDMI_FORUM_IEEE_OUI; > +} > + > #define for_each_cea_db(cea, i, start, end) \ > for ((i) =3D (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i= )]) < (end); (i) +=3D cea_db_payload_len(&(cea)[(i)]) + 1) > =20 > @@ -3687,6 +3702,40 @@ bool drm_detect_hdmi_monitor(struct edid *edid) E= XPORT_SYMBOL(drm_detect_hdmi_monitor); > =20 > /** > + * drm_detect_hdmi_scdc - detect whether an HDMI sink supports SCDC > + * @edid: sink EDID information > + * > + * Parse the CEA extension according to CEA-861-B to find an HF-VSDB as > + * defined in HDMI 2.0, section 10.3.2 "HDMI Forum Vendor Specific Data > + * Block" and checks if the SCDC_Present bit (bit 7 of byte 6) is set. > + * > + * Returns: > + * True if the sink supports SCDC, false otherwise. > + */ > +bool drm_detect_hdmi_scdc(struct edid *edid) { > + unsigned int start, end, i; > + const u8 *cea; > + > + cea =3D drm_find_cea_extension(edid); > + if (!cea) > + return false; > + > + if (cea_db_offsets(cea, &start, &end)) > + return false; > + > + for_each_cea_db(cea, i, start, end) { > + if (cea_db_is_hdmi_forum_vsdb(&cea[i])) { > + if (cea[i + 6] & 0x80) > + return true; > + } > + } > + > + return false; > +} > +EXPORT_SYMBOL(drm_detect_hdmi_scdc); > + > +/** > * drm_detect_monitor_audio - check monitor audio capability > * @edid: EDID block to scan > * > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 38eabf= 65f19d..7ea7e90846d8 100644 > --- a/include/drm/drm_edid.h > +++ b/include/drm/drm_edid.h > @@ -440,6 +440,7 @@ int drm_add_edid_modes(struct drm_connector *connecto= r, struct edid *edid); > u8 drm_match_cea_mode(const struct drm_display_mode *to_match); enum hd= mi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); bool drm_= detect_hdmi_monitor(struct edid *edid); > +bool drm_detect_hdmi_scdc(struct edid *edid); > bool drm_detect_monitor_audio(struct edid *edid); bool drm_rgb_quant_ra= nge_selectable(struct edid *edid); int drm_add_modes_noedid(struct drm_con= nector *connector, diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h= index edbb4fc674ed..d271ff23984f 100644 > --- a/include/linux/hdmi.h > +++ b/include/linux/hdmi.h > @@ -35,6 +35,7 @@ enum hdmi_infoframe_type { }; > =20 > #define HDMI_IEEE_OUI 0x000c03 > +#define HDMI_FORUM_IEEE_OUI 0xc45dd8 > #define HDMI_INFOFRAME_HEADER_SIZE 4 > #define HDMI_AVI_INFOFRAME_SIZE 13 > #define HDMI_SPD_INFOFRAME_SIZE 25 > -- > 2.10.2 >=20 --Dzs2zDY0zgkG72+7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAABCAAGBQJYRR31AAoJEN0jrNd/PrOhis4P/3UuzVXfBYMMaT5N/2pXpCrx DPiQE/JRMp1bNABQ7dUW7WlWcZtMY/SlBSoBpQvfxifPJR0HEdNF/1My713tOZqS l0CMxbTa4/pQJwNuoCXJjtDVm8vaAAcnrpwRjnplr6R7fyQcT4pGysFkXghNbrRt ALF4qWVDiKm6picec1Sm3A/dWzQ0tVXYnMaKFKHxxHEKSW9St2FsXiINUVaSmeNV h/HgyLiG+UxPI9wwYOskNXS3JUlMonDBYaH2hw5ywRWJCIzJDCEb43l5TyAee1Fl qEXrlWQ/VsXSwWzYZHMo15kImv9ZUuETArdBlTrGm70oEm8Rw7na4qEVBd/rTrb0 atUw0E8ngEwpan86f8odrwRbD5KMMiK87+cn69zz3aN5XAqhlDoVKPMWUpgV93LJ 87qAc4gWV1gDTR0aE+NXdOJZ/VL3rLCDW3UY3BK497jI3RQ5i1UeFqGsukKLHkjb W5i6vQ+gg5SSRdHbjXN6xWUFiJuziJfiHSZOvbXYnrquIDhBnHWOdy27kBTKzjUd J9vjlr0ccA1bjkr+DgLQNFL6T34xH44vLa3ayebdgnfDoWZaF1I2eDkp3unkkS7S oU02eXvPXUluD/HKINgRRYoOX882jm5TE3OV6xT3nxiybAxv/BVoIwEk3b1BJOrO LgsTnjLtY9g1j0CP21aE =zpsx -----END PGP SIGNATURE----- --Dzs2zDY0zgkG72+7-- --===============0207936798== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0207936798==--