All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Wait pending flip before setting new frontbuffer when resize screen
@ 2017-08-18  3:10 Jim Qu
       [not found] ` <1503025848-9197-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Qu @ 2017-08-18  3:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Jim Qu

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@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* 答复: [PATCH] Wait pending flip before setting new frontbuffer when resize screen
       [not found] ` <1503025848-9197-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org>
@ 2017-08-18  5:47   ` Qu, Jim
  0 siblings, 0 replies; 2+ messages in thread
From: Qu, Jim @ 2017-08-18  5:47 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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 <Jim.Qu@amd.com>
发送时间: 2017年8月18日 11:10
收件人: amd-gfx@lists.freedesktop.org
抄送: 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
Signed-off-by: Jim Qu <Jim.Qu@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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-18  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18  3:10 [PATCH] Wait pending flip before setting new frontbuffer when resize screen Jim Qu
     [not found] ` <1503025848-9197-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org>
2017-08-18  5:47   ` 答复: " Qu, Jim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.