[PATCH 1/2] drm/i915: add sanity checks for hsync and htotal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Restrict hsync start, end, hdisplay and htotal to be according to hw
spec. Through drm_mode_set_crtcinfo(), these will also limit hblank start,
end.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>

---

Let's see if this will be frowned upon... seems better to have these
separate from the follow-up workaround patch, which addresses a specific hw
constraint.

Embarrassingly, I have to acknowledge I didn't test this. I seem to have
trouble with creating an initrd that would tackle the disk encryption that
I have on this laptop I'm currently restricted to. *sigh*.
---
 drivers/gpu/drm/i915/intel_display.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9730162..ada736d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3420,6 +3420,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
 	if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
 		drm_mode_set_crtcinfo(adjusted_mode, 0);
 
+	if (adjusted_mode->hsync_start < adjusted_mode->hdisplay ||
+		adjusted_mode->hsync_end > adjusted_mode->htotal ||
+		adjusted_mode->hsync_start >= adjusted_mode->hsync_end)
+		return false;
+
 	return true;
 }
 
-- 
1.7.4.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux