summaryrefslogtreecommitdiff
path: root/src/protocols/core/Compositor.cpp
diff options
context:
space:
mode:
authorLee Bousfield <ljbousfield@gmail.com>2025-03-28 11:00:39 -0500
committerGitHub <noreply@github.com>2025-03-28 17:00:39 +0100
commit10035a85cc05f4ee572efb13e62aa1a1cfec6c8b (patch)
tree6638b07c05ee6949ed1a01aa1c4bac3baf4c1986 /src/protocols/core/Compositor.cpp
parentc93140a5f12a25f0a08b162caf31fe68fec62290 (diff)
core: Don't damage the entire surface every frame (#9763)
* core: Don't damage the entire surface every frame * core: Damage buffer on dims or transform change * core: Use guards for scale and tr equality checks
Diffstat (limited to 'src/protocols/core/Compositor.cpp')
-rw-r--r--src/protocols/core/Compositor.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 974207a4..cb1aa69a 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -77,6 +77,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
if (!buffer) {
pending.buffer.reset();
pending.texture.reset();
+ pending.bufferSize = Vector2D{};
} else {
auto res = CWLBufferResource::fromResource(buffer);
pending.buffer = res && res->buffer ? makeShared<CHLBufferReference>(res->buffer.lock(), self.lock()) : nullptr;
@@ -85,10 +86,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
pending.bufferSize = res && res->buffer ? res->buffer->size : Vector2D{};
}
- Vector2D oldBufSize = current.buffer ? current.bufferSize : Vector2D{};
- Vector2D newBufSize = pending.buffer ? pending.bufferSize : Vector2D{};
-
- if (oldBufSize != newBufSize || current.buffer != pending.buffer)
+ if (pending.bufferSize != current.bufferSize)
pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
});
@@ -129,12 +127,18 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
});
resource->setSetBufferScale([this](CWlSurface* r, int32_t scale) {
- pending.updated |= SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_SCALE;
- pending.scale = scale;
+ if (scale == pending.scale)
+ return;
+ pending.updated |= SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_SCALE | SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_DAMAGE;
+ pending.scale = scale;
+ pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
});
resource->setSetBufferTransform([this](CWlSurface* r, uint32_t tr) {
- pending.updated |= SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_TRANSFORM;
- pending.transform = (wl_output_transform)tr;
+ if (tr == pending.transform)
+ return;
+ pending.updated |= SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_TRANSFORM | SSurfaceState::eUpdatedProperties::SURFACE_UPDATED_DAMAGE;
+ pending.transform = (wl_output_transform)tr;
+ pending.bufferDamage = CBox{{}, {INT32_MAX, INT32_MAX}};
});
resource->setSetInputRegion([this](CWlSurface* r, wl_resource* region) {