summaryrefslogtreecommitdiff
path: root/src/protocols/core/Compositor.cpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-01-10 21:42:26 +0300
committerGitHub <noreply@github.com>2025-01-10 18:42:26 +0000
commita8b568c6c451cdce3c8d40ae010247be3f25728b (patch)
treeb4d7cd4fd38ccb88afb6841fe9e419c433d7a308 /src/protocols/core/Compositor.cpp
parentb5fb6110ab1f75440b4b90d09f95d304d8c2080b (diff)
core: Add render:allow_early_buffer_release to make buffer release configurable (#9019)
Diffstat (limited to 'src/protocols/core/Compositor.cpp')
-rw-r--r--src/protocols/core/Compositor.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index 6213f987..e1d6ef7d 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -11,6 +11,7 @@
#include "../PresentationTime.hpp"
#include "../DRMSyncobj.hpp"
#include "../../render/Renderer.hpp"
+#include "config/ConfigValue.hpp"
#include <cstring>
class CDefaultSurfaceRole : public ISurfaceRole {
@@ -423,12 +424,14 @@ void CWLSurfaceResource::unlockPendingState() {
}
void CWLSurfaceResource::commitPendingState() {
- auto const previousBuffer = current.buffer;
- current = pending;
+ static auto PDROP = CConfigValue<Hyprlang::INT>("render:allow_early_buffer_release");
+ auto const previousBuffer = current.buffer;
+ current = pending;
pending.damage.clear();
pending.bufferDamage.clear();
pending.newBuffer = false;
- dropPendingBuffer(); // at this point current.buffer holds the same SP and we don't use pending anymore
+ if (!*PDROP)
+ dropPendingBuffer(); // at this point current.buffer holds the same SP and we don't use pending anymore
events.roleCommit.emit();
@@ -450,8 +453,10 @@ void CWLSurfaceResource::commitPendingState() {
// release the buffer if it's synchronous as update() has done everything thats needed
// so we can let the app know we're done.
// Some clients aren't ready to receive a release this early. Should be fine to release it on the next commitPendingState.
- // if (current.buffer->buffer->isSynchronous())
- // dropCurrentBuffer();
+ if (current.buffer->buffer->isSynchronous() && *PDROP) {
+ dropCurrentBuffer();
+ dropPendingBuffer(); // at this point current.buffer holds the same SP and we don't use pending anymore
+ }
}
// TODO: we should _accumulate_ and not replace above if sync