public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Damien Lespiau <damien.lespiau@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/12] drm: Set the relevant infoframe field when scanning out a 3D mode
Date: Mon, 16 Sep 2013 21:59:19 +0300	[thread overview]
Message-ID: <20130916185919.GN4531@intel.com> (raw)
In-Reply-To: <1379353735-4472-9-git-send-email-damien.lespiau@intel.com>

On Mon, Sep 16, 2013 at 06:48:51PM +0100, Damien Lespiau wrote:
> When scanning out a 3D mode on HDMI, we need to send an HDMI infoframe
> with the corresponding layout to the sink.
> 
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index e016a5d..9a36b6e 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3364,6 +3364,18 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,
>  }
>  EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode);
>  
> +static enum hdmi_3d_structure
> +s3d_structure_from_display_mode(const struct drm_display_mode *mode)
> +{
> +	u32 s3d_mode = (mode->flags & DRM_MODE_FLAG_3D_MASK) >> 14;
> +	int set = ffs(s3d_mode) - 1;
> +
> +	if (set == 7)
> +		return HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF;

This function feels a bit too subtle. I would perhaps go w/ just a
switch statement. Or maybe leave a hole for 7 in the DRM_MODE_FLAG_3D
flags. And if we run out of bits before 3d_structure=7 gets defined we
just repurpose the bit for something else. But maybe that's equally
subtle.

Hmm. The spec is quite poor too. In one place it says the quincunx modes
are valid for 3d_structure=8 (and 15 is reserved), but in another place it
says 3d_structure=15 is when the quincunx stuff applies. But I guss we
can just keep ignoring the 3d_structure > 8 case for now.

> +
> +	return set;
> +}
> +
>  /**
>   * drm_hdmi_vendor_infoframe_from_display_mode() - fill an HDMI infoframe with
>   * data from a DRM display mode
> @@ -3381,20 +3393,29 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
>  					    const struct drm_display_mode *mode)
>  {
>  	int err;
> +	u32 s3d_flags;
>  	u8 vic;
>  
>  	if (!frame || !mode)
>  		return -EINVAL;
>  
>  	vic = drm_match_hdmi_mode(mode);
> -	if (!vic)
> +	s3d_flags = mode->flags & DRM_MODE_FLAG_3D_MASK;
> +
> +	if (!vic && !s3d_flags)
> +		return -EINVAL;
> +
> +	if (vic && s3d_flags)
>  		return -EINVAL;

Could be just '!vic == !s3d_flags' or w/ !! on both sides if we want
to stick to positive thinking.

But maybe it's me who's getting into the subtle territory here :)

Other than the bikesheds it looks OK to me:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  
>  	err = hdmi_vendor_infoframe_init(frame);
>  	if (err < 0)
>  		return err;
>  
> -	frame->vic = vic;
> +	if (vic)
> +		frame->vic = vic;
> +	else
> +		frame->s3d_struct = s3d_structure_from_display_mode(mode);
>  
>  	return 0;
>  }
> -- 
> 1.8.3.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-09-16 18:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 17:48 HDMI stereo support v4 Damien Lespiau
2013-09-16 17:48 ` [PATCH 01/12] drm: Move the GET_CAP macros next to the corresponding ioctl structure Damien Lespiau
2013-09-16 17:48 ` [PATCH 02/12] drm: Add a SET_CLIENT_CAP ioctl Damien Lespiau
2013-09-16 17:48 ` [PATCH 03/12] drm: Add HDMI stereo 3D flags to struct drm_mode_modeinfo Damien Lespiau
2013-09-16 17:48 ` [PATCH 04/12] drm: Add a STEREO_3D capability to the SET_CLIENT_CAP ioctl Damien Lespiau
2013-09-16 17:48 ` [PATCH 05/12] drm/edid: Expose mandatory stereo modes for HDMI sinks Damien Lespiau
2013-09-16 18:29   ` Ville Syrjälä
2013-09-16 21:28     ` Damien Lespiau
2013-09-17 13:48     ` Damien Lespiau
2013-09-16 17:48 ` [PATCH 06/12] drm: Extract add_hdmi_mode() out of do_hdmi_vsdb_modes() Damien Lespiau
2013-09-16 17:48 ` [PATCH 07/12] drm: Reject modes with more than 1 stereo flags set Damien Lespiau
2013-09-16 17:48 ` [PATCH 08/12] drm: Set the relevant infoframe field when scanning out a 3D mode Damien Lespiau
2013-09-16 18:59   ` Ville Syrjälä [this message]
2013-09-16 17:48 ` [PATCH 09/12] drm: Track the number of buffers that compose a framebuffer Damien Lespiau
2013-09-16 17:48 ` [PATCH 10/12] drm: Don't allow multiple buffers fb with stereo modes Damien Lespiau
2013-09-17  8:20   ` [Intel-gfx] " Ville Syrjälä
2013-09-17  9:03     ` Damien Lespiau
2013-09-17  9:54       ` Ville Syrjälä
2013-09-17 10:37         ` [Intel-gfx] " Daniel Vetter
2013-09-17 11:02           ` Ville Syrjälä
2013-09-17 13:34             ` [Intel-gfx] " Daniel Vetter
2013-09-17 13:20           ` Damien Lespiau
2013-09-17 13:32             ` Ville Syrjälä
2013-09-17 13:33             ` [Intel-gfx] " Daniel Vetter
2013-09-16 17:48 ` [PATCH 11/12] drm: Make drm_match_cea_mode() return the underlying 2D VIC for 3d modes Damien Lespiau
2013-09-17  8:22   ` Ville Syrjälä
2013-09-17  8:52     ` [Intel-gfx] " Damien Lespiau
2013-09-16 17:48 ` [PATCH 12/12] drm: Carry over the stereo flags when adding the alternate mode Damien Lespiau
2013-09-17  9:17 ` HDMI stereo support v4 Damien Lespiau

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=20130916185919.GN4531@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=damien.lespiau@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox