diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-15 05:49:01 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-08-15 06:01:09 -0400 |
commit | 9b3b7841b86d54e95a43a747ee401883d218ebca (patch) | |
tree | da12ff86eb6df0160cc81ef41930336a234b86a0 /drivers/gpu/drm/i915/intel_overlay.c | |
parent | 57f275a22b0812b140bf2e581f5e9855f27b78f1 (diff) |
drm/i915/overlay: Use VMA as the primary tracker for images
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471254551-25805-22-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_overlay.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_overlay.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 90f3ab424e01..d930e3a4a9cd 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -171,8 +171,8 @@ struct overlay_registers { | |||
171 | struct intel_overlay { | 171 | struct intel_overlay { |
172 | struct drm_i915_private *i915; | 172 | struct drm_i915_private *i915; |
173 | struct intel_crtc *crtc; | 173 | struct intel_crtc *crtc; |
174 | struct drm_i915_gem_object *vid_bo; | 174 | struct i915_vma *vma; |
175 | struct drm_i915_gem_object *old_vid_bo; | 175 | struct i915_vma *old_vma; |
176 | bool active; | 176 | bool active; |
177 | bool pfit_active; | 177 | bool pfit_active; |
178 | u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */ | 178 | u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */ |
@@ -317,15 +317,17 @@ static void intel_overlay_release_old_vid_tail(struct i915_gem_active *active, | |||
317 | { | 317 | { |
318 | struct intel_overlay *overlay = | 318 | struct intel_overlay *overlay = |
319 | container_of(active, typeof(*overlay), last_flip); | 319 | container_of(active, typeof(*overlay), last_flip); |
320 | struct drm_i915_gem_object *obj = overlay->old_vid_bo; | 320 | struct i915_vma *vma; |
321 | 321 | ||
322 | i915_gem_track_fb(obj, NULL, | 322 | vma = fetch_and_zero(&overlay->old_vma); |
323 | INTEL_FRONTBUFFER_OVERLAY(overlay->crtc->pipe)); | 323 | if (WARN_ON(!vma)) |
324 | return; | ||
324 | 325 | ||
325 | i915_gem_object_ggtt_unpin(obj); | 326 | i915_gem_track_fb(vma->obj, NULL, |
326 | i915_gem_object_put(obj); | 327 | INTEL_FRONTBUFFER_OVERLAY(overlay->crtc->pipe)); |
327 | 328 | ||
328 | overlay->old_vid_bo = NULL; | 329 | i915_gem_object_unpin_from_display_plane(vma->obj, &i915_ggtt_view_normal); |
330 | i915_vma_put(vma); | ||
329 | } | 331 | } |
330 | 332 | ||
331 | static void intel_overlay_off_tail(struct i915_gem_active *active, | 333 | static void intel_overlay_off_tail(struct i915_gem_active *active, |
@@ -333,15 +335,15 @@ static void intel_overlay_off_tail(struct i915_gem_active *active, | |||
333 | { | 335 | { |
334 | struct intel_overlay *overlay = | 336 | struct intel_overlay *overlay = |
335 | container_of(active, typeof(*overlay), last_flip); | 337 | container_of(active, typeof(*overlay), last_flip); |
336 | struct drm_i915_gem_object *obj = overlay->vid_bo; | 338 | struct i915_vma *vma; |
337 | 339 | ||
338 | /* never have the overlay hw on without showing a frame */ | 340 | /* never have the overlay hw on without showing a frame */ |
339 | if (WARN_ON(!obj)) | 341 | vma = fetch_and_zero(&overlay->vma); |
342 | if (WARN_ON(!vma)) | ||
340 | return; | 343 | return; |
341 | 344 | ||
342 | i915_gem_object_ggtt_unpin(obj); | 345 | i915_gem_object_unpin_from_display_plane(vma->obj, &i915_ggtt_view_normal); |
343 | i915_gem_object_put(obj); | 346 | i915_vma_put(vma); |
344 | overlay->vid_bo = NULL; | ||
345 | 347 | ||
346 | overlay->crtc->overlay = NULL; | 348 | overlay->crtc->overlay = NULL; |
347 | overlay->crtc = NULL; | 349 | overlay->crtc = NULL; |
@@ -421,7 +423,7 @@ static int intel_overlay_release_old_vid(struct intel_overlay *overlay) | |||
421 | /* Only wait if there is actually an old frame to release to | 423 | /* Only wait if there is actually an old frame to release to |
422 | * guarantee forward progress. | 424 | * guarantee forward progress. |
423 | */ | 425 | */ |
424 | if (!overlay->old_vid_bo) | 426 | if (!overlay->old_vma) |
425 | return 0; | 427 | return 0; |
426 | 428 | ||
427 | if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) { | 429 | if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) { |
@@ -744,6 +746,7 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
744 | struct drm_i915_private *dev_priv = overlay->i915; | 746 | struct drm_i915_private *dev_priv = overlay->i915; |
745 | u32 swidth, swidthsw, sheight, ostride; | 747 | u32 swidth, swidthsw, sheight, ostride; |
746 | enum pipe pipe = overlay->crtc->pipe; | 748 | enum pipe pipe = overlay->crtc->pipe; |
749 | struct i915_vma *vma; | ||
747 | 750 | ||
748 | lockdep_assert_held(&dev_priv->drm.struct_mutex); | 751 | lockdep_assert_held(&dev_priv->drm.struct_mutex); |
749 | WARN_ON(!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex)); | 752 | WARN_ON(!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex)); |
@@ -757,6 +760,8 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
757 | if (ret != 0) | 760 | if (ret != 0) |
758 | return ret; | 761 | return ret; |
759 | 762 | ||
763 | vma = i915_gem_obj_to_ggtt_view(new_bo, &i915_ggtt_view_normal); | ||
764 | |||
760 | ret = i915_gem_object_put_fence(new_bo); | 765 | ret = i915_gem_object_put_fence(new_bo); |
761 | if (ret) | 766 | if (ret) |
762 | goto out_unpin; | 767 | goto out_unpin; |
@@ -834,11 +839,11 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay, | |||
834 | if (ret) | 839 | if (ret) |
835 | goto out_unpin; | 840 | goto out_unpin; |
836 | 841 | ||
837 | i915_gem_track_fb(overlay->vid_bo, new_bo, | 842 | i915_gem_track_fb(overlay->vma->obj, new_bo, |
838 | INTEL_FRONTBUFFER_OVERLAY(pipe)); | 843 | INTEL_FRONTBUFFER_OVERLAY(pipe)); |
839 | 844 | ||
840 | overlay->old_vid_bo = overlay->vid_bo; | 845 | overlay->old_vma = overlay->vma; |
841 | overlay->vid_bo = new_bo; | 846 | overlay->vma = vma; |
842 | 847 | ||
843 | intel_frontbuffer_flip(dev_priv, INTEL_FRONTBUFFER_OVERLAY(pipe)); | 848 | intel_frontbuffer_flip(dev_priv, INTEL_FRONTBUFFER_OVERLAY(pipe)); |
844 | 849 | ||