Commit 0f91128d authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Wait for all pending operations to the fb before disabling the pipe

During modeset we have to disable the pipe to reconfigure its timings
and maybe its size. Userspace may have queued up command buffers that
depend upon the pipe running in a certain configuration and so the
commands may become confused across the modeset. At the moment, we use a
less than satisfactory kick-scanline-waits should the GPU hang during
the modeset. It should be more reliable to wait for the pending
operations to complete first, even though we still have a window for
userspace to submit a broken command buffer during the modeset.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 46f0f8d1
...@@ -3014,16 +3014,14 @@ static void intel_clear_scanline_wait(struct drm_device *dev) ...@@ -3014,16 +3014,14 @@ static void intel_clear_scanline_wait(struct drm_device *dev)
static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
{ {
struct drm_i915_gem_object *obj; struct drm_device *dev = crtc->dev;
struct drm_i915_private *dev_priv;
if (crtc->fb == NULL) if (crtc->fb == NULL)
return; return;
obj = to_intel_framebuffer(crtc->fb)->obj; mutex_lock(&dev->struct_mutex);
dev_priv = crtc->dev->dev_private; intel_finish_fb(crtc->fb);
wait_event(dev_priv->pending_flip_queue, mutex_unlock(&dev->struct_mutex);
atomic_read(&obj->pending_flip) == 0);
} }
static bool intel_crtc_driving_pch(struct drm_crtc *crtc) static bool intel_crtc_driving_pch(struct drm_crtc *crtc)
...@@ -3485,23 +3483,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc) ...@@ -3485,23 +3483,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
/* Flush any pending WAITs before we disable the pipe. Note that
* we need to drop the struct_mutex in order to acquire it again
* during the lowlevel dpms routines around a couple of the
* operations. It does not look trivial nor desirable to move
* that locking higher. So instead we leave a window for the
* submission of further commands on the fb before we can actually
* disable it. This race with userspace exists anyway, and we can
* only rely on the pipe being disabled by userspace after it
* receives the hotplug notification and has flushed any pending
* batches.
*/
if (crtc->fb) {
mutex_lock(&dev->struct_mutex);
intel_finish_fb(crtc->fb);
mutex_unlock(&dev->struct_mutex);
}
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane);
assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe);
......
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