From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [RFC v2 3/5] drm: Add HDMI infoframe helpers Date: Thu, 6 Dec 2012 15:28:03 +0100 Message-ID: <20121206142803.GB15982@avionic-0098.adnet.avionic-design.de> References: <1354725944-1862-1-git-send-email-thierry.reding@avionic-design.de> <1354725944-1862-4-git-send-email-thierry.reding@avionic-design.de> <20121206140900.GT11556@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1619658263==" Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by gabe.freedesktop.org (Postfix) with ESMTP id 2304AE6582 for ; Thu, 6 Dec 2012 06:28:07 -0800 (PST) In-Reply-To: <20121206140900.GT11556@phenom.ffwll.local> 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: Daniel Vetter Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1619658263== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zx4FCpZtqtKETZ7O" Content-Disposition: inline --zx4FCpZtqtKETZ7O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 06, 2012 at 03:09:00PM +0100, Daniel Vetter wrote: > On Wed, Dec 05, 2012 at 05:45:42PM +0100, Thierry Reding wrote: [...] > > diff --git a/drivers/gpu/drm/drm_hdmi.c b/drivers/gpu/drm/drm_hdmi.c > > new file mode 100644 > > index 0000000..821ca56 > > --- /dev/null > > +++ b/drivers/gpu/drm/drm_hdmi.c > > @@ -0,0 +1,71 @@ > > +/* > > + * Copyright (C) 2012 Avionic Design GmbH > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + */ > > + > > +#include > > + > > +#include > > +#include > > + > > +#include "drm_edid_modes.h" >=20 > This creates a 2nd copy of that massive table. Imo we could just shovel > the infoframe helpers into the drm_edid.c file - allowing different > helpers to be disabled isn't that useful, since most drivers will want > them pretty much all anyway. Or at least most of them. I can move this helper to drm_edid.c. But maybe it might be worth moving the table from the header into a source file and just export it from there. > > + > > +static inline unsigned int > > +drm_mode_cea_vic(const struct drm_display_mode *mode) > > +{ > > + unsigned int i; > > + > > + for (i =3D 0; i < drm_num_cea_modes; i++) > > + if (drm_mode_equal(mode, &edid_cea_modes[i])) > > + return i + 1; > > + > > + return 0; > > +} >=20 > Same function in drm_edid will land through drm-intel tree in drm-next > rsn. I'll send that pull request somewhen next week probably. >=20 > http://cgit.freedesktop.org/~danvet/drm-intel/commit/?id=3D374a868a726eb8= a1cb28ba88805e51ce34222f8d Yes, I'm aware of that patch (I reviewed it =3D) and I was planning on dropping the implementation in this patch once the above patch makes it into linux-next. > > +/** > > + * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infof= rame with > > + * data from a DRM displa= y mode > > + * @frame: HDMI AVI infoframe > > + * @mode: DRM display mode > > + * > > + * Returns 0 on success or a negative error code on failure. > > + */ > > +int > > +drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *fr= ame, > > + const struct drm_display_mode *mode) > > +{ > > + int err; > > + > > + if (!frame || !mode) > > + return -EINVAL; > > + > > + err =3D hdmi_avi_infoframe_init(frame); > > + if (err < 0) > > + return err; > > + > > + frame->video_code =3D drm_mode_cea_vic(mode); > > + if (!frame->video_code) > > + return 0; > > + > > + frame->picture_aspect =3D drm_display_mode_get_aspect(mode); > > + frame->active_aspect =3D HDMI_ACTIVE_ASPECT_PICTURE; >=20 > Note that the intel avi infoframe in intel_hdmi_set_avi_infoframe also > sets the pixel repeat for double clocked modes with: >=20 > if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) > avi_if.body.avi.YQ_CN_PR |=3D DIP_AVI_PR_2; I left that in place in the Intel driver, but I suppose we can just as well move it to the infoframe helpers since it should be a generic option. Thierry --zx4FCpZtqtKETZ7O Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQwKtzAAoJEN0jrNd/PrOhQooQAMG0+V6TKeoTrqC/BQ8VhwcO 9hKrP8FxKbkkThO6dLN2du8LrIre3UkLTwU9jt0AJP6dkbG6eix1HDPLdDW/BPtk +RKHJsX3euJMPNq7xj1QY5RH+/eZq1M+Kxu/j9nofEzkAKuA53iyeCifPzJfkg1d LSFDP9Cj3IqJXy7QwyYy+RHdgfcgJcIQ6hwzlO6denqcnrm6mMD3tmcE1C3UqEq4 8u7//xlrtjnqXm2lwl00/lq7Psab34wW1uZxuGHZDOFyFhwaDha9SOUyyyLQVoJh p8iBlsyCRa+guNQf0cdOnKdt7+9QmIwIAmpF6/J/lzPzyhLAGDNtxrj3uoxbZ2tW f7LHOe/SwnAxvilLANwBOfVpbdBSifDPTn36Tk7ByifPu1QqswsxM/cqLBRXH/GF 6sawsNqvMGTILcllj+5YxIq/NyhlGlGzNyhS/5nCxhlMCiNUC6SejbG3QecW5Hse 1hbTEfwnj8Lt6CHO09mkvvMc/1DD9x68YtU1bTlJUoNNFoOuTHPTJbkQTj7YkMZg F+QMn5Rly7Ji+EDMupc/0e7r8hdEGYY8PBuc/HjBadPXKMAKNw4Snl2mBm1XkupP FJB5mdPqB0US0jQ7Rb0nMPWw3z0g8nBookZcBb26FGiTinhq7yyLzVAcvUG1mE/n DyG35k9LxqzJa+2ZuIsz =b6ML -----END PGP SIGNATURE----- --zx4FCpZtqtKETZ7O-- --===============1619658263== 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 --===============1619658263==--