Bug 110417

Summary: regression drm-next-5.2-wip: breaks vsync of new Compton xrender backend
Product: xorg Reporter: tempel.julian
Component: Driver/AMDgpuAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: mike
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg log showing the pageflipping issue
none
dmesg log none

Description tempel.julian 2019-04-14 08:55:08 UTC
Created attachment 143962 [details]
xorg log showing the pageflipping issue

Either build Compton from git "next" branch or use latest 6.2 release:
https://github.com/yshui/compton

Start Compton with new xrender vsync:
compton --config /dev/null --backend=xrender --vsync --experimental-backends

Result: There is tearing at the very top of the screen, can be easily verified by playing this juddertest video in fullscreen:
https://youtu.be/_gBBz7IMz1Y

This is a regression that was introduced in drm-next-5.2-wip.

There is no tearing when:
-using linux-mainline 5.1-rc4 or stable 5.0 kernel
-There is also no tearing when using drm-next-5.2-wip branch, but append amdgpu.dc=0 to kernel start parameters.
-There's also no tearing when using Compton's GLX backends, which use MESA_swap_control for vsync.

The attached xorg log testifies that there is a problem with pageflipping, as it is flooded with
 [    14.785] Failed to get FB for flip
 [    14.785] (WW) AMDGPU(0): Page flip failed: Resource temporarily unavailable
 [    14.785] (EE) AMDGPU(0): present flip failed


Compton's new xrender backend uses the present extension to implement vsync, which works well apart from that amdgpu driver regression.
It doesn't make a difference if modesetting or amdgpu DDX is used.
The problem wasn't introduced recently into drm-next-5.2-wip, it probably existed from the start of that branch or shortly after.

Programs versions used:
Compton 6.2
drm-next-5.2-wip-git ce933436e554f76a41612c257a2e6eb1eb6ac759
xorg-server-git 6975807945d12c07f00e18df7fafeff43efa0267
xf86-video-amdgpu 19.0.1
mesa-git 19.1 109912.9e0c744f07a
Comment 1 tempel.julian 2019-04-14 08:55:27 UTC
Created attachment 143963 [details]
dmesg log
Comment 2 Michel Dänzer 2019-04-18 17:28:04 UTC
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/33 fixes this for me.
Comment 3 Mike Lothian 2019-04-18 17:46:37 UTC
Could you try bisecting between v5.1-rc2 and HEAD?
Comment 4 tempel.julian 2019-04-18 19:11:40 UTC
The fix provided by Michel seems to work flawlessly. Would a kernel fix still be desirable?
Comment 5 Michel Dänzer 2019-04-19 09:45:24 UTC
There's no kernel issue to be fixed. Without page flipping, it was just luck that you didn't get tearing in some cases.
Comment 6 tempel.julian 2019-04-19 10:22:51 UTC
Ha, curious. I really could never spot any tearing before the 5.2-wip branch. Glad that bisecting is not required.

Well, there is one little exception (independent of the compositor):
When I turn on RedShift without fading (e.g. "redshift -O 4500"), tearing occurs once during enabling/disabling. Happens also with TearFree. Not a big deal, just want to mention it once.
Comment 7 Alex Deucher 2019-04-19 14:29:36 UTC
(In reply to tempel.julian from comment #6)
> Ha, curious. I really could never spot any tearing before the 5.2-wip
> branch. Glad that bisecting is not required.
> 
> Well, there is one little exception (independent of the compositor):
> When I turn on RedShift without fading (e.g. "redshift -O 4500"), tearing
> occurs once during enabling/disabling. Happens also with TearFree. Not a big
> deal, just want to mention it once.

I believe that is due to limitations in the atomic API with respect to updates.
Comment 8 Yuxuan Shui 2019-04-20 03:58:23 UTC
(In reply to Michel Dänzer from comment #5)
> There's no kernel issue to be fixed. Without page flipping, it was just luck
> that you didn't get tearing in some cases.

Just curious, was paging flipping not implemented prior to linux 5.2?
Comment 9 Michel Dänzer 2019-04-20 12:21:19 UTC
(In reply to Yuxuan Shui from comment #8)
> Just curious, was paging flipping not implemented prior to linux 5.2?

It was, but it wasn't being used due to the xf86-video-amdgpu bug.
Comment 10 Mike Lothian 2019-04-20 12:43:57 UTC
What about the modesetting DDX?
Comment 11 tempel.julian 2019-04-21 12:20:23 UTC
(In reply to Mike Lothian from comment #10)
> What about the modesetting DDX?

This PR by yshui fixes the tearing for modesetting:
https://gitlab.freedesktop.org/xorg/xserver/merge_requests/131
Comment 12 Michel Dänzer 2019-04-24 10:22:01 UTC
Thanks for the report and for testing the fix, which is now merged to xf86-video-amdgpu Git master.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.