[PATCH] Wait pending flip before setting new frontbuffer when resize screen

Jim Qu Jim.Qu at amd.com
Fri Aug 18 03:10:48 UTC 2017


the patch fixs the display can not light up after hotplug with DRI3
enabled, the drmmode_crtc->flip_pending records old fb address which
will be freed during setting new frontbuffer,meanwhile, the allocator
set the same address as freed fb to output_ids[] in drmmode_set_mode_
major(). In the next drmHandleEvent(), driver will update the content
of drmmode_crtc->flip_pending indexed, that says, output_ids[0] is
changed. therefore, drmModeSetCrtc() will be failed duo to unknown
connector id.

with the patch, in drmmode_flip_handler(), the drmmode_crtc->flip_pending
will be cleared.

Change-Id: I4f6b411129547d30cf109ba7f564815f759f9380
Signed-off-by: Jim Qu <Jim.Qu at amd.com>
---
 src/drmmode_display.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 552bff8..15aad0b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2142,6 +2142,20 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	xf86DrvMsg(scrn->scrnIndex, X_INFO, " => pitch %d bytes\n", pitch);
 	scrn->displayWidth = pitch / cpp;
 
+	for (i = 0; i < xf86_config->num_crtc; i++) {
+		xf86CrtcPtr crtc = xf86_config->crtc[i];
+		AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
+		drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+		drmmode_ptr drmmode = drmmode_crtc->drmmode;
+
+		if (!crtc->enabled)
+			continue;
+
+		/* Wait for any pending flip to finish */
+		while (drmmode_crtc->flip_pending && drmHandleEvent(pAMDGPUEnt->fd,
+			&drmmode->event_context) > 0);
+	}
+
 	if (info->use_glamor ||
 	    (info->front_buffer->flags & AMDGPU_BO_FLAGS_GBM)) {
 		screen->ModifyPixmapHeader(ppix,
-- 
1.9.1



More information about the amd-gfx mailing list