-
-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSync for xrender backend #82
Comments
I'd love to give it a try with mesa, but it doesn't compile atm. |
I got vsync to work on intel driver with this method. Also I asked about this on NVIDIA's forum. Still waiting for reply. |
Using Present with NVIDIA also seems to drastically increase the CPU usage of X server. |
NVIDIA users might have to use the GLX backend, I guess. |
Using the Present extension directly could have some nice benefits for the OpenGL backend as well, as it could enable implementation of custom vsync modes, in particular one similar to Vulkan's mailbox mode which should help minimize latency and improve performance (but could increase the number of rendered frames per presented frame). |
@Streetwalrus When we use OpenGL, we try using it idiomatically, instead of poking into the internals and doing weird stuff. If we want Vulkan, we can use Vulkan. |
I can understand sticking to idioms, but the interface for this is standardized, so it's not really "poking around with the internals and doing weird stuff". I'll let you be the judge on this though. |
@Streetwalrus How do you use the Present extension directly with OpenGL? I know Mesa is already using Present for buffer swapping if you have DRI3, if we start doing Present ourselves, that will definitely cause some conflicts. |
It won't be a problem as long as you don't call glxSwapBuffers. Getting the right pixmap is the tricky bit and will require some digging, but I think it should be possible. |
Tested the latest xrender backend, runs reeeeally slow on my AMD RX580+Ryzen 2600 (6c/12t). xorg process goes to 100% cpu until I kill compton. |
Is there something else that needs to be done to activate new xrender vsync after compiling from #next? |
@aufkrawall The new backend is not enabled in |
Thanks. It just freezes for me and I have to abort via Ctrl + c: |
@aufkrawall yeah, I'm not surprised. It's really not ready for anything yet. But if you are willing to investigate, please go ahead :) |
Great work you are doing. Can you maybe do a small write up and what the differences are between the backends, and which should be preferred under which circumstances? |
@ChrisLahaye Great idea. I think now is probably not the right time, since some big changes to the backends are coming up. But I will keep that in mind. |
@aufkrawall If you have time, can you try the |
It doesn't crash anymore and vsync seems to be fully functional. Input latency seems to be the same as with GLX swc + glfinish. Also CPU usage looks normal. |
@aufkrawall Thanks for the feedback! |
Gladly. Good news is it also doesn't show the stutter problem with amdgpu.dc=1 + radv + mpv. |
@aufkrawall I suspect those stutters are OpenGL specific problems, so they don't show up in xrender. |
The Firefox autoscroll stutter (it really happens only once when stopping it, not in between) also happens with xrender + TearFree. And the mpv stutter doesn't happen with glx + TearFree (instead of Compton's own vsync). Makes me curious to see what will happen with Compton's future GLX vsync rework. :) |
Congrats to your new experimental xrender backend and vsync, they achieve perfect vsync with minimal latency for me on a RX 580 (same as Gnome-Mutter or Windows DWM). What a great success! Really looking forward to it leaving experimental state. Btw: When starting Compton with "-experimental-backends" instead of "--experimental-backends", somehow my KDE Plasma window decorations disappear. It probably should simply abort when using just one hyphen? |
Do you have a screenshot/recording of that?
This is known, I understand why it happens, but it probably won't be fixed before v7.
Weird. Does this happen with the old backends?
It always use buffer-age.
Hmm the single hyphen version should be simply ignored, not sure what happened here. Also, thanks for testing the new backends :) |
Not sure if I can record the "ghost" behavior yet, as it seemed to happen rather erratically and it's too unstable for daily usage. The new GLX backend doesn't show this behavior, only new xrender.
It [tearing inside Vulkan windows with application vsync disabled] happens only with the new xrender backend, but not new GLX or old GLX backends. The new GLX backend also shows some stuttering in Firefox, e.g. when scrolling with mouse wheel or at vsynctester.com. |
Maybe that's just because of frame drop. |
Now that you say it: It really looks like that. |
Hm, there seems to be a connection to vsync regarding my browser input stutter issue. When I run Edit: The issue also occurs with modesetting driver, but to a much lesser extent. So I guess the problem really lies in the new GLX backend and not the Xorg drivers. However, the window snap frame drop issue is not related to it. |
RX580 user here, I also have browser stuttering (chromium and ff) with glx backends. The new xrender backend performs fine in browsers but both are not quite stable yet for my setup and segfaults frequently (can´t reproduce reliably for a report unfortunately). I always end up going back to 5.1 and vblank_mode=0 --vsync=opengl --backend=glx - as Bobby Fischer used to say, best by test. Kinda annoying that amd drivers can't figure a good vsync solution after all this time and hacks like vsync=opengl/drm works better than what was supposed to be the right way. Seems they keep trying to change behavior every other month, but end up breaking it again and there is always something really annoying still present like random frame drops, stutters when you do specific stuff, mpv desyncing, browser jerkiness etc. I can feel yshui's pain having to mantain something that relies on broken drivers. Sorry for the big rant but I felt it needed to be said. |
@clapbr Could you compile git-next with debug symbols and provide the crash dump + binary? |
I use the same config on PC and laptop. Laptop with ver 5.1 caused tearing (I used both on-board hd630 & Nvidia MX150 - matebook x pro 2018 via bbswitch) then I tried to adapt new compatible config with ver 6.2 on lap, I observed no tearing but wallpaper flick when on PC (only intel hd 620) ver 5.1 work perfectly, no tearing, no lag. |
One week of using new Xrender backend after commit 4205ee5 , and there are zero issues to report. :) |
Also not having segfaults anymore on latest, also using xrender and no issues yet. |
@aufkrawall @clapbr can you guys share |
Here's my config, I'm also using the new xrender and it seems to run great: To make this work like intended, it's important to start compton with the parameter that enables the new backends, like so:
|
@Ropid : Thanks, I finally be able to make it free tearing with arch/nvidia gpu card use new glx backends. I noticed that new |
@yshui Were the tracelogs helpful which I provided for my problems with new GLX backend? :) |
@aufkrawall These kind of problems are quite difficult to track down :/ |
Do you guys see some difficulties when start Xorg with new 6.2 compton? From black screen to appearance of wallpaper, there's strong flick between the transformation. |
@yshui One more crash issue which might be related to unredir. Happens when a weird resolution switch with Wine Vulkan apps is happening: |
I need some help here! I don't know what to do next to research the following problem: I started having tearing at the top of the screen with xrender + present. It seems to be happening with both the normal packages in Arch and the development versions of all Mesa and Xorg and amdgpu stuff. I don't know when exactly this started because the tearing is happening very close to the top of the screen, about 30 pixels away from the edge. I might not have noticed this happening for a very long time because of a panel covering most of those 30 pixels. Maybe this was always there and I never noticed? Looking around, I found this bug report here: https://bugs.freedesktop.org/show_bug.cgi?id=110417 I then tried the git version of xf86-video-amdgpu but it doesn't help with this tearing I see here. I also tried different kernels and I get the tearing with 4.19.x, 5.0.x, 5.1.x. |
@Ropid Are you certain that amdgpu DDX is actually used (e.g. forgot that modesetting driver was set up in xorg.conf)? No weird errors in xorg.log? |
@aufkrawall: Yeah, I'm using amdgpu and I'm not getting error messages in the Xorg file while using it. But you mentioning modesetting made me try that X driver instead of amdgpu. When using modesetting I do get interesting error messages that look related to that bug report:
I'm now trying to find a PKGBUILD for the git version of xorg-server to check out the patched modesetting driver that was mentioned in that bug report. EDIT: I managed to build the git version of xorg-server. The modesetting driver that comes with it is also showing tearing. Compared to the modesetting driver that comes with stable xorg-server, the log file error messages are gone but not the tearing itself. The version I'm trying is this here:
The way I'm testing stuff is by dragging a browser window with www.vsynctester.com half outside of the screen with Alt+click. I move it so that the flashing "VSYNC" text is at the edge of the screen. I can then see part of this "VSYNC" text flash red or cyan. |
@Ropid I tried but cannot reproduce this problem. I won't be surprised if non-git xf86-video-amdgpu, or non-git modesetting have this problem (because of the bugs). But I don't understand why the git versions have tearing as well. Can you tell me more about your setup, like do you use multiple monitors, etc.? Edit: Wait a sec, the modesetting fix hasn't been merged yet. |
Yeah, this MR based on @yshui 's original patch should be applied: Still it shouldn't tear with amdgpu-git either. Definitely not the case for me. |
I'm using a single 60Hz 1920x1200 monitor. The card is an AMD RX480. Window manager is xfwm4. I tried MATE's "marco" to compare. It also uses xrender and Present and it has that same tearing at the top of the screen so it's not a problem in compton. It seems to be something general about Present here for me. The experimental glx backend of compton doesn't have a tearing problem while it seems to run with the exact same super great latency as what xrender + present manages to do. |
@yshui The stutter of new GLX backend when snapping windows to the screen borders inside a Plasma session is gone. :) Edit: Moving the mouse cursor doesn't trigger it, but repeatedly clicking does (doesn't matter what is clicked, can also be the desktop background). Edit 2: There is still a minor jump noticeable of the moving window when snapping to borders, but everything else seems to continue running smoothly now. That minor jumps is not there with xrender or old GLX though. Edit 3: For whatever reasons, the "input stutter problem" doesn't seem to affect rendering completely, but only single windows like browser. For instance, playback of mpv seems to be totally unaffected. |
Can you elaborate? Do you have mpv and browser side by side, and input into the browser only cause the browser to stutter? And this doesn't happen when compton is not running? If so, that's super weird. and probably not a compton problem |
It's like you described, but the input doesn't have to be inside the browser window. When the Chromium window is unfocused and I keep buttons pressed (e.g. to switch selected desktop icons), it is enough to cause vsynctester.com to stutter. The same goes for mouse click input. |
I dumped Windows on my Gemini Lake notebook (hopefully for good) and on this very weak (you could choose less polite words) SoC, new xrender backend + vsync performs absolutely fine as well, by far less performance impact on the webbrowser than GLX backends. |
@aufkrawall Probably the browser is missing the vblank window because of the input? Since mpv is unaffected I am inclined to think this is not a compton problem. |
@yshui Perhaps the new xrender backend can be used by default instead of the old one with the next version? Can only judge my own situation, but it's just perfect here with both AMD & Intel (driver flaws not considered). |
@aufkrawall I want to get more feedback on the |
closing as done |
I want vsync for the xrender. And I want it to actually work, and doesn't involve OpenGL. The only options that meet the criteria seems to be the Present extension.
However, based on my experiment, this doesn't work under the NVIDIA driver. The Present extension is supported, but there is still tearing when using the extension.
This issue will be used to tracking my progress on investigating this.
Edit: The new backends now have working vsync for some drivers. See https://github.com/yshui/compton/wiki/Vsync-Situation
The text was updated successfully, but these errors were encountered: