Skip to content
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

Support fifo-v1 and commit-timing-v1 protocol #1588

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

cmeissl
Copy link
Collaborator

@cmeissl cmeissl commented Nov 14, 2024

Support for the new fifo and commit timing protocol and changes for wp-presentation version 2

Clearing barriers needs to be better abstracted/helpers are needed

The integration in anvil for clearing fifo barriers is just bare bones. We probably want
to provide something similar like we already do for send_frames and so.
Also it is incomplete atm, we also need to clear blockers for offscreen/non visible surfaces and so on.

Actually it might be a good start as is, we can clear some blockers directly while figuring out the primary scan-out output.

Can we do better than using an idle task for calling blocker_cleared?

This might be anvil specifc, but I am actually not sure. calling blocker_cleared needs the client state and we
also have to provide the compositor state. this makes it hard to call from within a nested function inside the state
like the render function in anvil. For now I just worked around this by scheduling an idle task...

Yes, I refactored post_commit and it can now use the state. In addition it also de-duplicates blocker_cleared per client.

Testing

I pushed a simple test client here.

closes #1581
closes #1582

@@ -306,7 +306,8 @@ impl PrivateSurfaceData {
}
my_data
.pending_transaction
.insert_state(surface.clone(), my_data.current_txid);
.insert_state(surface.clone(), current_txid);
my_data.current_txid.0 = my_data.current_txid.0.wrapping_add(1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elinorbgr @Drakulix @ids1024 Not sure this is correct, but without incrementing the transaction id the blocked state will not be serialized but directly merged into any already blocked transaction. This means that for example the buffer will be overwritten and might get a release making fifo unusable with blockers (same for explicit sync, but I guess there it might not be an issue). It would also break my fifo barrier logic because it would allow to override an already pending barrier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly not sure, if this is a correct "fix" for this issue, but yeah with explicit sync and fifo/commit-timing we shouldn't merge commit states, but just advance to the latest ready one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, until now with mailbox alone this just wasn't important. but so far this seems to work correct and not regress existing stuff.

}

if let Some(barrier) = into.barrier.replace(barrier) {
barrier.signal();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to come up with a reason why this might be problematic, but so far couldn't find one.

@cmeissl cmeissl force-pushed the feature/fifo_v1 branch 2 times, most recently from 781d84f to 6f358d4 Compare November 15, 2024 19:12
@cmeissl cmeissl changed the title Support fifo_v1 protocol Support fifo-v1 and commit-timing-v1 protocol Nov 15, 2024
@cmeissl cmeissl force-pushed the feature/fifo_v1 branch 4 times, most recently from b899004 to 467a82f Compare November 16, 2024 17:27
@cmeissl cmeissl marked this pull request as ready for review November 16, 2024 17:31
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fifo-protocol states that:

If the surface is not being updated by the compositor (off-screen, occluded) the compositor may ignore the constraint.

I guess that would just mean immediately clearing the blocker on commit, right?

@@ -306,7 +306,8 @@ impl PrivateSurfaceData {
}
my_data
.pending_transaction
.insert_state(surface.clone(), my_data.current_txid);
.insert_state(surface.clone(), current_txid);
my_data.current_txid.0 = my_data.current_txid.0.wrapping_add(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly not sure, if this is a correct "fix" for this issue, but yeah with explicit sync and fifo/commit-timing we shouldn't merge commit states, but just advance to the latest ready one.

anvil/src/state.rs Show resolved Hide resolved
src/wayland/fifo/mod.rs Outdated Show resolved Hide resolved
@cmeissl
Copy link
Collaborator Author

cmeissl commented Nov 18, 2024

The fifo-protocol states that:

If the surface is not being updated by the compositor (off-screen, occluded) the compositor may ignore the constraint.

I guess that would just mean immediately clearing the blocker on commit, right?

At commit time we might not know and the protocol only says may. What I did in anvil is that a blocker will be cleared if the processed output matches the primary output or if the surface does not have a primary output. imo the main reason for having this written in the spec is to allow a client make forward progress instead of being blocked indefinitely with frame callbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for commit-timing-v1 Support for fifo-v1
2 participants