-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
2 frames 2 pacing #1156
2 frames 2 pacing #1156
Conversation
292c116
to
6603c1b
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## next #1156 +/- ##
==========================================
- Coverage 37.41% 36.68% -0.73%
==========================================
Files 49 50 +1
Lines 11197 11489 +292
==========================================
+ Hits 4189 4215 +26
- Misses 7008 7274 +266
|
ff691e6
to
ecedd55
Compare
Hi, I'm not much aware of the frame pacing topic but when enabled with animations (glx, xrender) everything seems to be messed up. After opening several windows any window movement/resize becomes too laggy and crashes everything eventually (all windows disappear or start making awkward movements). Can you guide me a little bit about frame pacing? I'm not sure if it should be included with animations though. Also my fork is not like other forks, it is 100% original picom (this one) with animations included in it. I also maintain all of your commits, so that it is not behind of the original.
Also if you have a little bit of free time I have one more question, it is not related to this issue. |
b1f1c5f
to
c9840c1
Compare
@FT-Labs can you try merging this branch with your animation branch? |
@FT-Labs btw, what's the current status on animation? judging from the PRs there are multiple efforts on animation, and i don't know how they are related to each other. |
I've merged the code with this branch and it fixed all performance issues. There is no performance issue with frame pacing enabled now. https://github.com/FT-Labs/picom/tree/pacing-fixes It is close to done actually, I do not have that much idea about other forks. As a start, I have used @dccsillag's fork 1 1-5 years ago, but a lot has changed since it did not get updated. I just try to keep in line with original picom without breaking the animations. To sum up, here is what works now: Remaining problems:
Aside from these it is done and works good. Of course, there could be more improvements but I think they can be done later since they would classify as features |
I mistakenly assumed that PresentCompleteNotify event signifies the end of a vblank (or the start of scanout). But actually this event can in theory in sent at any point during a vblank, with its timestamp pointing to when the end of vblank is. (that's why we often find the timestamp to be in the future). Add a delay so schedule_render is actually called at the end of vblank, so it doesn't mistakenly think the render is too slow to complete. Signed-off-by: Yuxuan Shui <[email protected]>
Make it simpler to stop requesting PresentCompleteNotify when there is nothing to render. Related: #1079 Signed-off-by: Yuxuan Shui <[email protected]>
Previously everytime we receive a vblank event, we always request a new one. This made the logic somewhat simpler. But this generated many useless vblank events, and wasted power. We only need vblank events for two things: 1. after we rendered a frame, we need to know when it has been displayed on the screen. 2. estimating the refresh rate. This commit makes sure we only request vblank events when it's actually needed. Fixes #1079 Signed-off-by: Yuxuan Shui <[email protected]>
We unredirect because we receive bad vblank events, and also vblank events at a different interval compared to when the screen is on. But it is enough to just not record the vblank interval statistics when the screen is off. Although, unredirecting when display is off can also fix the problem where use-damage causes the screen to flicker when the display is turned off then back on. So we need something else for that. Signed-off-by: Yuxuan Shui <[email protected]>
This is where we keep temporary, short living, private debug options. Adding and removing command line and config file options are troublesome, and we don't want people adding these to their config files. Signed-off-by: Yuxuan Shui <[email protected]>
Factored out vblank event generation, add abstraction over how vblank events are generated. The goal is so we can request vblank events in different ways based on the driver we are running on. Tried to simplify the frame scheduling logic, we will see if I succeeded or not. Also, the logic to exclude vblank events for vblank interval estimation when the screen off is dropped. It's too hard to get right, we need to find something robust. Signed-off-by: Yuxuan Shui <[email protected]>
Disable timing estimation based pacing by default, as it might not work well across drivers, and might have subtle bugs. You can try setting `PICOM_DEBUG=smart_frame_pacing` if you want to try it out. Signed-off-by: Yuxuan Shui <[email protected]>
Also, vblank event callback should call schedule_render to queue renders instead of starting the draw timer directly, so that the CPU time calculation will be correct. Signed-off-by: Yuxuan Shui <[email protected]>
present_notify_msc with divisor == 0 has undocumented special meaning, it means async present notify, which means we could receive MSC notifications from the past. Signed-off-by: Yuxuan Shui <[email protected]>
I noticed sometimes full frame rate video is rendered at half frame rate sometimes. That is because the damage notify is sent very close to vblank, and since we request vblank events when we get the damage, we miss the vblank event immediately after, despite the damage happening before the vblank. request next ...... next next damage vblank vblank vblank | | | ...... | v v v v ---------------------->>>>>>--------- `request vblank` is triggered by `damage`, but because it's too close to `next vblank`, that vblank is missed despite we requested before it happening, and we only get `next next vblank`. The result is we will drop every other frame. The solution in this commit is that we will keep requesting vblank events, right after we received a vblank event, even when nobody is asking for them. We would do that for a set number of vblanks before stopping (currently 4). Signed-off-by: Yuxuan Shui <[email protected]>
Right now we rely on `reschedule_render_at_vblank` being scheduled for the render finish check. Which means we will only know if a frame has finished rendering the next time we queue a render. And we only check at vblank boundary, which means when a render is queued we have to wait for the next vblank, when had we checked earlier, we will be able to start rendering immediately Signed-off-by: Yuxuan Shui <[email protected]>
It's kind of dumb anyway. If we get damage event right after a vblank event, we would waste the whole vblank. Instead improve the frame scheduling logic to target the right vblank interval. This only affects smart_frame_pacing anyway. Signed-off-by: Yuxuan Shui <[email protected]>
Present extension based scheduler doesn't work well on NVIDIA drivers. GLX_SGI_video_sync is less accurate, but is rumoured to work. See [kwin's usage](https://invent.kde.org/plasma/kwin/-/blob/master/src/ backends/x11/standalone/x11_standalone_sgivideosyncvsyncmonitor.cpp) Signed-off-by: Yuxuan Shui <[email protected]>
Useful for debugging. Signed-off-by: Yuxuan Shui <[email protected]>
Signed-off-by: Yuxuan Shui <[email protected]>
We are not using it for anything at the moment, and it is breaking CI. Signed-off-by: Yuxuan Shui <[email protected]>
Signed-off-by: Yuxuan Shui <[email protected]>
@FT-Labs cool. after 11 is out of the door, the focus for 12 would be getting animation over the finishing line |
I'm no longer noticing any power draw differences introduced by frame pacing when running this branch, but I've also switched from Intel to AMD so I don't get quite the same level of power state information 🤷. |
@yshui sorry if it is a stupid question, what is 11 and 12 :D |
@FT-Labs, picom v11 and v12 respectively. |
Ok, got it |
It seems if smart_frame_pacing is enabled, picom log-spam huge amount of warnings:
As soon as for display turns off (DPMS) In my case my Maybe it would be good idea to utilize |
Wow, |
Otherwise we might be repeatedly hitting this condition and spam the warning. Signed-off-by: Yuxuan Shui <[email protected]>
Things seem to be going well, so I am merging this. |
Another batch of frame pacing improvements. Hopefully it's acceptable for general use now.
Fixes #1072