[Intel-gfx] [PATCH 38/38] drm/i915/overlay: Use VMA as the primary tracker for images

Chris Wilson chris at chris-wilson.co.uk
Fri Jun 3 16:55:53 UTC 2016


Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_overlay.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c
index 75bdd335d565..ad57149f4809 100644
--- a/drivers/gpu/drm/i915/intel_overlay.c
+++ b/drivers/gpu/drm/i915/intel_overlay.c
@@ -170,8 +170,7 @@ struct overlay_registers {
 struct intel_overlay {
 	struct drm_i915_private *i915;
 	struct intel_crtc *crtc;
-	struct drm_i915_gem_object *vid_bo, *old_vid_bo;
-	struct i915_vma *vid_vma, *old_vid_vma;
+	struct i915_vma *vma, *old_vma;
 	bool active;
 	bool pfit_active;
 	u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */
@@ -314,24 +313,21 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
 
 static void intel_overlay_release_old_vid_tail(struct intel_overlay *overlay)
 {
-	struct drm_i915_gem_object *obj = overlay->old_vid_bo;
+	i915_gem_object_unpin_from_display_plane(overlay->old_vma);
+	i915_gem_object_put(overlay->old_vma->obj);
 
-	i915_gem_object_unpin_from_display_plane(overlay->old_vid_vma);
-	i915_gem_object_put(obj);
-
-	overlay->old_vid_bo = NULL;
+	overlay->old_vma = NULL;
 }
 
 static void intel_overlay_off_tail(struct intel_overlay *overlay)
 {
 	/* never have the overlay hw on without showing a frame */
-	if (WARN_ON(overlay->vid_vma))
+	if (WARN_ON(overlay->vma))
 		return;
 
-	i915_gem_object_unpin_from_display_plane(overlay->vid_vma);
-	i915_gem_object_put(overlay->vid_bo);
-	overlay->vid_vma = NULL;
-	overlay->vid_bo = NULL;
+	i915_gem_object_unpin_from_display_plane(overlay->vma);
+	i915_gem_object_put(overlay->vma->obj);
+	overlay->vma = NULL;
 
 	overlay->crtc->overlay = NULL;
 	overlay->crtc = NULL;
@@ -422,7 +418,7 @@ static int intel_overlay_release_old_vid(struct intel_overlay *overlay)
 	/* Only wait if there is actually an old frame to release to
 	 * guarantee forward progress.
 	 */
-	if (!overlay->old_vid_bo)
+	if (!overlay->old_vma)
 		return 0;
 
 	if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) {
@@ -455,7 +451,7 @@ static int intel_overlay_release_old_vid(struct intel_overlay *overlay)
 	intel_overlay_release_old_vid_tail(overlay);
 
 
-	i915_gem_track_fb(overlay->old_vid_bo, NULL,
+	i915_gem_track_fb(overlay->old_vma->obj, NULL,
 			  INTEL_FRONTBUFFER_OVERLAY(overlay->crtc->pipe));
 	return 0;
 }
@@ -841,13 +837,11 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
 	if (ret)
 		goto out_unpin;
 
-	i915_gem_track_fb(overlay->vid_bo, new_bo,
+	i915_gem_track_fb(overlay->vma->obj, new_bo,
 			  INTEL_FRONTBUFFER_OVERLAY(pipe));
 
-	overlay->old_vid_bo = overlay->vid_bo;
-	overlay->old_vid_vma = overlay->vid_vma;
-	overlay->vid_bo = new_bo;
-	overlay->vid_vma = vma;
+	overlay->old_vma = overlay->vma;
+	overlay->vma = vma;
 
 	intel_frontbuffer_flip(dev_priv->dev, INTEL_FRONTBUFFER_OVERLAY(pipe));
 
-- 
2.8.1



More information about the Intel-gfx mailing list