[PATCH v2 1/5] present: If present_queue_vblank() fails, do present_execute().

Kenneth Graunke kenneth at whitecape.org
Thu Dec 18 18:57:57 PST 2014


Previously, if present_queue_vblank() failed, we simply dropped the
present request on the floor, and returned an error.  This was rather
mean to clients - after presenting, they wait for a PresentComplete
event to come back.  But since the present never happens, they end up
waiting forever, and lock up in poll().

This patch falls back to present_execute if present_queue_vblank fails.
We still print a debugging message to warn when queueing fails, which
allows us to continue debugging problems, but makes Present robust
enough to not lock up people's compositing manager when vblank bugs
happen.

v2: Don't do present_queue_vblank() /and/ present_execute() (a bug that
    snuck in during last minute tidying).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 present/present.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Whoops.  My original patch worked, and then I did some cleaning, and
much less testing on it.  It appeared to be working, but when I started
actually using my system, I discovered it was horribly broken.

This one should actually do what I meant.  Sorry for the mistake.

diff --git a/present/present.c b/present/present.c
index e27fe30..2a705a9 100644
--- a/present/present.c
+++ b/present/present.c
@@ -871,19 +871,18 @@ present_pixmap(WindowPtr window,
     vblank->queued = TRUE;
     if ((pixmap && target_msc >= crtc_msc) || (!pixmap && target_msc > crtc_msc)) {
         ret = present_queue_vblank(screen, target_crtc, vblank->event_id, target_msc);
-        if (ret != Success) {
-            xorg_list_del(&vblank->event_queue);
-            vblank->queued = FALSE;
-            goto failure;
-        }
-    } else
-        present_execute(vblank, ust, crtc_msc);
+        if (ret == Success)
+            return Success;
+
+        DebugPresent(("present_queue_vblank failed\n"));
+    }
+
+    present_execute(vblank, ust, crtc_msc);
 
     return Success;
 
 no_mem:
     ret = BadAlloc;
-failure:
     vblank->notifies = NULL;
     present_vblank_destroy(vblank);
     return ret;
-- 
2.1.3



More information about the xorg-devel mailing list