Skip to contentSkip to conversation

Wait pending flip before setting new frontbuffer when resize screen

PATCH In review Jim Qu 1 participant 2 messages Aug 18, 2017 1 message not in the archive

lore
Share & tools
lore

Jim Qu

author
#0 lore raw

PATCH 1/1 Wait pending flip before setting new frontbuffer when resize screen

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
---
 src/drmmode_display.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
src/drmmode_display.c +14 -0
index 552bff8..15aad0b 100644
@@ -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,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1503025848-9197-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

Hi:

Please ignore this patch. the extant patch could fix the problem.

https://cgit.freedesktop.org/xorg/driver/xf86-video-amdgpu/commit/?id=af7221e1c4d2dbdfd488eb0976a835584ea8441c

Thanks
JimQu

________________________________________
发件人: Jim Qu <[email protected]>
发送时间: 2017年8月18日 11:10
收件人: [email protected]
抄送: Qu, Jim
主题: [PATCH] Wait pending flip before setting new frontbuffer when resize screen

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
---
 src/drmmode_display.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
src/drmmode_display.c +14 -0
index 552bff8..15aad0b 100644
@@ -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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx