[Nouveau] [PATCH 2/2] present: fix handling of drmWaitVBlank failures

Ilia Mirkin imirkin at alum.mit.edu
Sun Aug 16 03:23:36 UTC 2020


When drmWaitVBlank fails, make sure to remove the event from the queue.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Note this needs a bit more testing, and also double-checking what the
"correct" way of dealing with these errors is. I was able to trigger
errors with "xset dpms force off", but perhaps there are also other
conditions.

 src/nouveau_present.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/nouveau_present.c b/src/nouveau_present.c
index 8167fd8..15516d6 100644
--- a/src/nouveau_present.c
+++ b/src/nouveau_present.c
@@ -113,8 +113,19 @@ nouveau_present_vblank_queue(RRCrtcPtr rrcrtc, uint64_t event_id, uint64_t msc)
 	args.request.signal = (unsigned long)token;
 
 	while ((ret = drmWaitVBlank(pNv->dev->fd, &args)) != 0) {
-		if (errno != EBUSY || drmmode_event_flush(crtc->scrn) < 0)
+		if (errno != EBUSY) {
+			xf86DrvMsg(crtc->scrn->scrnIndex, X_DEBUG,
+				   "PRESENT: Wait for VBlank failed: %s\n", strerror(errno));
+			drmmode_event_abort(crtc->scrn, event_id, false);
 			return BadAlloc;
+		}
+		ret = drmmode_event_flush(crtc->scrn);
+		if (ret < 0) {
+			xf86DrvMsg(crtc->scrn->scrnIndex, X_DEBUG,
+				   "PRESENT: Event flush failed\n");
+			drmmode_event_abort(crtc->scrn, event_id, false);
+			return BadAlloc;
+		}
 	}
 
 	return Success;
-- 
2.26.2



More information about the Nouveau mailing list