diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_irq.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b8e509ae065e..97f946dcc1aa 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 | /* |
@@ -348,8 +359,12 @@ static void notify_ring(struct drm_device *dev, | |||
348 | struct intel_ring_buffer *ring) | 359 | struct intel_ring_buffer *ring) |
349 | { | 360 | { |
350 | struct drm_i915_private *dev_priv = dev->dev_private; | 361 | struct drm_i915_private *dev_priv = dev->dev_private; |
351 | u32 seqno = ring->get_seqno(ring); | 362 | u32 seqno; |
352 | 363 | ||
364 | if (ring->obj == NULL) | ||
365 | return; | ||
366 | |||
367 | seqno = ring->get_seqno(ring); | ||
353 | trace_i915_gem_request_complete(dev, seqno); | 368 | trace_i915_gem_request_complete(dev, seqno); |
354 | 369 | ||
355 | ring->irq_seqno = seqno; | 370 | ring->irq_seqno = seqno; |
@@ -831,6 +846,8 @@ static void i915_capture_error_state(struct drm_device *dev) | |||
831 | i++; | 846 | i++; |
832 | error->pinned_bo_count = i - error->active_bo_count; | 847 | error->pinned_bo_count = i - error->active_bo_count; |
833 | 848 | ||
849 | error->active_bo = NULL; | ||
850 | error->pinned_bo = NULL; | ||
834 | if (i) { | 851 | if (i) { |
835 | error->active_bo = kmalloc(sizeof(*error->active_bo)*i, | 852 | error->active_bo = kmalloc(sizeof(*error->active_bo)*i, |
836 | GFP_ATOMIC); | 853 | GFP_ATOMIC); |
@@ -1179,18 +1196,18 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
1179 | intel_finish_page_flip_plane(dev, 1); | 1196 | intel_finish_page_flip_plane(dev, 1); |
1180 | } | 1197 | } |
1181 | 1198 | ||
1182 | if (pipea_stats & vblank_status) { | 1199 | if (pipea_stats & vblank_status && |
1200 | drm_handle_vblank(dev, 0)) { | ||
1183 | vblank++; | 1201 | vblank++; |
1184 | drm_handle_vblank(dev, 0); | ||
1185 | if (!dev_priv->flip_pending_is_done) { | 1202 | if (!dev_priv->flip_pending_is_done) { |
1186 | i915_pageflip_stall_check(dev, 0); | 1203 | i915_pageflip_stall_check(dev, 0); |
1187 | intel_finish_page_flip(dev, 0); | 1204 | intel_finish_page_flip(dev, 0); |
1188 | } | 1205 | } |
1189 | } | 1206 | } |
1190 | 1207 | ||
1191 | if (pipeb_stats & vblank_status) { | 1208 | if (pipeb_stats & vblank_status && |
1209 | drm_handle_vblank(dev, 1)) { | ||
1192 | vblank++; | 1210 | vblank++; |
1193 | drm_handle_vblank(dev, 1); | ||
1194 | if (!dev_priv->flip_pending_is_done) { | 1211 | if (!dev_priv->flip_pending_is_done) { |
1195 | i915_pageflip_stall_check(dev, 1); | 1212 | i915_pageflip_stall_check(dev, 1); |
1196 | intel_finish_page_flip(dev, 1); | 1213 | intel_finish_page_flip(dev, 1); |
@@ -1278,12 +1295,12 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) | |||
1278 | if (master_priv->sarea_priv) | 1295 | if (master_priv->sarea_priv) |
1279 | master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; | 1296 | master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; |
1280 | 1297 | ||
1281 | ret = -ENODEV; | ||
1282 | if (ring->irq_get(ring)) { | 1298 | if (ring->irq_get(ring)) { |
1283 | DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, | 1299 | DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, |
1284 | READ_BREADCRUMB(dev_priv) >= irq_nr); | 1300 | READ_BREADCRUMB(dev_priv) >= irq_nr); |
1285 | ring->irq_put(ring); | 1301 | ring->irq_put(ring); |
1286 | } | 1302 | } else if (wait_for(READ_BREADCRUMB(dev_priv) >= irq_nr, 3000)) |
1303 | ret = -EBUSY; | ||
1287 | 1304 | ||
1288 | if (ret == -EBUSY) { | 1305 | if (ret == -EBUSY) { |
1289 | DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", | 1306 | DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", |