xf86-video-amdgpu: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Fri Apr 27 15:58:17 UTC 2018


 src/drmmode_display.c |   40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

New commits:
commit 04947b83cce3a7782e59dece2c7797cc396c1e05
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Apr 26 17:58:08 2018 +0200

    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 at amd.com>

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);
 	}
commit fa30f4601de7a44edfb4a95873bd648946fd4292
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Apr 26 17:55:30 2018 +0200

    Refactor drmmode_output_set_tear_free helper
    
    Preparation for the following fix, no functional change intended.
    
    Reviewed-by: Samuel Li <Samuel.Li at amd.com>

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 793027d..cf1e5d1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1739,6 +1739,22 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
 	}
 }
 
+static void
+drmmode_output_set_tear_free(AMDGPUEntPtr pAMDGPUEnt,
+			     drmmode_output_private_ptr drmmode_output,
+			     xf86CrtcPtr crtc, int tear_free)
+{
+	if (drmmode_output->tear_free == tear_free)
+		return;
+
+	drmmode_output->tear_free = tear_free;
+
+	if (crtc) {
+		drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation,
+				       crtc->x, crtc->y);
+	}
+}
+
 static Bool
 drmmode_output_set_property(xf86OutputPtr output, Atom property,
 			    RRPropertyValuePtr value)
@@ -1782,18 +1798,9 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
 			for (j = 0; j < p->mode_prop->count_enums; j++) {
 				if (!strcmp(p->mode_prop->enums[j].name, name)) {
 					if (i == (drmmode_output->num_props - 1)) {
-						if (drmmode_output->tear_free != j) {
-							xf86CrtcPtr crtc = output->crtc;
-
-							drmmode_output->tear_free = j;
-							if (crtc) {
-								drmmode_set_mode_major(crtc,
-										       &crtc->mode,
-										       crtc->rotation,
-										       crtc->x,
-										       crtc->y);
-							}
-						}
+						drmmode_output_set_tear_free(pAMDGPUEnt,
+									     drmmode_output,
+									     output->crtc, j);
 					} else {
 						drmModeConnectorSetProperty(pAMDGPUEnt->fd,
 									    drmmode_output->output_id,


More information about the xorg-commit mailing list