sync amdgpu scanout update event before mode setting
PATCH 1/1 sync amdgpu scanout update event before mode setting
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before sanout update handler, so it causes segment fault issue.
--- src/drmmode_display.c | 3 +++ 1 file changed, 3 insertions(+)
src/drmmode_display.c +3 -0
@@ -902,6 +902,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->scanout_update_pending); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
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): 1523963476-17769-1-git-send-email-Jim.Qu-5C7GfCeVMHo@public.gmane.org
Hi,
Any comments for this patch?
Thanks
JimQu
________________________________________
发件人: amd-gfx <[email protected]> 代表 Jim Qu <[email protected]> 发送时间: 2018年4月17日 19:11
收件人: [email protected]
抄送: Qu, Jim
主题: [PATCH] sync amdgpu scanout update event before mode setting
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before sanout update handler, so it causes segment fault issue.
--- src/drmmode_display.c | 3 +++ 1 file changed, 3 insertions(+)
src/drmmode_display.c +3 -0
@@ -902,6 +902,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->scanout_update_pending); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
--
1.9.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 3 lines · Jim Qu
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before sanout update handler, so it causes segment fault issue.
Good catch, thanks.
Quoted 6 lines
src/drmmode_display.c +0
-0
src/drmmode_display.c drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, · line 910
Quoted 9 lines
src/drmmode_display.c +3
-0@@ -902,6 +902,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->scanout_update_pending); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
The two drmmode_crtc_wait_pending_event invocations can be combined like this:
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending || drmmode_crtc->scanout_update_pending);
Okay if I make that modification before pushing?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ 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): 6c324f68-e642-fdc9-3fe7-86f956f23a9e-otUistvHUpPR7s880joybQ@public.gmane.org
Okay if I make that modification before pushing?
A: Yes , of course :p)
Thanks
JimQu
________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2018年4月18日 16:55
收件人: Qu, Jim
抄送: [email protected]
主题: Re: [PATCH] sync amdgpu scanout update event before mode setting
Quoted 3 lines · Jim Qu
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before sanout update handler, so it causes segment fault issue.
Good catch, thanks.
Quoted 6 lines
src/drmmode_display.c +0
-0
src/drmmode_display.c drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, · line 910
Quoted 9 lines
src/drmmode_display.c +3
-0@@ -902,6 +902,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->scanout_update_pending); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
The two drmmode_crtc_wait_pending_event invocations can be combined like this:
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
drmmode_crtc->flip_pending ||
drmmode_crtc->scanout_update_pending);Okay if I make that modification before pushing?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
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): DM3PR12MB087344C174A5B88C5D55AFB899B60-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Hi Michel,
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
drmmode_crtc->flip_pending ||
drmmode_crtc->scanout_update_pending);Here, should not use && for this condition?
Thanks
JimQu
________________________________________
发件人: amd-gfx <[email protected]> 代表 Qu, Jim <[email protected]> 发送时间: 2018年4月18日 17:00
收件人: Michel Dänzer
抄送: [email protected]
主题: 答复: [PATCH] sync amdgpu scanout update event before mode setting
Okay if I make that modification before pushing?
A: Yes , of course :p)
Thanks
JimQu
________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2018年4月18日 16:55
收件人: Qu, Jim
抄送: [email protected]
主题: Re: [PATCH] sync amdgpu scanout update event before mode setting
Quoted 3 lines · Jim Qu
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before sanout update handler, so it causes segment fault issue.
Good catch, thanks.
Quoted 6 lines
src/drmmode_display.c +0
-0
src/drmmode_display.c drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, · line 910
Quoted 9 lines
src/drmmode_display.c +3
-0@@ -902,6 +902,9 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, drmmode_crtc->flip_pending); +drmmode_crtc_wait_pending_event (drmmode_crtc, pAMDGPUEnt->fd, + drmmode_crtc->scanout_update_pending); +if (!drmmode_set_mode (crtc, fb, mode, x, y)) goto done;
The two drmmode_crtc_wait_pending_event invocations can be combined like this:
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
drmmode_crtc->flip_pending ||
drmmode_crtc->scanout_update_pending);Okay if I make that modification before pushing?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
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): DM3PR12MB087326EF8F4A655E0DBE16FF99B60-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 7 lines · Jim
Hi Michel,
drmmode_crtc_wait_pending_event(drmmode_crtc,
pAMDGPUEnt->fd,drmmode_crtc->flip_pending || drmmode_crtc->scanout_update_pending);Here, should not use && for this condition?
No; that would only wait as long as both drmmode_crtc->flip_pending and drmmode_crtc->scanout_update_pending are non-zero, i.e. while a TearFree flip is pending. But it needs to wait while a non-TearFree flip is pending as well (as the existing code did), and while a non-TearFree scanout update is pending (the case your patch fixes).
Anyway, I've come to realize this isn't the right place to fix the problem, it should only be done when drmmode_crtc_scanout_free is called:
if (drmmode_crtc->scanout[scanout_id].pixmap &&
fb != amdgpu_pixmap_get_fb(drmmode_crtc->
scanout[scanout_id].pixmap)) {
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
drmmode_crtc->scanout_update_pending);
drmmode_crtc_scanout_free(drmmode_crtc);
} ...Do you prefer if I make this modification to your patch before pushing it, or submit my own patch instead?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ 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): 558e5cc3-2ff1-5116-fb67-2a1ce927cc52-otUistvHUpPR7s880joybQ@public.gmane.org
Yeah, I realize that it should use || . I will check it again with your modification. and then push it immediately. The issue has delayed a long time.
May I get your RB?
Thanks
JimQu
________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2018年4月18日 17:29
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: [PATCH] sync amdgpu scanout update event before mode setting
Quoted 7 lines · Jim
Hi Michel,
drmmode_crtc_wait_pending_event(drmmode_crtc,
pAMDGPUEnt->fd,drmmode_crtc->flip_pending || drmmode_crtc->scanout_update_pending);Here, should not use && for this condition?
No; that would only wait as long as both drmmode_crtc->flip_pending and drmmode_crtc->scanout_update_pending are non-zero, i.e. while a TearFree flip is pending. But it needs to wait while a non-TearFree flip is pending as well (as the existing code did), and while a non-TearFree scanout update is pending (the case your patch fixes).
Anyway, I've come to realize this isn't the right place to fix the problem, it should only be done when drmmode_crtc_scanout_free is called:
if (drmmode_crtc->scanout[scanout_id].pixmap &&
fb != amdgpu_pixmap_get_fb(drmmode_crtc->
scanout[scanout_id].pixmap)) {
drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
drmmode_crtc->scanout_update_pending);
drmmode_crtc_scanout_free(drmmode_crtc);
} ...Do you prefer if I make this modification to your patch before pushing it, or submit my own patch instead?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
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): DM3PR12MB087312990AC89B251353463299B60-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 2 lines · Jim
Yeah, I realize that it should use || . I will check it again with your modification.
I've verified that it fixes the crash.
Quoted 1 line
and then push it immediately. The issue has delayed a long time.
Really? I haven't seen anything about this before you posted your patch yesterday. (I wonder if
https://bugs.freedesktop.org/show_bug.cgi?id=105736 might be the same issue, but it's not clear yet)
Quoted 1 line
May I get your RB?
I'd prefer pushing it myself.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ 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): 13cab810-0bb7-b6fc-3e8a-7b1f0835b303-otUistvHUpPR7s880joybQ@public.gmane.org
OK, Please push your patch ASAP.
Thanks
JimQu
________________________________________
发件人: Michel Dänzer <[email protected]>
发送时间: 2018年4月18日 17:54
收件人: Qu, Jim
抄送: [email protected]
主题: Re: 答复: 答复: [PATCH] sync amdgpu scanout update event before mode setting
Quoted 2 lines · Jim
Yeah, I realize that it should use || . I will check it again with your modification.
I've verified that it fixes the crash.
Quoted 1 line
and then push it immediately. The issue has delayed a long time.
Really? I haven't seen anything about this before you posted your patch yesterday. (I wonder if
https://bugs.freedesktop.org/show_bug.cgi?id=105736 might be the same issue, but it's not clear yet)
Quoted 1 line
May I get your RB?
I'd prefer pushing it myself.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
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): DM3PR12MB0873E5ADB6D637077BEADAEB99B60-4hRkV8tDpBiYEITDcfEJ8AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 1 line · Jim
OK, Please push your patch ASAP.
Done:
commit 9f6a8905611b5b1d8fcd31bebbc9af7ca1355cc3
Author: Jim Qu <[email protected]> Date: Tue Apr 17 19:11:16 2018 +0800
Wait for pending scanout update before calling drmmode_crtc_scanout_free
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx