-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
protocols: Add fifo-v1 and commit-timing-v1 #11703
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
base: main
Are you sure you want to change the base?
Conversation
Also @ikalco @gulafaran I touched your surface commit things. Might wanna verify I didn't exactly fuk something up |
@fufexan wp bump needed tooooo.... idk which version, fifo and ct |
Games using SDL3 (SDL2 as well, not sure?) should be taking advantage of these two protos. As indicated, SDL should automatically pick Wayland as its default backend now that these are available to it. CS2 will still default to XWL for now as they've manually added an env var to their launch script to use x11 SDL backend. |
I tried PPSSPP with wayland backend and it didnt bind to either fifo or ct |
not needed, they've been available since 1.38. We have 1.45. |
why is ci failing then huh oh I forgor mesonnn |
@ikalco check now |
crash to tty when trying to launch CS2 with |
oops fixer |
mpv has implemented fifo-v1 (mpv-player/mpv@39b53dd) |
No, it has to be |
check flicker now |
@Zebra2711 I can't get mpv to bind to fifo. |
naw, still cooked. The flicker looks exactly like the flicker from pre-explicit-sync days. Discord flickering, steam flickering, cs2 flickering, etc etc, in the same ways they used to. |
mpv can use fifo, |
how are you launching it to get it to use fifo? |
i run with
|
it doesnt bind for me :( |
src/protocols/core/Compositor.cpp
Outdated
void CWLSurfaceResource::lockState() { | ||
m_stateLocks++; | ||
} | ||
|
||
void CWLSurfaceResource::unlockState(std::optional<size_t> seq) { | ||
RASSERT(!!m_stateLocks, "Tried to unlock an unlocked wl_surface state"); | ||
m_stateLocks--; | ||
|
||
if (m_stateLocks) | ||
return; | ||
|
||
while (!m_pendingStates.empty() && (!seq || m_pendingStates.front()->seq <= *seq)) { | ||
commitState(*m_pendingStates.front()); | ||
m_pendingStates.pop(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in SSurfaceState
currently we can skip a frame/buffer:
- we get commit1 with buffer1, locks = 1
- we get commit2 with buffer2, locks = 2
- buffer1 is readable, locks = 1 .... this should've applied commit1
- buffer2 is readable, locks = 0 .... this applies commit1 followed by commit2
- commit1 buffer was never applied and scanned out, so a frame is skipped
I wrote this before you added the seq
mechanism, but I still think this applies cause buffer unlock isn't the only thing locking/unlocking every queued surface state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right... I'll rethink this tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ikalco what about having a queue with fences?
Say we have a queue with states:
A B C D
commit comes, we insert a fence on the buffer F1
A B C D F1
more commits come:
A B C D F1 E
fifo and a new buffer is used, F2 for dma and F3 for fifo:
A B C D F1 E G F2 F3
when F1 signals, all commits before it get applied:
E G F2 F3
Now the only problem is that for E and G, as far as I understand, both F2 and F3 need to signal. This is fine though and easy code-wise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think that can work
just make sure that commits without constraints are applied immediately
SState m_current, m_pending; | ||
|
||
struct { | ||
CHyprSignalListener surfacePrecommit; | ||
} m_listeners; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be in SSurfaceState, cause this bypasses the m_pendingStates queue
also as a clarifying note, surface commit's aren't really "double buffered"
the first "buffer" is m_pending, and then the second "buffer" is actually that m_pending is added into the m_pendingStates queue until it can be applied depending on constraints (buffer readability, commit timing timeout, fifo_barrier is unset, more stuff?)
// Signal all surfaces | ||
// TODO: should we wait for the correct monitor(s)? | ||
|
||
fifo->presented(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the monitor probably would matter because fifo proto guarantees that a surface buffer will be active for at least one refresh cycle, which depends on each monitors refresh rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if its on two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if its on two?
?
it should only unlock for the corresponding monitor (PHLMONITOR m), otherwise when refresh cycles are desynced bad stuff happens (mon1 has 60hz, mon2 144hz)
@ikalco check now, I've done locks per-state, should be better |
mpv is able to open now, but it immediately closes when playing a video
full log log.txt |
ew |
now? |
now it just freezes :) |
stellar |
this should help |
it plays a few frames and then freezes again |
@ikalco any idea? I still can't test |
check now @fxzzi |
rip, still bugged |
well I dunno then, and it's really annoying to dev without being able to test or debug |
Let him remote innnn, dooo ittt |
![]() I noticed that Godot gives a warning about this protocol when launching the game so maybe you can use a wayland native build of my tech demo to test how your protocol implementation works (there is also an auto generated sh script that will output debug info to the terminal) |
Fixes #11386
Needs some testing, I didn't test this because I dont know what apps use it.
If anyone has a test app, do lmk.
@Justsnoopy30 @fxzzi