[Intel-gfx] [PATCH 8/8] drm/edid: Dump bogus 18 byte descriptors

Shankar, Uma uma.shankar at intel.com
Mon Feb 3 20:38:52 UTC 2020



> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Tuesday, January 28, 2020 4:09 AM
> To: Ville Syrjala <ville.syrjala at linux.intel.com>
> Cc: Intel Graphics Development <intel-gfx at lists.freedesktop.org>; Maling list - DRI
> developers <dri-devel at lists.freedesktop.org>
> Subject: Re: [Intel-gfx] [PATCH 8/8] drm/edid: Dump bogus 18 byte descriptors
> 
> On Fri, Jan 24, 2020 at 3:03 PM Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> >
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> >
> > I'm curious if there are any bogus 18 byte descriptors around.
> > Let's dump them out if we encounter them.
> >
> > Not sure we'd actually want this, but at least I get to see if our CI
> > has anything that hits this :)
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Acked-by: Alex Deucher <alexander.deucher at amd.com>

Looks good to me as well.
Reviewed-by: Uma Shankar <uma.shankar at intel.com>

> > ---
> >  drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++---
> >  1 file changed, 19 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index 8e76efe1654d..4d8303e56536 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -2202,6 +2202,12 @@ static bool is_display_descriptor(const u8 d[18], u8
> tag)
> >                 d[2] == 0x00 && d[3] == tag;  }
> >
> > +static bool is_any_display_descriptor(const u8 d[18]) {
> > +       return d[0] == 0x00 && d[1] == 0x00 &&
> > +               d[2] == 0x00;
> > +}
> > +
> >  static bool is_detailed_timing_descriptor(const u8 d[18])  {
> >         return d[0] != 0x00 || d[1] != 0x00; @@ -2209,6 +2215,15 @@
> > static bool is_detailed_timing_descriptor(const u8 d[18])
> >
> >  typedef void detailed_cb(const struct detailed_timing *timing, void
> > *closure);
> >
> > +static void do_detailed_block(const u8 d[18], detailed_cb *cb, void
> > +*closure) {
> > +       if (!is_detailed_timing_descriptor(d) &&
> > +           !is_any_display_descriptor(d))
> > +               DRM_WARN("Unrecognized 18 byte descriptor: %*ph\n",
> > +18, d);
> > +
> > +       cb((const struct detailed_timing *)d, closure); }
> > +
> >  static void
> >  cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void
> > *closure)  { @@ -2221,7 +2236,7 @@ cea_for_each_detailed_block(const
> > u8 *ext, detailed_cb *cb, void *closure)
> >
> >         n = (127 - d) / 18;
> >         for (i = 0; i < n; i++)
> > -               cb((const struct detailed_timing *)(det_base + 18 * i), closure);
> > +               do_detailed_block(det_base + 18 * i, cb, closure);
> >  }
> >
> >  static void
> > @@ -2234,7 +2249,7 @@ vtb_for_each_detailed_block(const u8 *ext, detailed_cb
> *cb, void *closure)
> >                 return; /* unknown version */
> >
> >         for (i = 0; i < n; i++)
> > -               cb((const struct detailed_timing *)(det_base + 18 * i), closure);
> > +               do_detailed_block(det_base + 18 * i, cb, closure);
> >  }
> >
> >  static void
> > @@ -2247,7 +2262,8 @@ drm_for_each_detailed_block(const u8 *raw_edid,
> detailed_cb *cb, void *closure)
> >                 return;
> >
> >         for (i = 0; i < EDID_DETAILED_TIMINGS; i++)
> > -               cb(&(edid->detailed_timings[i]), closure);
> > +               do_detailed_block((const u8 *)&edid->detailed_timings[i],
> > +                                 cb, closure);
> >
> >         for (i = 1; i <= raw_edid[0x7e]; i++) {
> >                 const u8 *ext = raw_edid + (i * EDID_LENGTH);
> > --
> > 2.24.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the dri-devel mailing list