All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
To: "Christian König"
	<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Dave Airlie" <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 2/2] drm: tegra: Add HDMI support
Date: Mon, 12 Nov 2012 08:24:10 +0100	[thread overview]
Message-ID: <20121112072410.GA925@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <20121111144644.GK5854-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4284 bytes --]

On Sun, Nov 11, 2012 at 03:46:44PM +0100, Daniel Vetter wrote:
> On Sat, Nov 10, 2012 at 10:01:18PM +0100, Thierry Reding wrote:
> > On Fri, Nov 09, 2012 at 05:00:54PM +0100, Christian König wrote:
> > > On 09.11.2012 16:45, Rafał Miłecki wrote:
> > > >2012/11/9 Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>:
> > > >>+/* all fields little endian */
> > > >>+struct hdmi_audio_infoframe {
> > > >>+       /* PB0 */
> > > >>+       u8 csum;
> > > >>+
> > > >>+       /* PB1 */
> > > >>+       unsigned cc:3; /* channel count */
> > > >>+       unsigned res1:1;
> > > >>+       unsigned ct:4; /* coding type */
> > > >>+
> > > >>+       /* PB2 */
> > > >>+       unsigned ss:2; /* sample size */
> > > >>+       unsigned sf:3; /* sample frequency */
> > > >>+       unsigned res2:3;
> > > >>+
> > > >>+       /* PB3 */
> > > >>+       unsigned cxt:5; /* coding extention type */
> > > >>+       unsigned res3:3;
> > > >>+
> > > >>+       /* PB4 */
> > > >>+       u8 ca; /* channel/speaker allocation */
> > > >>+
> > > >>+       /* PB5 */
> > > >>+       unsigned res5:3;
> > > >>+       unsigned lsv:4; /* level shift value */
> > > >>+       unsigned dm_inh:1; /* downmix inhibit */
> > > >>+
> > > >>+       /* PB6-10 reserved */
> > > >>+       u8 res6;
> > > >>+       u8 res7;
> > > >>+       u8 res8;
> > > >>+       u8 res9;
> > > >>+       u8 res10;
> > > >>+} __packed;
> > > >I was told it won't work on different endian devices. See
> > > >[RFC][PATCH] drm/radeon/hdmi: define struct for AVI infoframe
> > > >http://lists.freedesktop.org/archives/dri-devel/2012-May/022544.html
> > > 
> > > Yeah, that's indeed true. And honestly adding just another
> > > implementation of the HDMI info frames sounds like somebody should
> > > finally sit down and implement it in a common drm_hdmi.c
> > 
> > So I've been looking at what most other implementations do and it seems
> > a lot just fill the AVI infoframe with zeroes while only a few actually
> > try to put useful information in them. Still in order to plan for a
> > generic solution, I thought maybe something like the below set of
> > structures and functions could work:
> > 
> > /*
> >  * Structure that contains the infoframe fields in a form that allows them to
> >  * be easily accessed from C code.
> >  */
> > struct hdmi_avi_infoframe;
> > 
> > /*
> >  * DRM helper to fill a struct hdmi_avi_infoframe with information taken from
> >  * a struct drm_display_mode. Fields that cannot automatically be derived by
> >  * looking at a struct drm_display_mode are set to the default values.
> >  */
> > int drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
> > 					     struct drm_display_mode *mode);
> > 
> > /*
> >  * Packs the struct hdmi_avi_infoframe into a binary buffer that can be
> >  * programmed to the hardware-specific registers.
> >  */
> > ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame,
> > 				void *buffer, size_t size);
> > 
> > Such a scheme would allow DRM drivers to call the helper and tweak the
> > fields in the structure if the want or need to and call the packing
> > function to obtain a buffer that they can write to the controller.
> > 
> > Does that sound at all reasonable?
> 
> Sounds good, especially the disdinction between the infoframe creation and
> packing. E.g. on intel sdvo outputs we may not put in one of the ECC bytes
> (since the hw creates it), so we need our own packing code there.

Actually what I had in mind was a packed binary representation of
infoframes as specified by HDMI 1.3a (I don't have access to 1.4, but I
would think it doesn't differ in this respect) in section 5.3 and 5.3.5
more specifically. According to the specification, the ECC bytes only
come into play at a later stage, when data is actually transmitted on
the TMDS link (Section 5.2.3). Tegra, nouveau and radeon also seem to be
doing the checksumming in hardware, so I guess we don't need to compute
the ECC bytes in software at all (for now).

Once we have this for the AVI infoframes I guess the same concept can be
used for audio infoframes and for vendor-specific infoframes (for HDMI
1.4 3D).

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@avionic-design.de>
To: "Christian König" <deathsimple@vodafone.de>,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-tegra@vger.kernel.org, "Dave Airlie" <airlied@redhat.com>
Subject: Re: [PATCH 2/2] drm: tegra: Add HDMI support
Date: Mon, 12 Nov 2012 08:24:10 +0100	[thread overview]
Message-ID: <20121112072410.GA925@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <20121111144644.GK5854@phenom.ffwll.local>

[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]

On Sun, Nov 11, 2012 at 03:46:44PM +0100, Daniel Vetter wrote:
> On Sat, Nov 10, 2012 at 10:01:18PM +0100, Thierry Reding wrote:
> > On Fri, Nov 09, 2012 at 05:00:54PM +0100, Christian König wrote:
> > > On 09.11.2012 16:45, Rafał Miłecki wrote:
> > > >2012/11/9 Thierry Reding <thierry.reding@avionic-design.de>:
> > > >>+/* all fields little endian */
> > > >>+struct hdmi_audio_infoframe {
> > > >>+       /* PB0 */
> > > >>+       u8 csum;
> > > >>+
> > > >>+       /* PB1 */
> > > >>+       unsigned cc:3; /* channel count */
> > > >>+       unsigned res1:1;
> > > >>+       unsigned ct:4; /* coding type */
> > > >>+
> > > >>+       /* PB2 */
> > > >>+       unsigned ss:2; /* sample size */
> > > >>+       unsigned sf:3; /* sample frequency */
> > > >>+       unsigned res2:3;
> > > >>+
> > > >>+       /* PB3 */
> > > >>+       unsigned cxt:5; /* coding extention type */
> > > >>+       unsigned res3:3;
> > > >>+
> > > >>+       /* PB4 */
> > > >>+       u8 ca; /* channel/speaker allocation */
> > > >>+
> > > >>+       /* PB5 */
> > > >>+       unsigned res5:3;
> > > >>+       unsigned lsv:4; /* level shift value */
> > > >>+       unsigned dm_inh:1; /* downmix inhibit */
> > > >>+
> > > >>+       /* PB6-10 reserved */
> > > >>+       u8 res6;
> > > >>+       u8 res7;
> > > >>+       u8 res8;
> > > >>+       u8 res9;
> > > >>+       u8 res10;
> > > >>+} __packed;
> > > >I was told it won't work on different endian devices. See
> > > >[RFC][PATCH] drm/radeon/hdmi: define struct for AVI infoframe
> > > >http://lists.freedesktop.org/archives/dri-devel/2012-May/022544.html
> > > 
> > > Yeah, that's indeed true. And honestly adding just another
> > > implementation of the HDMI info frames sounds like somebody should
> > > finally sit down and implement it in a common drm_hdmi.c
> > 
> > So I've been looking at what most other implementations do and it seems
> > a lot just fill the AVI infoframe with zeroes while only a few actually
> > try to put useful information in them. Still in order to plan for a
> > generic solution, I thought maybe something like the below set of
> > structures and functions could work:
> > 
> > /*
> >  * Structure that contains the infoframe fields in a form that allows them to
> >  * be easily accessed from C code.
> >  */
> > struct hdmi_avi_infoframe;
> > 
> > /*
> >  * DRM helper to fill a struct hdmi_avi_infoframe with information taken from
> >  * a struct drm_display_mode. Fields that cannot automatically be derived by
> >  * looking at a struct drm_display_mode are set to the default values.
> >  */
> > int drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
> > 					     struct drm_display_mode *mode);
> > 
> > /*
> >  * Packs the struct hdmi_avi_infoframe into a binary buffer that can be
> >  * programmed to the hardware-specific registers.
> >  */
> > ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame,
> > 				void *buffer, size_t size);
> > 
> > Such a scheme would allow DRM drivers to call the helper and tweak the
> > fields in the structure if the want or need to and call the packing
> > function to obtain a buffer that they can write to the controller.
> > 
> > Does that sound at all reasonable?
> 
> Sounds good, especially the disdinction between the infoframe creation and
> packing. E.g. on intel sdvo outputs we may not put in one of the ECC bytes
> (since the hw creates it), so we need our own packing code there.

Actually what I had in mind was a packed binary representation of
infoframes as specified by HDMI 1.3a (I don't have access to 1.4, but I
would think it doesn't differ in this respect) in section 5.3 and 5.3.5
more specifically. According to the specification, the ECC bytes only
come into play at a later stage, when data is actually transmitted on
the TMDS link (Section 5.2.3). Tegra, nouveau and radeon also seem to be
doing the checksumming in hardware, so I guess we don't need to compute
the ECC bytes in software at all (for now).

Once we have this for the AVI infoframes I guess the same concept can be
used for audio infoframes and for vendor-specific infoframes (for HDMI
1.4 3D).

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-11-12  7:24 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 13:59 [PATCH 0/2] NVIDIA Tegra DRM driver Thierry Reding
2012-11-09 13:59 ` Thierry Reding
     [not found] ` <1352469579-3337-1-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-11-09 13:59   ` [PATCH 1/2] drm: Add NVIDIA Tegra20 support Thierry Reding
2012-11-09 13:59     ` Thierry Reding
     [not found]     ` <1352469579-3337-2-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-11-09 15:18       ` Rob Clark
2012-11-09 15:18         ` Rob Clark
     [not found]         ` <CAF6AEGs4bk3umkbQmJmB+Gf4UctKWa2Rj9GEi=DZSqU8MUd+9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-09 16:00           ` Thierry Reding
2012-11-09 16:00             ` Thierry Reding
     [not found]             ` <20121109160002.GA6474-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-11-09 16:26               ` Rob Clark
2012-11-09 16:26                 ` Rob Clark
     [not found]                 ` <CAF6AEGu0j1E96tzsTcJ91-FdTekAoWL7w1GBadRQ7p2h0smVDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-09 21:03                   ` Thierry Reding
2012-11-09 21:03                     ` Thierry Reding
     [not found]                     ` <20121109210334.GA9023-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-11-10 18:04                       ` Terje Bergström
2012-11-10 18:04                         ` Terje Bergström
2012-11-09 22:27       ` Stephen Warren
2012-11-09 22:27         ` Stephen Warren
2012-11-10  0:09       ` Stephen Warren
2012-11-10  0:09         ` Stephen Warren
     [not found]         ` <509D9B4F.6060003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-11-10  9:11           ` Thierry Reding
2012-11-10  9:11             ` Thierry Reding
2012-11-13  8:00       ` Terje Bergström
2012-11-13  8:00         ` Terje Bergström
     [not found]         ` <50A1FE01.5090808-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-11-13  8:03           ` Thierry Reding
2012-11-13  8:03             ` Thierry Reding
     [not found]             ` <20121113080323.GA15983-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-11-13  8:16               ` Terje Bergström
2012-11-13  8:16                 ` Terje Bergström
2012-11-09 13:59   ` [PATCH 2/2] drm: tegra: Add HDMI support Thierry Reding
2012-11-09 13:59     ` Thierry Reding
     [not found]     ` <1352469579-3337-3-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
2012-11-09 15:45       ` Rafał Miłecki
2012-11-09 15:45         ` Rafał Miłecki
2012-11-09 16:00         ` Christian König
     [not found]           ` <509D28B6.3060207-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2012-11-09 16:04             ` Rafał Miłecki
2012-11-09 16:04               ` Rafał Miłecki
     [not found]               ` <CACna6rxOBENLVC8mgJdsSdAZdWranMiivSgq_8DzeTo0hzzWqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-09 20:20                 ` Thierry Reding
2012-11-09 20:20                   ` Thierry Reding
2012-11-10 21:01             ` Thierry Reding
2012-11-10 21:01               ` Thierry Reding
     [not found]               ` <20121110210118.GA26809-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-11-10 21:11                 ` Thierry Reding
2012-11-10 21:11                   ` Thierry Reding
2012-11-11 14:46               ` Daniel Vetter
     [not found]                 ` <20121111144644.GK5854-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2012-11-12  7:24                   ` Thierry Reding [this message]
2012-11-12  7:24                     ` Thierry Reding
     [not found]                     ` <20121112072410.GA925-RM9K5IK7kjIQXX3q8xo1gnVAuStQJXxyR5q1nwbD4aMs9pC9oP6+/A@public.gmane.org>
2012-11-12  9:43                       ` Daniel Vetter
2012-11-12  9:43                         ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121112072410.GA925@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding-rm9k5ik7kjkj5m59nbduvrnah6klmebb@public.gmane.org \
    --cc=airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.