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] drm/edid: parse the list of additional 3D modes
Date: Fri, 29 Nov 2013 21:10:30 +0200 [thread overview]
Message-ID: <20131129191030.GK10036@intel.com> (raw)
In-Reply-To: <1385749138-4057-1-git-send-email-thomas.wood@intel.com>
On Fri, Nov 29, 2013 at 06:18:58PM +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.
>
> v2: Use an offset value depending on 3D_Multi_present and add
> detail_present. (Ville Syrjälä)
> v3: Make sure the list is parsed even if 3D_Structure_ALL/MASK is not
> present. (Ville Syrjälä)
> Fix one length check and remove another. (Ville Syrjälä)
>
> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
For the series:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 94 +++++++++++++++++++++++++++++++++++-----------
> 1 file changed, 73 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index f1d6e1e..4c82a80 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2734,7 +2734,7 @@ static int
> do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len,
> const u8 *video_db, u8 video_len)
> {
> - int modes = 0, offset = 0, i, multi_present = 0;
> + int modes = 0, offset = 0, i, multi_present = 0, multi_len;
> u8 vic_len, hdmi_3d_len = 0;
> u16 mask;
> u16 structure_all;
> @@ -2780,32 +2780,84 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len,
> }
> offset += 1 + vic_len;
>
> - if (!(multi_present == 1 || multi_present == 2))
> - goto out;
> + if (multi_present == 1)
> + multi_len = 2;
> + else if (multi_present == 2)
> + multi_len = 4;
> + else
> + multi_len = 0;
>
> - if ((multi_present == 1 && len < (9 + offset)) ||
> - (multi_present == 2 && len < (11 + offset)))
> + if (len < (8 + offset + hdmi_3d_len - 1))
> goto out;
>
> - if ((multi_present == 1 && hdmi_3d_len < 2) ||
> - (multi_present == 2 && hdmi_3d_len < 4))
> + if (hdmi_3d_len < multi_len)
> goto out;
>
> - /* 3D_Structure_ALL */
> - structure_all = (db[8 + offset] << 8) | db[9 + offset];
> + if (multi_present == 1 || multi_present == 2) {
> + /* 3D_Structure_ALL */
> + structure_all = (db[8 + offset] << 8) | db[9 + offset];
>
> - /* check if 3D_MASK is present */
> - if (multi_present == 2)
> - mask = (db[10 + offset] << 8) | db[11 + offset];
> - else
> - mask = 0xffff;
> -
> - for (i = 0; i < 16; i++) {
> - if (mask & (1 << i))
> - modes += add_3d_struct_modes(connector,
> - structure_all,
> - video_db,
> - video_len, i);
> + /* check if 3D_MASK is present */
> + if (multi_present == 2)
> + mask = (db[10 + offset] << 8) | db[11 + offset];
> + else
> + mask = 0xffff;
> +
> + for (i = 0; i < 16; i++) {
> + if (mask & (1 << i))
> + modes += add_3d_struct_modes(connector,
> + structure_all,
> + video_db,
> + video_len, i);
> + }
> + }
> +
> + offset += multi_len;
> +
> + for (i = 0; i < (hdmi_3d_len - multi_len); i++) {
> + int vic_index;
> + struct drm_display_mode *newmode = NULL;
> + unsigned int newflag = 0;
> + bool detail_present;
> +
> + detail_present = ((db[8 + offset + i] & 0x0f) > 7);
> +
> + if (detail_present && (i + 1 == hdmi_3d_len - multi_len))
> + break;
> +
> + /* 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:
> + /* 3D_Detail_X */
> + 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 (detail_present)
> + i++;
> }
>
> out:
> --
> 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
prev parent reply other threads:[~2013-11-29 19:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 15:33 Parse the list of additional 3D modes (v2) Thomas Wood
2013-11-29 15:33 ` [PATCH 1/3] drm/edid: fix length check when adding extra 3D modes Thomas Wood
2013-11-29 15:33 ` [PATCH 2/3] drm/edid: split VIC display mode lookup into a separate function Thomas Wood
2013-11-29 15:33 ` [PATCH 3/3] drm/edid: parse the list of additional 3D modes Thomas Wood
2013-11-29 16:47 ` Ville Syrjälä
2013-11-29 18:18 ` [PATCH] " Thomas Wood
2013-11-29 19:10 ` 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=20131129191030.GK10036@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.