Skip to content

Commit 210930b

Browse files
authored
buffers: revert state merging (#12461)
8e8bfbb added fifo and merged non buffer states before comitting them, something about certain xwl non buffer commits expects a commit to happend and causes regressions as in low fps.
1 parent 40d8fa8 commit 210930b

File tree

4 files changed

+14
-36
lines changed

4 files changed

+14
-36
lines changed

src/protocols/core/Compositor.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@ void CWLSurfaceResource::commitState(SSurfaceState& state) {
550550
nullptr);
551551
}
552552

553-
if (m_current.updated.bits.damage) {
554-
// damage is always relative to the current commit
555-
m_current.updated.bits.damage = false;
556-
m_current.damage.clear();
557-
m_current.bufferDamage.clear();
558-
}
559-
560553
// release the buffer if it's synchronous (SHM) as updateSynchronousTexture() has copied the buffer data to a GPU tex
561554
// if it doesn't have a role, we can't release it yet, in case it gets turned into a cursor.
562555
if (m_current.buffer && m_current.buffer->isSynchronous() && m_role->role() != SURFACE_ROLE_UNASSIGNED)

src/protocols/types/SurfaceState.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ void SSurfaceState::reset() {
6565
lockMask = LOCK_REASON_NONE;
6666
}
6767

68-
void SSurfaceState::updateFrom(SSurfaceState& ref, bool merge) {
69-
if (merge)
70-
updated.all |= ref.updated.all;
71-
else
72-
updated = ref.updated;
68+
void SSurfaceState::updateFrom(SSurfaceState& ref) {
69+
updated = ref.updated;
7370

7471
if (ref.updated.bits.buffer) {
7572
buffer = ref.buffer;
@@ -81,6 +78,10 @@ void SSurfaceState::updateFrom(SSurfaceState& ref, bool merge) {
8178
if (ref.updated.bits.damage) {
8279
damage = ref.damage;
8380
bufferDamage = ref.bufferDamage;
81+
} else {
82+
// damage is always relative to the current commit
83+
damage.clear();
84+
bufferDamage.clear();
8485
}
8586

8687
if (ref.updated.bits.input)

src/protocols/types/SurfaceState.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct SSurfaceState {
8989
void updateSynchronousTexture(SP<CTexture> lastTexture);
9090

9191
// helpers
92-
CRegion accumulateBufferDamage(); // transforms state.damage and merges it into state.bufferDamage
93-
void updateFrom(SSurfaceState& ref, bool merge = false); // updates this state based on a reference state.
94-
void reset(); // resets pending state after commit
92+
CRegion accumulateBufferDamage(); // transforms state.damage and merges it into state.bufferDamage
93+
void updateFrom(SSurfaceState& ref); // updates this state based on a reference state.
94+
void reset(); // resets pending state after commit
9595
};

src/protocols/types/SurfaceStateQueue.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,12 @@ auto CSurfaceStateQueue::find(const WP<SSurfaceState>& state) -> std::deque<UP<S
6363
}
6464

6565
void CSurfaceStateQueue::tryProcess() {
66-
if (m_queue.empty())
67-
return;
68-
69-
auto front = m_queue.begin();
70-
if (front->get()->lockMask != LOCK_REASON_NONE)
71-
return;
66+
while (!m_queue.empty()) {
67+
auto& front = m_queue.front();
68+
if (front->lockMask != LOCK_REASON_NONE)
69+
return;
7270

73-
auto next = std::next(front);
74-
if (next == m_queue.end()) {
75-
m_surface->commitState(**front);
71+
m_surface->commitState(*front);
7672
m_queue.pop_front();
77-
return;
7873
}
79-
80-
while (!m_queue.empty() && next != m_queue.end() && next->get()->lockMask == LOCK_REASON_NONE && !next->get()->updated.bits.buffer) {
81-
next->get()->updateFrom(**front, true);
82-
m_queue.pop_front();
83-
84-
front = m_queue.begin();
85-
next = std::next(front);
86-
}
87-
88-
m_surface->commitState(**front);
89-
m_queue.pop_front();
9074
}

0 commit comments

Comments
 (0)