Commit e6c3a2a6 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Use an uninterruptible wait for page-flips during modeset

We need to drain the pending flips prior to disabling the pipe during
modeset, and these need to be done in an uninterruptible fashion.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent d3849ede
...@@ -1023,9 +1023,6 @@ int i915_do_wait_request(struct drm_device *dev, ...@@ -1023,9 +1023,6 @@ int i915_do_wait_request(struct drm_device *dev,
uint32_t seqno, uint32_t seqno,
bool interruptible, bool interruptible,
struct intel_ring_buffer *ring); struct intel_ring_buffer *ring);
int i915_gem_wait_for_pending_flip(struct drm_device *dev,
struct drm_gem_object **object_list,
int count);
int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
int write); int write);
......
...@@ -3506,7 +3506,7 @@ i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer2 *exec, ...@@ -3506,7 +3506,7 @@ i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer2 *exec,
return 0; return 0;
} }
int static int
i915_gem_wait_for_pending_flip(struct drm_device *dev, i915_gem_wait_for_pending_flip(struct drm_device *dev,
struct drm_gem_object **object_list, struct drm_gem_object **object_list,
int count) int count)
......
...@@ -1593,17 +1593,12 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -1593,17 +1593,12 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
} }
if (old_fb) { if (old_fb) {
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_gem_object *obj = to_intel_framebuffer(old_fb)->obj; struct drm_gem_object *obj = to_intel_framebuffer(old_fb)->obj;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (atomic_read(&obj_priv->pending_flip)) { wait_event(dev_priv->pending_flip_queue,
ret = i915_gem_wait_for_pending_flip(dev, &obj, 1); atomic_read(&obj_priv->pending_flip) == 0);
if (ret) {
i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj);
mutex_unlock(&dev->struct_mutex);
return ret;
}
}
} }
ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y); ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y);
...@@ -1954,6 +1949,20 @@ static void intel_clear_scanline_wait(struct drm_device *dev) ...@@ -1954,6 +1949,20 @@ static void intel_clear_scanline_wait(struct drm_device *dev)
} }
} }
static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
{
struct drm_i915_gem_object *obj_priv;
struct drm_i915_private *dev_priv;
if (crtc->fb == NULL)
return;
obj_priv = to_intel_bo(to_intel_framebuffer(crtc->fb)->obj);
dev_priv = crtc->dev->dev_private;
wait_event(dev_priv->pending_flip_queue,
atomic_read(&obj_priv->pending_flip) == 0);
}
static void ironlake_crtc_enable(struct drm_crtc *crtc) static void ironlake_crtc_enable(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -2130,6 +2139,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) ...@@ -2130,6 +2139,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
if (!intel_crtc->active) if (!intel_crtc->active)
return; return;
intel_crtc_wait_for_pending_flips(crtc);
drm_vblank_off(dev, pipe); drm_vblank_off(dev, pipe);
intel_crtc_update_cursor(crtc, false); intel_crtc_update_cursor(crtc, false);
...@@ -2377,9 +2387,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) ...@@ -2377,9 +2387,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
return; return;
/* Give the overlay scaler a chance to disable if it's on this pipe */ /* Give the overlay scaler a chance to disable if it's on this pipe */
intel_crtc_wait_for_pending_flips(crtc);
drm_vblank_off(dev, pipe);
intel_crtc_dpms_overlay(intel_crtc, false); intel_crtc_dpms_overlay(intel_crtc, false);
intel_crtc_update_cursor(crtc, false); intel_crtc_update_cursor(crtc, false);
drm_vblank_off(dev, pipe);
if (dev_priv->cfb_plane == plane && if (dev_priv->cfb_plane == plane &&
dev_priv->display.disable_fbc) dev_priv->display.disable_fbc)
......
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