diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-22 05:07:56 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-01-24 13:26:30 -0500 |
commit | 4041b85323ca00faaf8cdae22ac5cc16f1af2451 (patch) | |
tree | da7b5ca9716c388118ecc58dccd2bc87134b0cc3 /drivers/gpu/drm/i915 | |
parent | bee4a186c16bed0d7e91425ca9356c2e8c015f8d (diff) |
drm/i915: Increase the amount of defense before computing vblank timestamps
Reported-by: Chris Clayton <chris2553@googlemail.com>
Tested-by: Chris Clayton <chris2553@googlemail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index f0c87bdfa6fa..98106b7efa8b 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -274,24 +274,35 @@ int i915_get_crtc_scanoutpos(struct drm_device *dev, int pipe, | |||
274 | return ret; | 274 | return ret; |
275 | } | 275 | } |
276 | 276 | ||
277 | int i915_get_vblank_timestamp(struct drm_device *dev, int crtc, | 277 | int i915_get_vblank_timestamp(struct drm_device *dev, int pipe, |
278 | int *max_error, | 278 | int *max_error, |
279 | struct timeval *vblank_time, | 279 | struct timeval *vblank_time, |
280 | unsigned flags) | 280 | unsigned flags) |
281 | { | 281 | { |
282 | struct drm_crtc *drmcrtc; | 282 | struct drm_i915_private *dev_priv = dev->dev_private; |
283 | struct drm_crtc *crtc; | ||
283 | 284 | ||
284 | if (crtc < 0 || crtc >= dev->num_crtcs) { | 285 | if (pipe < 0 || pipe >= dev_priv->num_pipe) { |
285 | DRM_ERROR("Invalid crtc %d\n", crtc); | 286 | DRM_ERROR("Invalid crtc %d\n", pipe); |
286 | return -EINVAL; | 287 | return -EINVAL; |
287 | } | 288 | } |
288 | 289 | ||
289 | /* Get drm_crtc to timestamp: */ | 290 | /* Get drm_crtc to timestamp: */ |
290 | drmcrtc = intel_get_crtc_for_pipe(dev, crtc); | 291 | crtc = intel_get_crtc_for_pipe(dev, pipe); |
292 | if (crtc == NULL) { | ||
293 | DRM_ERROR("Invalid crtc %d\n", pipe); | ||
294 | return -EINVAL; | ||
295 | } | ||
296 | |||
297 | if (!crtc->enabled) { | ||
298 | DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); | ||
299 | return -EBUSY; | ||
300 | } | ||
291 | 301 | ||
292 | /* Helper routine in DRM core does all the work: */ | 302 | /* Helper routine in DRM core does all the work: */ |
293 | return drm_calc_vbltimestamp_from_scanoutpos(dev, crtc, max_error, | 303 | return drm_calc_vbltimestamp_from_scanoutpos(dev, pipe, max_error, |
294 | vblank_time, flags, drmcrtc); | 304 | vblank_time, flags, |
305 | crtc); | ||
295 | } | 306 | } |
296 | 307 | ||
297 | /* | 308 | /* |