aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_irq.c')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index b8e509ae065e..8a9e08bf1cf7 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
277int i915_get_vblank_timestamp(struct drm_device *dev, int crtc, 277int 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/*
@@ -305,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work)
305 struct drm_mode_config *mode_config = &dev->mode_config; 316 struct drm_mode_config *mode_config = &dev->mode_config;
306 struct intel_encoder *encoder; 317 struct intel_encoder *encoder;
307 318
319 DRM_DEBUG_KMS("running encoder hotplug functions\n");
320
308 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) 321 list_for_each_entry(encoder, &mode_config->encoder_list, base.head)
309 if (encoder->hot_plug) 322 if (encoder->hot_plug)
310 encoder->hot_plug(encoder); 323 encoder->hot_plug(encoder);
@@ -348,8 +361,12 @@ static void notify_ring(struct drm_device *dev,
348 struct intel_ring_buffer *ring) 361 struct intel_ring_buffer *ring)
349{ 362{
350 struct drm_i915_private *dev_priv = dev->dev_private; 363 struct drm_i915_private *dev_priv = dev->dev_private;
351 u32 seqno = ring->get_seqno(ring); 364 u32 seqno;
352 365
366 if (ring->obj == NULL)
367 return;
368
369 seqno = ring->get_seqno(ring);
353 trace_i915_gem_request_complete(dev, seqno); 370 trace_i915_gem_request_complete(dev, seqno);
354 371
355 ring->irq_seqno = seqno; 372 ring->irq_seqno = seqno;
@@ -831,6 +848,8 @@ static void i915_capture_error_state(struct drm_device *dev)
831 i++; 848 i++;
832 error->pinned_bo_count = i - error->active_bo_count; 849 error->pinned_bo_count = i - error->active_bo_count;
833 850
851 error->active_bo = NULL;
852 error->pinned_bo = NULL;
834 if (i) { 853 if (i) {
835 error->active_bo = kmalloc(sizeof(*error->active_bo)*i, 854 error->active_bo = kmalloc(sizeof(*error->active_bo)*i,
836 GFP_ATOMIC); 855 GFP_ATOMIC);
@@ -1179,18 +1198,18 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
1179 intel_finish_page_flip_plane(dev, 1); 1198 intel_finish_page_flip_plane(dev, 1);
1180 } 1199 }
1181 1200
1182 if (pipea_stats & vblank_status) { 1201 if (pipea_stats & vblank_status &&
1202 drm_handle_vblank(dev, 0)) {
1183 vblank++; 1203 vblank++;
1184 drm_handle_vblank(dev, 0);
1185 if (!dev_priv->flip_pending_is_done) { 1204 if (!dev_priv->flip_pending_is_done) {
1186 i915_pageflip_stall_check(dev, 0); 1205 i915_pageflip_stall_check(dev, 0);
1187 intel_finish_page_flip(dev, 0); 1206 intel_finish_page_flip(dev, 0);
1188 } 1207 }
1189 } 1208 }
1190 1209
1191 if (pipeb_stats & vblank_status) { 1210 if (pipeb_stats & vblank_status &&
1211 drm_handle_vblank(dev, 1)) {
1192 vblank++; 1212 vblank++;
1193 drm_handle_vblank(dev, 1);
1194 if (!dev_priv->flip_pending_is_done) { 1213 if (!dev_priv->flip_pending_is_done) {
1195 i915_pageflip_stall_check(dev, 1); 1214 i915_pageflip_stall_check(dev, 1);
1196 intel_finish_page_flip(dev, 1); 1215 intel_finish_page_flip(dev, 1);
@@ -1278,12 +1297,12 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
1278 if (master_priv->sarea_priv) 1297 if (master_priv->sarea_priv)
1279 master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT; 1298 master_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
1280 1299
1281 ret = -ENODEV;
1282 if (ring->irq_get(ring)) { 1300 if (ring->irq_get(ring)) {
1283 DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ, 1301 DRM_WAIT_ON(ret, ring->irq_queue, 3 * DRM_HZ,
1284 READ_BREADCRUMB(dev_priv) >= irq_nr); 1302 READ_BREADCRUMB(dev_priv) >= irq_nr);
1285 ring->irq_put(ring); 1303 ring->irq_put(ring);
1286 } 1304 } else if (wait_for(READ_BREADCRUMB(dev_priv) >= irq_nr, 3000))
1305 ret = -EBUSY;
1287 1306
1288 if (ret == -EBUSY) { 1307 if (ret == -EBUSY) {
1289 DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", 1308 DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
@@ -1632,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
1632 } else { 1651 } else {
1633 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | 1652 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |
1634 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; 1653 SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG;
1635 hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; 1654 hotplug_mask |= SDE_AUX_MASK;
1636 I915_WRITE(FDI_RXA_IMR, 0);
1637 I915_WRITE(FDI_RXB_IMR, 0);
1638 } 1655 }
1639 1656
1640 dev_priv->pch_irq_mask = ~hotplug_mask; 1657 dev_priv->pch_irq_mask = ~hotplug_mask;