[PATCH xf86-video-ati 12/21] Wait for pending flips in drmmode_output_set_tear_free

Michel Dänzer michel at daenzer.net
Wed Jul 11 17:27:57 UTC 2018


From: Michel Dänzer <michel.daenzer at amd.com>

This prevents a nested call to drmHandleEvent, which would hang.

Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is
page flipping.

(Ported from amdgpu commit 04947b83cce3a7782e59dece2c7797cc396c1e05)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index ae605edaf..003fe51ef 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1754,6 +1754,14 @@ drmmode_output_set_tear_free(RADEONEntPtr pRADEONEnt,
 	drmmode_output->tear_free = tear_free;
 
 	if (crtc) {
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+
+		/* Wait for pending flips before drmmode_set_mode_major calls
+		 * drmmode_crtc_update_tear_free, to prevent a nested
+		 * drmHandleEvent call, which would hang
+		 */
+		drmmode_crtc_wait_pending_event(drmmode_crtc, pRADEONEnt->fd,
+						drmmode_crtc->flip_pending);
 		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
 				       crtc->x, crtc->y);
 	}
-- 
2.18.0



More information about the amd-gfx mailing list