[PATCH 0/3] drm: Basic mode sanity checks
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Wed Dec 17 03:56:21 PST 2014
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
We had a bug in i915 land recently where X passed in a zeroed mode with
mode_valid=1 to setcrtc. That didn't go down so well and caused a
div-by-zero in i915.
For a long time I've been thinking that we need some real checks to
validate the modes we feed into the hardware. I started to sketch out
something for that but it quickly turned into a bit of a nightmare
with the whole panel fitter, stereo 3D, SDVO etc. special cases we
have in i915.
So I gave up on that for now, and instead cooked up this small series
to add some basic sanity checks to the mode validation, and also apply
the same sanity checks to user provided modes. This is enough to
prevent the div-by-zero in i915 with buggy X.
The risk is that we start to reject some modes that more or less worked
by accident before. Given how lax we've been in handling the panel fitter
on i915 for instance, this could be a real problem if people have been
useing custom modes that have been filled out only partially. But I'm
hoping the number of users doing that is so small that we can risk it.
The other concern is drivers which might also provide funky modes from
their .get_modes(). I tried to look at all the drivers a bit, and most
produce modes via EDID, CVT, DMT, or drm_display_mode_from_videomode().
All of those look safe, except mode->clock might be an issue with
drm_display_mode_from_videomode(), but hopefully there's some kind of
clock provided in most cases. I didn't dig through all the nooks and
crannies in all drivers though, so may have missed something.
Ville Syrjälä (3):
drm: Reorganize probed mode validation
drm: Perform basic sanity checks on probed modes
drm: Do basic sanity checks for user modes
drivers/gpu/drm/drm_crtc.c | 6 ++++
drivers/gpu/drm/drm_modes.c | 56 ++++++++++++++++++++++++++++++--------
drivers/gpu/drm/drm_probe_helper.c | 43 ++++++++++++++---------------
include/drm/drm_modes.h | 6 ++--
4 files changed, 74 insertions(+), 37 deletions(-)
--
2.0.4
More information about the dri-devel
mailing list