All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Thomas Wood <thomas.wood@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/edid: parse the list of additional 3D modes
Date: Thu, 28 Nov 2013 20:48:22 +0200	[thread overview]
Message-ID: <20131128184822.GE10036@intel.com> (raw)
In-Reply-To: <1385658767-24924-3-git-send-email-thomas.wood@intel.com>

On Thu, Nov 28, 2013 at 05:12:47PM +0000, Thomas Wood wrote:
> Parse 2D_VIC_order_X and 3D_Structure_X from the list at the end of the
> HDMI Vendor Specific Data Block.
> 
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 1dd82cd..eb6b363 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2808,6 +2808,56 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len,
>  						     video_len, i);
>  	}
>  
> +	if (hdmi_3d_len <= 4)

This number 4 should depend on the value of multi_present, no?

Also we haven't actually verified that all hdmi_3d_len bytes
fit within the data block. If you do that a bit earlier, you
could also skip the explicit 'len' checks for the
multi_present cases since we also check those against
hdmi_3d_len.

> +		goto out;
> +
> +	offset += 4;
> +
> +	for (i = 0; i < (hdmi_3d_len - 4); i++) {
> +		int vic_index;
> +		struct drm_display_mode *newmode = NULL;
> +		unsigned int newflag = 0;
> +
> +		if (((db[8 + offset + i] & 0x0f) > 7)
> +		    && (i + 1 == hdmi_3d_len - 4))
> +			break;

The '(db[8 + offset + i] & 0x0f) > 7' part is repeated a few times.
Maybe add a 'bool detail_present = (db[8 + offset + i] & 0x0f) > 7' or
something to make make things a bit easier to read.

> +
> +		/* 2D_VIC_order_X */
> +		vic_index = db[8 + offset + i] >> 4;
> +
> +		/* 3D_Structure_X */
> +		switch (db[8 + offset + i] & 0x0f) {
> +		case 0:
> +			newflag = DRM_MODE_FLAG_3D_FRAME_PACKING;
> +			break;
> +		case 6:
> +			newflag = DRM_MODE_FLAG_3D_TOP_AND_BOTTOM;
> +			break;
> +		case 8:

Maybe add a /* 3D_Detail_X */ comment here
for consistency with the other comments.

> +			if ((db[9 + offset + i] >> 4) == 1)
> +				newflag = DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF;
> +			break;
> +		}
> +
> +		if (newflag != 0) {
> +			newmode = drm_display_mode_from_vic_index(connector,
> +								  video_db,
> +								  video_len,
> +								  vic_index);
> +
> +			if (newmode) {
> +				newmode->flags |= newflag;
> +				drm_mode_probed_add(connector, newmode);
> +				modes++;
> +			}
> +		}
> +
> +		if ((db[8 + offset + i] & 0x0f) > 7) {
> +			/* Optional 3D_Detail_X and reserved */
> +			i++;
> +		}
> +	}
> +
>  out:
>  	return modes;
>  }
> -- 
> 1.8.4.2
> 
> _______________________________________________
> 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-11-28 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 17:12 Parse the list of additional 3D modes Thomas Wood
2013-11-28 17:12 ` [PATCH 1/2] drm/edid: split VIC display mode lookup into a separate function Thomas Wood
2013-11-28 18:44   ` Ville Syrjälä
2013-11-28 17:12 ` [PATCH 2/2] drm/edid: parse the list of additional 3D modes Thomas Wood
2013-11-28 18:48   ` Ville Syrjälä [this message]

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=20131128184822.GE10036@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thomas.wood@intel.com \
    /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.