xf86-video-intel: src/intel_batchbuffer.c src/intel_display.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 5 03:09:05 PDT 2010


 src/intel_batchbuffer.c |    3 +++
 src/intel_display.c     |    2 ++
 2 files changed, 5 insertions(+)

New commits:
commit a44a63d2ff6c01c3dc61de6f736dd441ddd25e52
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 5 09:58:45 2010 +0000

    Wait for any pending rendering before switching modes.
    
    A perennial problem we have is the accursed WAIT_FOR_EVENT hangs, which
    occur when we switch the framebuffer before the WAIT_FOR_EVENT completes
    and upsets the GPU.
    
    We have tried more subtle approaches to detected these and fix them up in
    the kernel, to no avail. What we need to do is to delay the framebuffer
    flip until the WAIT completes, which is quite tricky in the kernel
    without new ioctls and round-trips. Instead, apply the big hammer from
    userspace and synchronise all rendering before changing the framebuffer.
    I expect this not to cause noticeable latency on switching modes (far
    less than the actual modeswitch) and should stop these hangs once and
    for all.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31401 (...)
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c
index fec5281..9f8ca6f 100644
--- a/src/intel_batchbuffer.c
+++ b/src/intel_batchbuffer.c
@@ -283,6 +283,9 @@ void intel_batch_wait_last(ScrnInfoPtr scrn)
 {
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 
+	if (intel->last_batch_bo == NULL)
+		return;
+
 	/* Map it CPU write, which guarantees it's done.  This is a completely
 	 * non performance path, so we don't need anything better.
 	 */
diff --git a/src/intel_display.c b/src/intel_display.c
index d32224e..7eef80b 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -359,6 +359,8 @@ intel_crtc_apply(xf86CrtcPtr crtc)
 			       crtc->gamma_blue, crtc->gamma_size);
 #endif
 
+	/* drain any pending waits on the current framebuffer */
+	intel_batch_wait_last(crtc->scrn);
 
 	x = crtc->x;
 	y = crtc->y;


More information about the xorg-commit mailing list