aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_crtc.c13
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c38
-rw-r--r--drivers/gpu/drm/i915/intel_display.c18
3 files changed, 35 insertions, 34 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f6d04c7b5115..679b10e34fb5 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -525,17 +525,6 @@ void drm_framebuffer_reference(struct drm_framebuffer *fb)
525} 525}
526EXPORT_SYMBOL(drm_framebuffer_reference); 526EXPORT_SYMBOL(drm_framebuffer_reference);
527 527
528static void drm_framebuffer_free_bug(struct kref *kref)
529{
530 BUG();
531}
532
533static void __drm_framebuffer_unreference(struct drm_framebuffer *fb)
534{
535 DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount));
536 kref_put(&fb->refcount, drm_framebuffer_free_bug);
537}
538
539/** 528/**
540 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr 529 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
541 * @fb: fb to unregister 530 * @fb: fb to unregister
@@ -1320,7 +1309,7 @@ void drm_plane_force_disable(struct drm_plane *plane)
1320 return; 1309 return;
1321 } 1310 }
1322 /* disconnect the plane from the fb and crtc: */ 1311 /* disconnect the plane from the fb and crtc: */
1323 __drm_framebuffer_unreference(plane->old_fb); 1312 drm_framebuffer_unreference(plane->old_fb);
1324 plane->old_fb = NULL; 1313 plane->old_fb = NULL;
1325 plane->fb = NULL; 1314 plane->fb = NULL;
1326 plane->crtc = NULL; 1315 plane->crtc = NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5b205863b659..27ea6bdebce7 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2737,24 +2737,11 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring)
2737 2737
2738 WARN_ON(i915_verify_lists(ring->dev)); 2738 WARN_ON(i915_verify_lists(ring->dev));
2739 2739
2740 /* Move any buffers on the active list that are no longer referenced 2740 /* Retire requests first as we use it above for the early return.
2741 * by the ringbuffer to the flushing/inactive lists as appropriate, 2741 * If we retire requests last, we may use a later seqno and so clear
2742 * before we free the context associated with the requests. 2742 * the requests lists without clearing the active list, leading to
2743 * confusion.
2743 */ 2744 */
2744 while (!list_empty(&ring->active_list)) {
2745 struct drm_i915_gem_object *obj;
2746
2747 obj = list_first_entry(&ring->active_list,
2748 struct drm_i915_gem_object,
2749 ring_list);
2750
2751 if (!i915_gem_request_completed(obj->last_read_req, true))
2752 break;
2753
2754 i915_gem_object_move_to_inactive(obj);
2755 }
2756
2757
2758 while (!list_empty(&ring->request_list)) { 2745 while (!list_empty(&ring->request_list)) {
2759 struct drm_i915_gem_request *request; 2746 struct drm_i915_gem_request *request;
2760 struct intel_ringbuffer *ringbuf; 2747 struct intel_ringbuffer *ringbuf;
@@ -2789,6 +2776,23 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring)
2789 i915_gem_free_request(request); 2776 i915_gem_free_request(request);
2790 } 2777 }
2791 2778
2779 /* Move any buffers on the active list that are no longer referenced
2780 * by the ringbuffer to the flushing/inactive lists as appropriate,
2781 * before we free the context associated with the requests.
2782 */
2783 while (!list_empty(&ring->active_list)) {
2784 struct drm_i915_gem_object *obj;
2785
2786 obj = list_first_entry(&ring->active_list,
2787 struct drm_i915_gem_object,
2788 ring_list);
2789
2790 if (!i915_gem_request_completed(obj->last_read_req, true))
2791 break;
2792
2793 i915_gem_object_move_to_inactive(obj);
2794 }
2795
2792 if (unlikely(ring->trace_irq_req && 2796 if (unlikely(ring->trace_irq_req &&
2793 i915_gem_request_completed(ring->trace_irq_req, true))) { 2797 i915_gem_request_completed(ring->trace_irq_req, true))) {
2794 ring->irq_put(ring); 2798 ring->irq_put(ring);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6d22128d97b1..f75173c20f47 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2438,8 +2438,15 @@ intel_find_plane_obj(struct intel_crtc *intel_crtc,
2438 if (!intel_crtc->base.primary->fb) 2438 if (!intel_crtc->base.primary->fb)
2439 return; 2439 return;
2440 2440
2441 if (intel_alloc_plane_obj(intel_crtc, plane_config)) 2441 if (intel_alloc_plane_obj(intel_crtc, plane_config)) {
2442 struct drm_plane *primary = intel_crtc->base.primary;
2443
2444 primary->state->crtc = &intel_crtc->base;
2445 primary->crtc = &intel_crtc->base;
2446 update_state_fb(primary);
2447
2442 return; 2448 return;
2449 }
2443 2450
2444 kfree(intel_crtc->base.primary->fb); 2451 kfree(intel_crtc->base.primary->fb);
2445 intel_crtc->base.primary->fb = NULL; 2452 intel_crtc->base.primary->fb = NULL;
@@ -2462,11 +2469,15 @@ intel_find_plane_obj(struct intel_crtc *intel_crtc,
2462 continue; 2469 continue;
2463 2470
2464 if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) { 2471 if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) {
2472 struct drm_plane *primary = intel_crtc->base.primary;
2473
2465 if (obj->tiling_mode != I915_TILING_NONE) 2474 if (obj->tiling_mode != I915_TILING_NONE)
2466 dev_priv->preserve_bios_swizzle = true; 2475 dev_priv->preserve_bios_swizzle = true;
2467 2476
2468 drm_framebuffer_reference(c->primary->fb); 2477 drm_framebuffer_reference(c->primary->fb);
2469 intel_crtc->base.primary->fb = c->primary->fb; 2478 primary->fb = c->primary->fb;
2479 primary->state->crtc = &intel_crtc->base;
2480 primary->crtc = &intel_crtc->base;
2470 obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); 2481 obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
2471 break; 2482 break;
2472 } 2483 }
@@ -6663,7 +6674,6 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
6663 plane_config->size); 6674 plane_config->size);
6664 6675
6665 crtc->base.primary->fb = fb; 6676 crtc->base.primary->fb = fb;
6666 update_state_fb(crtc->base.primary);
6667} 6677}
6668 6678
6669static void chv_crtc_clock_get(struct intel_crtc *crtc, 6679static void chv_crtc_clock_get(struct intel_crtc *crtc,
@@ -7704,7 +7714,6 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
7704 plane_config->size); 7714 plane_config->size);
7705 7715
7706 crtc->base.primary->fb = fb; 7716 crtc->base.primary->fb = fb;
7707 update_state_fb(crtc->base.primary);
7708 return; 7717 return;
7709 7718
7710error: 7719error:
@@ -7798,7 +7807,6 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
7798 plane_config->size); 7807 plane_config->size);
7799 7808
7800 crtc->base.primary->fb = fb; 7809 crtc->base.primary->fb = fb;
7801 update_state_fb(crtc->base.primary);
7802} 7810}
7803 7811
7804static bool ironlake_get_pipe_config(struct intel_crtc *crtc, 7812static bool ironlake_get_pipe_config(struct intel_crtc *crtc,