Bug 108917 - gamma adjustments cause stuttering with amdgpu.dc=1, especially problematic with RedShift etc.
Summary: gamma adjustments cause stuttering with amdgpu.dc=1, especially problematic w...
Status: NEW
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/AMDgpu (show other bugs)
Version: DRI git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-01 23:43 UTC by tempel.julian
Modified: 2019-04-19 14:18 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
xorg log (31.77 KB, text/plain)
2018-12-01 23:43 UTC, tempel.julian
no flags Details
dmesg log (67.92 KB, text/plain)
2018-12-01 23:44 UTC, tempel.julian
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description tempel.julian 2018-12-01 23:43:25 UTC
Created attachment 142685 [details]
xorg log

With amdgpu.dc=1, there is stuttering in the moment when gamma adjustments are getting applied. This is not the case with amdgpu.dc=0, it is entirely free of stutter.

Both RedShift and Gnome night light in Xorg session show the very same behavior:
When "nightmode" is getting turned on with a transition effect, there is severe stuttering going on. The same is the case in the opposite direction when turning nightmode off again.

It's also very problematic that the stutter is ongoing, as tools like RedShift in dynamic mode constantly adjust color temperature as the night progresses. There is stutter happening every few seconds because of that.

To reproduce, simply start e.g. RedShift in dynamic mode with "redshift -t 4500:4500 -l 1:1".
The stutter can be easily observed when looking at the animation of www.vsynctester.com in Chromium, which should be absolutely free of stutter without gamma adjustment (perhaps set CPU clock governor to performance). But you should already notice that even moving windows etc. is stuttery, especially during transition effect.

As a workaround, one might want to use "oneshot" mode of RedShift, e.g. "redshift -O 4500". This applies a gamma adjustment just once and thus prevents further stuttering. But that's not how the usage of such tools usually is intended.

linux-drm-next-4.21-wip-6b456d7e60007022d91c701c00c76cdfa8774eaf
xorg-server 1.20.3
gnome 3.30.1
both modesetting and xf86-video-amdgpu-git 18.1.0.20 DDX driver
Comment 1 tempel.julian 2018-12-01 23:44:02 UTC
Created attachment 142686 [details]
dmesg log
Comment 2 Alex Deucher 2018-12-03 02:59:48 UTC
Possibly the same issue as bug 106175.
Comment 3 tempel.julian 2018-12-03 08:42:21 UTC
(In reply to Alex Deucher from comment #2)
> Possibly the same issue as bug 106175.

Do you suspect the mouse cursor issue? That's not the case here: The gamma adjustment stutter also occurs without vsync or any other fullscreen vsync application running.

I will give a Wayland session a try this evening. Wouldn't be surprised if this issue is completely unrelated to Xorg specific things.
Comment 4 Alex Deucher 2018-12-03 15:33:14 UTC
DC is atomic.  gamma updates may go through a full atomic codepath similar to cursor.  They may also need a similar fast path to avoid a full atomic update.
Comment 5 tempel.julian 2018-12-03 20:49:58 UTC
Thanks for the explanation, I misunderstood you.

So I've tested night colors in a KDE Plasma Wayland session: And indeed, it shows the same behavior as RedShift on Xorg (stutter with amdgpu.dc=1, no stutter with amdgpu.dc=0).
Comment 6 Nicholas Kazlauskas 2018-12-17 14:30:52 UTC
I suspect that Alex is right about this being similar to the cursor update issue - a large volume of color management changes through the full atomic commit codepath would likely be quite slow. The dc=1 to dc=0 comparison is good evidence supporting it as well.

Expanding the cursor path into a generalized plane update fast path would likely resolve the issue, but may be tricky to do right.
Comment 7 Hans D 2019-01-16 20:57:28 UTC
Can confirm that enabling redshift causes occasional stutters every 2-4 seconds with amdgpu.dc=1 with linux 5.0rc2. Without  redshift everything (scrolling in browser, video playback)is buttery smooth. With amdgpu.dc=0  redshift doesn't introduce any hiccups.
Comment 8 tempel.julian 2019-03-19 16:44:26 UTC
Unfortunately, Linux 5.0.3 with

drm: Block fb changes for async plane updates
commit 25dc194b34dd5919dd07b8873ee338182e15df9d

hasn't changed the situation, as far as I can tell. :(
Comment 9 Nicholas Kazlauskas 2019-03-19 16:47:53 UTC
(In reply to tempel.julian from comment #8)
> Unfortunately, Linux 5.0.3 with
> 
> drm: Block fb changes for async plane updates
> commit 25dc194b34dd5919dd07b8873ee338182e15df9d
> 
> hasn't changed the situation, as far as I can tell. :(

That's the DRM level bugfix for use after free on async updates for plane framebuffer swaps. It actually hurts performance rather than helps it.

There's a fix that allows framebuffer swaps again being developed right now with some patches in dri-devel:

https://patchwork.freedesktop.org/series/57524/

You'd have to revert

"drm/amd/display: Skip fast cursor updates for fb changes"

as well though to actually allow this series to work.
Comment 10 tempel.julian 2019-03-19 18:16:20 UTC
Thanks for the information, really a relief to know that this is being worked on.
Does this aim to achieve as good performance as with "legacy DC" for every window operation as well?

Would it work to do something like "patch -Np1 -i -R fastcursorpath.patch" and then apply the new set of patches?

In that case my question would be how to find the right patch to revert. The PR for the kernel included much more (yeah, sorry for such beginner questions):
https://github.com/torvalds/linux/commit/74136a3d47f51ae72ee8b9ebc1ec2a29bcf30676
Comment 11 tempel.julian 2019-04-19 14:18:06 UTC
Is it realistic that the maintainers and firms in charge might manage an effort to solve this matter across vendors this year?

I unfortunately always notice the performance issue by simply browsing the web, as even little text or hyperlink pop ups trigger fps drops, which are not there without atomic modesetting on Xorg.

I personally would already be quite happy if the experimental patchset was available e.g. in amd-staging-drm-next branch for the time being.


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.