summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-04-26 17:58:08 +0200
committerMichel Dänzer <michel@daenzer.net>2018-04-27 15:11:34 +0200
commit04947b83cce3a7782e59dece2c7797cc396c1e05 (patch)
tree4c112d05087610df3f8619d17d3dc796105106a7
parentfa30f4601de7a44edfb4a95873bd648946fd4292 (diff)
Wait for pending flips in drmmode_output_set_tear_free
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. Reviewed-by: Samuel Li <Samuel.Li@amd.com>
-rw-r--r--src/drmmode_display.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index cf1e5d1..49284c6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1750,6 +1750,15 @@ drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
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,
+ pAMDGPUEnt->fd,
+ drmmode_crtc->flip_pending);
drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
crtc->x, crtc->y);
}