Minor typo - feel free to ignore: On Wednesday 14 August 2013 00:17:19 Damien Lespiau wrote: > HDMI 1.4 adds 4 "4k x 2k" modes in the the CEA vendor specific block. > > With this commit, we now parse this block and expose the 4k modes that > we find there. > > v2: Fix the "4096x2160" string (nice catch!), add comments about > do_hdmi_vsdb_modes() arguments and make it clearer that offset is > relative to the end of the required fields of the HDMI VSDB > (Ville Syrjälä) > > Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx> > Tested-by: Cancan Feng <cancan.feng@xxxxxxxxx> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67030 > --- > drivers/gpu/drm/drm_edid.c | 124 +++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 109 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 9e9b6ed..0faa08e 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c <snip> > @@ -2465,6 +2495,68 @@ do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len) > return modes; > } > > +/* > + * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block > + * @connector: connector corresponding to the HDMI sink > + * @db: start of the CEA vendor specific block > + * @len: length of the CEA block payload, ie. one can access up to db[len] > + * > + * Parses the HDMI VSDB looking for modes to add to @connector. > + */ > +static int > +do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len) > +{ > + struct drm_device *dev = connector->dev; > + int modes = 0, offset = 0, i; > + u8 vic_len; > + > + if (len < 8) > + goto out; > + > + /* no HDMI_Video_Present */ > + if (!(db[8] & (1 << 5))) > + goto out; > + > + /* Latency_Fields_Present */ > + if (db[8] & (1 << 7)) > + offset += 2; > + > + /* I_Latency_Fields_Present */ > + if (db[8] & (1 << 6)) > + offset += 2; > + > + /* the declared length is not long enough for the 2 first bytes > + * of additional video format capabilities */ > + offset += 2; > + if (len < (8 + offset)) > + goto out; > + > + vic_len = db[8 + offset] >> 5; > + > + for (i = 0; i < vic_len && len >= (9 + offset + i); i++) { > + struct drm_display_mode *newmode; > + u8 vic; > + > + vic = db[9 + offset + i]; > + > + vic--; /* VICs start at 1 */ > + if (vic >= ARRAY_SIZE(edid_4k_modes)) { > + DRM_ERROR("Unknow HDMI VIC: %d\n", vic); ^^^^^^ Missing "n" - should be Unknown > + continue; > + } > + > + newmode = drm_mode_duplicate(dev, &edid_4k_modes[vic]); > + if (!newmode) > + continue; > + > + drm_mode_probed_add(connector, newmode); > + modes++; > + } > + > +out: > + return modes; > +} > + > static int > cea_db_payload_len(const u8 *db) > { <snip> -- Simon Farnsworth Software Engineer ONELAN Ltd http://www.onelan.com
Attachment:
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx