Commit 5cd68c98 authored by Chris Wilson's avatar Chris Wilson

drm/i915/overlay: Tidy release_old_vid()

Inline the call to wait_flip() and simplify the resulting code.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8dfbc340
...@@ -290,36 +290,6 @@ static void intel_overlay_continue(struct intel_overlay *overlay, ...@@ -290,36 +290,6 @@ static void intel_overlay_continue(struct intel_overlay *overlay,
i915_add_request(dev, NULL, &dev_priv->render_ring); i915_add_request(dev, NULL, &dev_priv->render_ring);
} }
static int intel_overlay_wait_flip(struct intel_overlay *overlay)
{
struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private;
int ret;
u32 tmp;
if (overlay->last_flip_req != 0) {
ret = i915_do_wait_request(dev,
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret == 0) {
overlay->last_flip_req = 0;
tmp = I915_READ(ISR);
if (!(tmp & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT))
return 0;
}
}
/* synchronous slowpath */
BEGIN_LP_RING(2);
OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
return intel_overlay_do_wait_request(overlay, true, RELEASE_OLD_VID);
}
/* overlay needs to be disabled in OCMD reg */ /* overlay needs to be disabled in OCMD reg */
static int intel_overlay_off(struct intel_overlay *overlay) static int intel_overlay_off(struct intel_overlay *overlay)
{ {
...@@ -348,6 +318,16 @@ static int intel_overlay_off(struct intel_overlay *overlay) ...@@ -348,6 +318,16 @@ static int intel_overlay_off(struct intel_overlay *overlay)
return intel_overlay_do_wait_request(overlay, true, SWITCH_OFF); return intel_overlay_do_wait_request(overlay, true, SWITCH_OFF);
} }
static void intel_overlay_release_old_vid_tail(struct intel_overlay *overlay)
{
struct drm_gem_object *obj = &overlay->old_vid_bo->base;
i915_gem_object_unpin(obj);
drm_gem_object_unreference(obj);
overlay->old_vid_bo = NULL;
}
static void intel_overlay_off_tail(struct intel_overlay *overlay) static void intel_overlay_off_tail(struct intel_overlay *overlay)
{ {
struct drm_gem_object *obj; struct drm_gem_object *obj;
...@@ -372,7 +352,6 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, ...@@ -372,7 +352,6 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
{ {
struct drm_device *dev = overlay->dev; struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_gem_object *obj;
int ret; int ret;
if (overlay->hw_wedged == HW_WEDGED) if (overlay->hw_wedged == HW_WEDGED)
...@@ -385,10 +364,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, ...@@ -385,10 +364,7 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
switch (overlay->hw_wedged) { switch (overlay->hw_wedged) {
case RELEASE_OLD_VID: case RELEASE_OLD_VID:
obj = &overlay->old_vid_bo->base; intel_overlay_release_old_vid_tail(overlay);
i915_gem_object_unpin(obj);
drm_gem_object_unreference(obj);
overlay->old_vid_bo = NULL;
break; break;
case SWITCH_OFF: case SWITCH_OFF:
...@@ -410,23 +386,30 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay, ...@@ -410,23 +386,30 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
*/ */
static int intel_overlay_release_old_vid(struct intel_overlay *overlay) static int intel_overlay_release_old_vid(struct intel_overlay *overlay)
{ {
struct drm_device *dev = overlay->dev;
drm_i915_private_t *dev_priv = dev->dev_private;
int ret; int ret;
struct drm_gem_object *obj;
/* only wait if there is actually an old frame to release to /* Only wait if there is actually an old frame to release to
* guarantee forward progress */ * guarantee forward progress.
*/
if (!overlay->old_vid_bo) if (!overlay->old_vid_bo)
return 0; return 0;
ret = intel_overlay_wait_flip(overlay); if (I915_READ(ISR) & I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT) {
if (ret != 0) /* synchronous slowpath */
return ret; BEGIN_LP_RING(2);
OUT_RING(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
OUT_RING(MI_NOOP);
ADVANCE_LP_RING();
obj = &overlay->old_vid_bo->base; ret = intel_overlay_do_wait_request(overlay, true,
i915_gem_object_unpin(obj); RELEASE_OLD_VID);
drm_gem_object_unreference(obj); if (ret)
overlay->old_vid_bo = NULL; return ret;
}
intel_overlay_release_old_vid_tail(overlay);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment