From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 110659] pageflipping seems to cause jittering on mouse input
when running Hitman 2 in Wine/DXVK with amdgpu.dc=1
Date: Wed, 15 May 2019 10:15:30 +0000
Message-ID:
What
Removed
Added
Version
git
unspecified
Assignee
xorg-driver-ati@lists.x.org
dri-devel@lists.freedesktop.org
Component
Driver/AMDgpu
DRM/AMDgpu
Product
xorg
DRI
CC
nicholas.kazlauskas@amd.com
QA Contact
xorg-team@lists.x.org
(In reply to tempel.julian from comment #0)
> The issue does not occur when:
> [...]
> -using legacy DC via amdgpu.dc=3D0
Probably a DC issue then.
What's the latest commit in your WIP kernel? I know there was a regression caused by: https://patchwo= rk.freedesktop.org/patch/304544/ that forces full updates on every commit leading to pretty poor performance= . I have a patch that fixes this that didn't make into that set of DC patches. But I also don't think this last set is merged yet into amd-staging-drm-nex= t, so it's likely something other than this - and likely something in the lega= cy codepath if disabling atomic support in modesetting causes the issue.
Yes, it also happens with Linux 5.1. It btw. runs fine on xwayland inside a Plasma Wayland session.
Situation is unchanged with 5.3-wip. It also occurs with amdvlk instead of radv if you turn on pageflipping via UseFlipHint,1 in amdPalSettings.cfg (for incomprehensible reasons it is disabled by default and the amdvlk developers unfortunately seem to ignore = user complaints regarding it). Instead of pageflipping, the issue can also be triggered with amdvlk + TearFree. Btw: There is a free demo of Hitman 2 on Steam, it might work out of the box with Steam Play/Proton. ----- Little off-topic: I head to re-write this entire comment because freedesktop.org servers are a nightmare. Complete migration to GitLab would be great thing.
Playing Skyrim with Gallium Nine also shows this issue, it mak= es the games unplayable. Is it really certain that it's an amdgpu.dc problem when the modesetting DDX doesn't show this issue?
Do you happen to know if this was a regression?
Until I get a new GPU or a FreeSync display, I use amdgpu.dc= =3D1 only for testing purposes. So I can't judge if this is a regression or has always existed. But I gave Linux 4.19.46 LTS a try and it shows the same behavior. Hm, maybe no one noticed because pageflipping wasn't working before this commit? https://gitlab.freedesktop.or= g/xorg/driver/xf86-video-amdgpu/commit/bf61e6d7ac1a5754b1026d7f80acf25ef622= c491 Will retest with latest stable versions of xorg / amdgpu DDX. It's btw. really not happening in every game, e.g. Elex seems to be fine.= pre>
Nope, not related to it. Happens also with stable versions.
Happens also with plain wined3d inside official Steam Proton b= uilds. In case of Skyrim, it is also affects the rendering performance and thus is visible in= the frametime graph (unlike Hitman 2 with DXVK): https://ab= load.de/img/screenshot_20190527_1t1ktp.png Those spikes occur by just moving the mouse. Pressing keyboard buttons don't trigger them.
I'm wondering if this is the async cursor update bug again. Ma= ybe something with WINE or the game is trying to swap cursor buffers frequently and it's interacting with the cursor double buffering in xf86-video-amdgpu. We still can't do fast cursor updates for swapping cursor framebuffers beca= use we'll hit page faults that can kill the driver due to the cursor framebuffer not being properly refcounted. The fix for this particular bug is still under review in DRM. I plan on removing the restriction I added in amdgpu DM after the fix has been merged. But for now, whenever the cursor swaps framebuffers we can't perform fast cursor updates so we're forced to wait for the previous flip to finish and = the vblank event to be sent back to userspace. This can cause small jitters depending on how often the cursor is updating and when it updates during the vblank interval.
Thanks for letting me know! Could you please provide me with a loose estimate if those general atomic modesetting performance limitations can be overcome in the next months? Wou= ld really put my mind at ease. :)
(In reply to tempel.julian from comment #13) > Thanks for letting me know! > Could you please provide me with a loose estimate if those general ato= mic > modesetting performance limitations can be overcome in the next months? > Would really put my mind at ease. :) The core bits + the bits that affect amdgpu are reviewed. But I think it's still waiting on review from maintainers of the other drivers the patch impacts. I wouldn't expect it to land before 5.3 or even 5.4 at the earliest unfortunately. I would still need to debug to know for sure if that's the actual bug that's going on here but it seems likely given that it's atomic DC + cursor moveme= nt + xf86-video-amdgpu that's causing the issue.
Well, hope on the horizon. If applying debug patches would be helpful for trying to shed light into th= is issue, I would of course do it.
Created attachment 144354 [details] [review] 0001-drm-amd-display-Allow-fast-updates-again-for-swappin.patch Sure, you can try the patch I've attached on applied after series fixing the problem in DRM: https://patchwork.= kernel.org/cover/10837847/ Not sure if that applies cleanly, however. The important patches from should be: https://patchwork.= kernel.org/patch/10837849/ https://patchwork.= kernel.org/patch/10837853/
I applied your patch and patches 1 and 3 of that series on lin= ux 5.2-rc2, but it unfortunately doesn't show any effect: -There is still the mouse input issue for the games described in this ticke= t. -Opening new windows still creates stutter. -And so do gamma adjustments via RedShift.
Huh, with modesetting driver, those patches eliminate the stut= ter when new windows are shown. Does the xf86-video-amdgpu driver need adjustments for t= his? However, turning on nightlight in Plasma Wayland still causes stutter, whic= h is not there with amdgpu.dc=3D0. RedShift btw. is completely broken with amdgpu.dc=3D1 + modesetting DDX, it simply has no effect anymore (not related to the experimental atomic modesetting patches).
(In reply to tempel.julian from comment #18) > Huh, with modesetting driver, those patches elim= inate the stutter when new > windows are shown. Does the xf86-video-amdgpu driver need adjustments = for > this? It should eliminate stuttering for that case in xf86-video-amdgpu if it's t= he problem I think it is (double buffering the cursor). >=20 > However, turning on nightlight in Plasma Wayland still causes stutter,= which > is not there with amdgpu.dc=3D0. 1. Gamma updates are slow updates that do a lot of register programming. Nightlight and RedShift issue a lot of these updates. 2. Gamma updates, like everything that isn't a cursor update, currently tar= get the next vblank period. 3. If the pageflip is in a separate commit or update than the gamma update, then it'll need to wait for the gamma update to finish and for the next vbl= ank interval. If this takes too long then we might miss the next vblank interval and have to wait for the one after that. I think it's a combination of these 3 issues. Even though it's Wayland and should be using the full atomic API, I'm not sure if plasma is actually iss= uing all that state in the same commit or not. My guess would be no, since you're seeing the stuttering. We do have a bug = with (2) for legacy gamma updates, since there isn't really any reason those sho= uld be waiting for the next flip / vblank other than to be consistent with the = rest of the atomic commit framework. > RedShift btw. is completely broken with amdgpu.d= c=3D1 + modesetting DDX, it > simply has no effect anymore (not related to the experimental atomic > modesetting patches). Not sure what the issue here would be. Gamma seems to work fine for legacy = and atomic on amdgpu (we pass the IGT tests for this) and it works fine in lega= cy desktops like GNOME on Xorg with the xf86-video-amdgpu DDX. Was this still on Plasma, but on X?
I forgot that I patched this PR into my Xserver: h= ttps://gitlab.freedesktop.org/xorg/xserver/merge_requests/36 It is responsible for the blocked gamma adjustment and the better desktop window performance of the modesetting Xorg driver with the experimental ato= mic modesetting kernel patches vs. the xf86-video-amdgpu driver. So, since everything got a bit messy, let me recap the results and add a few more details: -The experimental atomic modesetting kernel patches actually improve the performance for desktop window usage for one aspect: When I open www.vsynctester.com in Chromium and quickly hover the mouse cursor over my system tray to trigger popup windows, this doesn't result in stuttering anymore. The same applies to little text popups (e.g. URLs of links) during regular web browsing. This is the case with both modesetting and xf86-video-amdgpu, window compositing is enabled and 100% free of tearing at the same time. -But there is still stutter on www.vsynctester.com in Chromium (please don't use Firefox for this, it even stutters on MS Windows when doing this...) wh= en I hide and show any other window, e.g. of running Dolphin file browser by clicking its starter icon in the taskbar. It's just the window that is shown and hidden, the program itself continues running all the time. This applies= to both modesetting and xf86-video-amdgpu driver. -But when I apply the aforementioned "WIP: modesetting: Use atomic more atomically" patch to Xserver (additionally to the experimental atomic modesetting kernel patches), the modesetting driver is also 100% free of stutter in this situation, while the xf86-video-amdgpu-driver is not. Question is: Can this also be incorporated into the xf86-video-amdgpu drive= r? This would be a VAST improvement, the stuttering during gamma adjustments i= mho is not close to being as important. -Now back to the stutter in games when moving the mouse: This is completely untouched by all this. The xf86-video-amdgpu driver always show stuttering = in the mentioned games (as long as amdgpu.dc=3D1), while modesetting and also xwayland don't. Oof, I hope I didn't forget anything. ;)
I'm open to trying out other patches, e.g. concerning double b= uffering for the cursor. :)
The Witcher 3 is affected as well (a bit less obvious, but sti= ll quite bad vs. modesetting or amdgpu.dc=3D0). So, it seems this is a real dealbreaker for playing games on Linux, which imho justifies to raise this ticket's priorit= y. :(
What | Removed | Added |
---|---|---|
Priority | medium | high |
Any news on this? I'd really like to have this sorted out befo= re I wholeheartedly recommended Navi for Linux gaming. I can imagine that Navi causes a ton of work, but still this issue is painf= ul.
I've mentioned kwin-lowlatency in this ticket: https://bugs.freedesktop.org/show_bug.= cgi?id=3D108917#add_comment It can be used as some kind of workaround for this wine issue, as the stutt= er doesn't occur when kwin compositing (and thus vsync) is enabled on top of t= he games' vsync. Of course this is far from being optimal, as 1. It breaks FreeSync. 2. There is an additional backbuffer queue, causing additional input (or perhaps better output) latency. 3. It may introduce additional stutter when framerate drops below refreshra= te --- FreeSync situation for wine games seems really terrible with due to this bu= g. :(
Applying this MR and disabling HW cursor "fixes" the= mouse skipping in the menu of Hitman 2 (as there is a cursor visible and thus pageflipping is turned o= ff): https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgp= u/merge_requests/38 But in the actual game, there is no cursor visible and so there is severe stutter again. I also reported the bug to the wine devs (still I think this is rather a bu= g of xf86-video-amdgpu): https://bugs.wi= nehq.org/show_bug.cgi?id=3D47428 There I mentioned that setting "MouseWarpOverride =3D disable" (a= wine features to work around/solve mouse issues) fixes the problem for wined3d/gallium ni= ne. However, it does not fix the issue in Hitman 2. The issue in Hitman 2 also is a bit different, as it doesn't seem to have slowdowns regarding the rendering performance, but instead the mouse input rather seems to be partially blocked or discarded. But again: This does not occur without xf86-video-amdgpu or amdgpu.dc=3D1.
(In reply to tempel.julian from comment #25) > I also reported the bug to the wine devs (still = I think this is rather a bug > of xf86-video-amdgpu): It's a kernel issue, not an xf86-video-amdgpu one.