diff options
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_overlay.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index f1bf0b0c204c..b97c5c562aa1 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -375,12 +375,28 @@ static int intel_overlay_off(struct intel_overlay *overlay) | |||
375 | if (ret != 0) | 375 | if (ret != 0) |
376 | return ret; | 376 | return ret; |
377 | 377 | ||
378 | overlay->active = 0; | ||
379 | overlay->hw_wedged = 0; | 378 | overlay->hw_wedged = 0; |
380 | overlay->last_flip_req = 0; | 379 | overlay->last_flip_req = 0; |
381 | return ret; | 380 | return ret; |
382 | } | 381 | } |
383 | 382 | ||
383 | static void intel_overlay_off_tail(struct intel_overlay *overlay) | ||
384 | { | ||
385 | struct drm_gem_object *obj; | ||
386 | |||
387 | /* never have the overlay hw on without showing a frame */ | ||
388 | BUG_ON(!overlay->vid_bo); | ||
389 | obj = overlay->vid_bo->obj; | ||
390 | |||
391 | i915_gem_object_unpin(obj); | ||
392 | drm_gem_object_unreference(obj); | ||
393 | overlay->vid_bo = NULL; | ||
394 | |||
395 | overlay->crtc->overlay = NULL; | ||
396 | overlay->crtc = NULL; | ||
397 | overlay->active = 0; | ||
398 | } | ||
399 | |||
384 | /* recover from an interruption due to a signal | 400 | /* recover from an interruption due to a signal |
385 | * We have to be careful not to repeat work forever an make forward progess. */ | 401 | * We have to be careful not to repeat work forever an make forward progess. */ |
386 | int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, | 402 | int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, |
@@ -438,17 +454,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, | |||
438 | return ret; | 454 | return ret; |
439 | 455 | ||
440 | case SWITCH_OFF_STAGE_2: | 456 | case SWITCH_OFF_STAGE_2: |
441 | BUG_ON(!overlay->vid_bo); | 457 | intel_overlay_off_tail(overlay); |
442 | obj = overlay->vid_bo->obj; | ||
443 | |||
444 | i915_gem_object_unpin(obj); | ||
445 | drm_gem_object_unreference(obj); | ||
446 | overlay->vid_bo = NULL; | ||
447 | |||
448 | overlay->crtc->overlay = NULL; | ||
449 | overlay->crtc = NULL; | ||
450 | |||
451 | overlay->active = 0; | ||
452 | break; | 458 | break; |
453 | default: | 459 | default: |
454 | BUG_ON(overlay->hw_wedged != NEEDS_WAIT_FOR_FLIP); | 460 | BUG_ON(overlay->hw_wedged != NEEDS_WAIT_FOR_FLIP); |
@@ -831,7 +837,6 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) | |||
831 | { | 837 | { |
832 | int ret; | 838 | int ret; |
833 | struct overlay_registers *regs; | 839 | struct overlay_registers *regs; |
834 | struct drm_gem_object *obj; | ||
835 | struct drm_device *dev = overlay->dev; | 840 | struct drm_device *dev = overlay->dev; |
836 | 841 | ||
837 | BUG_ON(!mutex_is_locked(&dev->struct_mutex)); | 842 | BUG_ON(!mutex_is_locked(&dev->struct_mutex)); |
@@ -855,16 +860,7 @@ int intel_overlay_switch_off(struct intel_overlay *overlay) | |||
855 | if (ret != 0) | 860 | if (ret != 0) |
856 | return ret; | 861 | return ret; |
857 | 862 | ||
858 | /* never have the overlay hw on without showing a frame */ | 863 | intel_overlay_off_tail(overlay); |
859 | BUG_ON(!overlay->vid_bo); | ||
860 | obj = overlay->vid_bo->obj; | ||
861 | |||
862 | i915_gem_object_unpin(obj); | ||
863 | drm_gem_object_unreference(obj); | ||
864 | overlay->vid_bo = NULL; | ||
865 | |||
866 | overlay->crtc->overlay = NULL; | ||
867 | overlay->crtc = NULL; | ||
868 | 864 | ||
869 | return 0; | 865 | return 0; |
870 | } | 866 | } |