summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHai Lan <hai.lan@intel.com>2012-02-15 12:07:02 +0100
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-23 17:56:40 +0100
commit4e9bb47bd29e02f2daaa7bdb2a8ddf977bf76f06 (patch)
treea6067cdb859c1baee586136bbb43c7c822a66b79 /drivers/gpu
parentdrm/i915: fix mode set on load pipe. (v2) (diff)
downloadlinux-4e9bb47bd29e02f2daaa7bdb2a8ddf977bf76f06.tar.xz
linux-4e9bb47bd29e02f2daaa7bdb2a8ddf977bf76f06.zip
drm/i915: fix a sprite watermark computation to avoid divide by zero if xpos<0
When setting overlay position with x<0, it will divide 0 and make drm driver crash. Signed-off-by: Hai Lan <hai.lan@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f3afec2854d8..e654f32de197 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4680,8 +4680,17 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane,
crtc = intel_get_crtc_for_plane(dev, plane);
clock = crtc->mode.clock;
+ if (!clock) {
+ *sprite_wm = 0;
+ return false;
+ }
line_time_us = (sprite_width * 1000) / clock;
+ if (!line_time_us) {
+ *sprite_wm = 0;
+ return false;
+ }
+
line_count = (latency_ns / line_time_us + 1000) / 1000;
line_size = sprite_width * pixel_size;