This repository was archived by the owner on Nov 1, 2021. It is now read-only.
Open
Conversation
11f5122 to
8a097de
Compare
This was referenced Sep 12, 2021
13be55c to
7d692d9
Compare
7d692d9 to
20c65e7
Compare
f76b5b2 to
d89f58a
Compare
This was referenced Oct 9, 2021
dbb8003 to
29ae1e2
Compare
29ae1e2 to
0ca63af
Compare
0ca63af to
ec4c756
Compare
emersion
reviewed
Oct 26, 2021
emersion
reviewed
Oct 26, 2021
emersion
reviewed
Oct 26, 2021
added 2 commits
October 26, 2021 15:30
This is a prerequisite for the next commits.
bd3ff8c to
eba505a
Compare
added 9 commits
October 26, 2021 16:03
State squashing refers to the action of combining the state with the one right before it; the older state becomes a "sum" of two states, and the newer state becomes empty. This allows to free up memory and release client resources as soon as possible.
eba505a to
f6c02b3
Compare
Member
Author
|
Replaced all loops over cached states with a loop + current/pending check where applicable. |
Member
|
wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3151 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also see individual commits.
Closes #1546
Supersedes #2977, #1685 (?)
Fixes #3235
State squashing
Squashing refers to an action of combining a state with the state right before it in the queue. The older state becomes a "sum" of two states, and the newer state becomes empty.
Data structure
This PR introduces
wlr_surface_syncedandwlr_surface_synced_stateto keep track of objects synchronized with the surface state flow. At any given moment, a surface has acurrentstate, apendingstate, and optionally a number of cached states. Thus, the following data structure is maintained:This setup allows to perform state caching and squashing in
O(k)time, wherekis the number of surface-synced objects. When a state is cached, a column ofcachedn+1states is added right before the last one (pending).Creation of a surface-synced object adds a row of
syncedk+1states and is done inO(n), wherenis the number of cached states at the moment; most of the time,nis 0. Note that rows have undefined order;wlr_surface::syncedandwlr_surface_state::syncedmust be treated as unordered sets.Progress
wl_subsurfacexdg_surfacexdg_toplevelzwlr_layer_surface_v1zxdg_toplevel_decorationzwp_pointer_constraints_v1wp_presentation_feedbackThere are objects which only have
currentstate which is updated on surface commit; those don't need to be surface-synced.Notes
wlr_surface.current.seqis meaningless and is always 0. It can't be set to the sequence number of the state being committed.Consider the following situation:
current⇄A(seq 1)⇄B(seq 2)⇄pending.If
Ais unlocked and thenBis unlocked,wlr_surface.current.seqis set to1and then2.However, if
Bis unlocked first, it's squashed intoA.A.seqcan't be updated to2, because whatever lockedAstill has the old sequence number. After unlockingA,wlr_surface.current.seqwill be1. To avoid this inconsistency, sequence numbers aren't updated at all and assumed to be only used for state locking.Note that this could be fixed in a non-breaking way by introducing
wlr_surface_state.lock_seqand updatingwlr_surface_state.seqon squash, if required.While
wlr_surface_synced_interface.precommitis called right before the current state update,wlr_surface_role.precommitis called onwl_surface.commitrequest. This is a bug and will be fixed in another PR.*.current.committednow indicates which parts of the current state were modified by the most recent commit.Breaking changes
This is (supposed to be) a purely internal change and shouldn't require any action from compositor developers.