From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH 3/3] drm/edid: parse the list of additional 3D modes Date: Fri, 29 Nov 2013 18:47:01 +0200 Message-ID: <20131129164701.GJ10036@intel.com> References: <1385739208-19958-1-git-send-email-thomas.wood@intel.com> <1385739208-19958-4-git-send-email-thomas.wood@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1385739208-19958-4-git-send-email-thomas.wood@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Thomas Wood Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Nov 29, 2013 at 03:33:28PM +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=E4l=E4) > = > Signed-off-by: Thomas Wood > --- > drivers/gpu/drm/drm_edid.c | 64 ++++++++++++++++++++++++++++++++++++++++= ++---- > 1 file changed, 59 insertions(+), 5 deletions(-) > = > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index f1d6e1e..9426563 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 =3D 0, offset =3D 0, i, multi_present =3D 0; > + int modes =3D 0, offset =3D 0, i, multi_present =3D 0, multi_len; > u8 vic_len, hdmi_3d_len =3D 0; > u16 mask; > u16 structure_all; > @@ -2783,12 +2783,15 @@ do_hdmi_vsdb_modes(struct drm_connector *connecto= r, const u8 *db, u8 len, > if (!(multi_present =3D=3D 1 || multi_present =3D=3D 2)) > goto out; We should actually skip the 3D_Structure_ALL/MASK stuff in this case, but we should still go on and parse the 2D_VIC_order stuff. So this check should be removed. > = > - if ((multi_present =3D=3D 1 && len < (9 + offset)) || > - (multi_present =3D=3D 2 && len < (11 + offset))) > + if (multi_present =3D=3D 1) > + multi_len =3D 2; > + else and this should then be 'else if (multi_present =3D=3D 2)' and initialize multi_len to 0 in the beginning. > + multi_len =3D 4; > + > + if (len < (offset + hdmi_3d_len)) At this point db[8 + offset] we be the first 3d byte, so I think this should actually be something like: if (len < (8 + offset + hdmi_3d_len - 1)) > goto out; > = > - if ((multi_present =3D=3D 1 && hdmi_3d_len < 2) || > - (multi_present =3D=3D 2 && hdmi_3d_len < 4)) > + if (hdmi_3d_len < multi_len) > goto out; > = > /* 3D_Structure_ALL */ > @@ -2808,6 +2811,57 @@ do_hdmi_vsdb_modes(struct drm_connector *connector= , const u8 *db, u8 len, > video_len, i); > } > = > + if (hdmi_3d_len <=3D multi_len) > + goto out; Already checked, except the =3D=3D case, but the loop will check that for us, so this check can be dropped. > + > + offset +=3D multi_len; > + > + for (i =3D 0; i < (hdmi_3d_len - multi_len); i++) { > + int vic_index; > + struct drm_display_mode *newmode =3D NULL; > + unsigned int newflag =3D 0; > + bool detail_present; > + > + detail_present =3D ((db[8 + offset + i] & 0x0f) > 7); > + > + if (detail_present && (i + 1 =3D=3D hdmi_3d_len - multi_len)) > + break; > + > + /* 2D_VIC_order_X */ > + vic_index =3D db[8 + offset + i] >> 4; > + > + /* 3D_Structure_X */ > + switch (db[8 + offset + i] & 0x0f) { > + case 0: > + newflag =3D DRM_MODE_FLAG_3D_FRAME_PACKING; > + break; > + case 6: > + newflag =3D DRM_MODE_FLAG_3D_TOP_AND_BOTTOM; > + break; > + case 8: > + /* 3D_Detail_X */ > + if ((db[9 + offset + i] >> 4) =3D=3D 1) > + newflag =3D DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF; > + break; > + } > + > + if (newflag !=3D 0) { > + newmode =3D drm_display_mode_from_vic_index(connector, > + video_db, > + video_len, > + vic_index); > + > + if (newmode) { > + newmode->flags |=3D newflag; > + drm_mode_probed_add(connector, newmode); > + modes++; > + } > + } > + > + if (detail_present) > + 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=E4l=E4 Intel OTC