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@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2010-11-05 09:58:45 +00:00
parent 52b32436b9
commit a44a63d2ff
2 changed files with 5 additions and 0 deletions

View File

@ -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.
*/

View File

@ -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;