Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752147AbbKPLuw (ORCPT ); Mon, 16 Nov 2015 06:50:52 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:3701 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716AbbKPLuu (ORCPT ); Mon, 16 Nov 2015 06:50:50 -0500 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 16 Nov 2015 03:48:23 -0800 Date: Mon, 16 Nov 2015 12:50:39 +0100 From: Thierry Reding To: Enric Balletbo i Serra CC: , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Hans Verkuil , Mauro Carvalho Chehab , Martin Bugge , , Subject: Re: [PATCH] [media] hdmi: added functions for MPEG InfoFrames Message-ID: <20151116115037.GF31033@ulmo.nvidia.com> References: <1447526299-4222-1-git-send-email-enric.balletbo@collabora.com> MIME-Version: 1.0 In-Reply-To: <1447526299-4222-1-git-send-email-enric.balletbo@collabora.com> X-NVConfidentiality: public User-Agent: Mutt/1.5.23+102 (2ca89bed6448) (2014-03-12) X-Originating-IP: [10.2.70.69] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="10jrOL3x2xqLmOsH" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3951 Lines: 115 --10jrOL3x2xqLmOsH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 14, 2015 at 07:38:19PM +0100, Enric Balletbo i Serra wrote: > The MPEG Source (MS) InfoFrame is in EIA/CEA-861B. It describes aspects of > the compressed video stream that were used to produce the uncompressed > video. >=20 > The patch adds functions to work with MPEG InfoFrames. >=20 > Signed-off-by: Enric Balletbo i Serra > --- > drivers/video/hdmi.c | 156 +++++++++++++++++++++++++++++++++++++++++++++= ++++++ > include/linux/hdmi.h | 24 ++++++++ > 2 files changed, 180 insertions(+) According to the CEA specification a source is expected to send this type of infoframe once per video frame. I'm curious how you envision this to be ensured. Would hardware provide a mechanism to store this data and send the infoframe automatically? How would you ensure that updates sent to the hardware match the upcoming frame? > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c [...] > @@ -435,6 +510,8 @@ hdmi_infoframe_pack(union hdmi_infoframe *frame, void= *buffer, size_t size) > length =3D hdmi_vendor_any_infoframe_pack(&frame->vendor, > buffer, size); > break; > + case HDMI_INFOFRAME_TYPE_MPEG: > + length =3D hdmi_mpeg_infoframe_pack(&frame->mpeg, buffer, size); Missing "break;"? > @@ -899,6 +978,41 @@ static void hdmi_audio_infoframe_log(const char *lev= el, > frame->downmix_inhibit ? "Yes" : "No"); > } > =20 > +static const char *hdmi_mpeg_picture_get_name(enum hdmi_mpeg_picture_typ= e type) > +{ > + switch (type) { > + case HDMI_MPEG_PICTURE_TYPE_UNKNOWN: > + return "Unknown"; > + case HDMI_MPEG_PICTURE_TYPE_I: > + return "Intra-coded picture"; > + case HDMI_MPEG_PICTURE_TYPE_B: > + return "Bi-predictive picture"; > + case HDMI_MPEG_PICTURE_TYPE_P: > + return "Predicted picture"; > + } I'd have chosen the slightly more canonical "I-Frame", "P-Frame", "B-Frame" here, but that's not a strong objection. > + return "Reserved"; There really can't be another value here, so I think this should either return NULL or even go as far as let it crash. There should be no way for the invalid value to make it this far. > +static int hdmi_mpeg_infoframe_unpack(struct hdmi_mpeg_infoframe *frame, > + void *buffer) > +{ > + u8 *ptr =3D buffer; > + > + if (ptr[0] !=3D HDMI_INFOFRAME_TYPE_MPEG || > + ptr[1] !=3D 1 || > + ptr[2] !=3D HDMI_MPEG_INFOFRAME_SIZE) { > + return -EINVAL; > + } There's no need for the braces here. > @@ -314,6 +336,7 @@ union hdmi_vendor_any_infoframe { > * @spd: spd infoframe > * @vendor: union of all vendor infoframes > * @audio: audio infoframe > + * @mpeg: mpeg infoframe s/mpeg/MPEG/ Thierry --10jrOL3x2xqLmOsH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJWScMKAAoJEN0jrNd/PrOheZ8P/3NQ3ENkv+JsHvgRzXHVELuE U5IJStwM08UjMPTDRUoLyUMWGilsd6/Ax1oEZDWogShBb9e7or3ATPmTyGTKVXPc 6NytBYdxJL4p6l/qThaE8be+F8Mv9AAZvatkj1Vu2hVi8UmEahTarBygm8ed6VyF 4IlJbEAVCquMdI/9bvg3+Ck8ozKU+2B5/mWVTs3+GtpzBN4/4H70xuAh25tx64Pe aPudFIAONzK3+sJ0rLqvjDSXf80pPAX9ELhA8bEOeNd9D0I4bo+uZQeIyQfUzs9O COip/Dt1oTFePtNGoOE8AxKorCALhItyQBUOCcJaICbOXExaPz6iF+I+nhnd/h8Y XJmY7NFFdSViEMCGeJOIh/mHHX7c/fi9UEWIS0QRyHvKGOh40OwqZt0jjkKjklgI AB0ljV4vO3rvr91YhNl2bR3pP80i6B9sWyW3uLprZy4lBEE2l66xhhDYFjbY+EnI 5KmpYcDTMgONYLC5lkC3sPrAH3z7AdKb13S/FRLwC90P92kyy5uNp0YWbo27/XNH I6XaausGpMuoiWrpbKjIR/QBw+FiJA7J7Us1ht8FpvDnFk2oFUQykgNGk7Ryg6fr sXi5Rhd/JZTbeU6yGwwQAe5qOkYcGqOVaFcQecr1ESAawzjWzczphF2V2Shgiwlq oBc7CgMg55Nz6zRouXAQ =rO+1 -----END PGP SIGNATURE----- --10jrOL3x2xqLmOsH-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/