-
Notifications
You must be signed in to change notification settings - Fork 175
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
wayland: Surface Transactions #1009
Conversation
@@ -425,6 +426,10 @@ pub fn add_destruction_hook(surface: &WlSurface, hook: fn(&SurfaceData)) { | |||
PrivateSurfaceData::add_destruction_hook(surface, hook) | |||
} | |||
|
|||
pub fn add_blocker(surface: &WlSurface, blocker: impl Blocker + Send + 'static) { |
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.
We'll need documentation here before this PR is merged.
Ok so, thinking more about it, regarding the commit callback and your questions on the second commit, a general answer: Given how the code is right now, it's entirely possible that the invocation of So, I think maybe we should check if it'd be possible to have those callbacks (and the post_commit hooks) invoked directly in |
b50e3a3
to
f953500
Compare
f953500
to
04ab6d1
Compare
Seems like a good solution. |
6d05ab7
to
7239191
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1009 +/- ##
==========================================
+ Coverage 23.56% 23.65% +0.08%
==========================================
Files 132 134 +2
Lines 21089 21284 +195
==========================================
+ Hits 4969 5034 +65
- Misses 16120 16250 +130
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
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.
Overall I really like the blocker API, I just have a few questions that I left as comments.
anvil/src/shell/mod.rs
Outdated
if let Some(state) = client.get_data::<XWaylandClientData>() { | ||
state | ||
.user_data() | ||
.insert_if_missing(CompositorClientState::default); | ||
return state.user_data().get::<CompositorClientState>().unwrap(); |
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.
Could that be directly added to XWaylandClientData
? launch
initializes XWaylandClientData
where it would be possible to directly add CompositorClientState
as a field instead of using user_data
.
4b356dc
to
232b6a8
Compare
Now based on #1014 to make use of a pre-commit hook instead of buffer_attached for adding the blocker. |
3cb7692
to
203c589
Compare
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.
The whole anvil/src/shell/buffer.rs
module looks like a left over from moving the block to the pre-commit handler.
203c589
to
f96abce
Compare
Removed. |
f96abce
to
92724d5
Compare
92724d5
to
bcae5c8
Compare
Rebased after #1014 got merged without any other changes. |
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.
LGTM
Best reviewed commit-by-commit:
compositor: Use the TransactionQueue
Changes the internal handling of the compositor module to use the TransactionQueue. Should result in identical behavior, doesn't expose anything new to downstream.
compositor: Make it possible to add Blockers
Adds new public api to the compositor module to allow downstream to add Blockers to a surface, which will be considered on the next commit.
Couple of open questions for this commit:
TheNecessary to call commit and less of an issue with the changes below.CompositorClientState::blocker_cleared
-method takes a lot of really generic arguments. It works for the upcoming dmabuf-commit, but might be problematic for other use-cases. Could we require less? Should we possibly move the responsibility to re-run the commit-handler to downstream and just take a DisplayHandle?If we keep thecommit
-callback here, do we maybe want to skip the original commit-callback in the first place? We can easily bubble up the return value ofapply_ready
to conditionally skip the call.commit
call has been moved intoTransaction::apply
If there are pending blockers, post-commit-hooks will not observe any changed state. Luckily smithay doesn't use them for anything, does any compositor? Do we consider this expected behaviour? Do we want to run them once the transaction is done instead? Can we maybe just drop them?post_commit
-hooks as wellbuffer: Add buffer_attached callback
Adds a new
buffer_attached
-callback to theBufferHandler
. Prerequisite for the next commitWIP: anvil: Wait for dmabufs to become ready
Very rudimentary test of the above functionality.
Possible todos:
poll
new buffers before adding a blocker for them. We can skip a complete event loop cycle, if the buffers are already ready, which is not unlikely.