mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-12 01:29:50 +01:00
core: Add render:allow_early_buffer_release to make buffer release configurable (#9019)
This commit is contained in:
parent
b5fb6110ab
commit
a8b568c6c4
3 changed files with 17 additions and 5 deletions
|
@ -1313,6 +1313,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
||||||
.type = CONFIG_OPTION_INT,
|
.type = CONFIG_OPTION_INT,
|
||||||
.data = SConfigOptionDescription::SRangeData{2, 0, 2},
|
.data = SConfigOptionDescription::SRangeData{2, 0, 2},
|
||||||
},
|
},
|
||||||
|
SConfigOptionDescription{
|
||||||
|
.value = "render:allow_early_buffer_release",
|
||||||
|
.description = "Allow early buffer release event. Fixes stuttering and missing frames for some apps. May cause graphical glitches and memory leaks in others",
|
||||||
|
.type = CONFIG_OPTION_BOOL,
|
||||||
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cursor:
|
* cursor:
|
||||||
|
|
|
@ -619,6 +619,7 @@ CConfigManager::CConfigManager() {
|
||||||
m_pConfig->addConfigValue("render:expand_undersized_textures", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("render:expand_undersized_textures", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("render:xp_mode", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("render:xp_mode", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("render:ctm_animation", Hyprlang::INT{2});
|
m_pConfig->addConfigValue("render:ctm_animation", Hyprlang::INT{2});
|
||||||
|
m_pConfig->addConfigValue("render:allow_early_buffer_release", Hyprlang::INT{1});
|
||||||
|
|
||||||
m_pConfig->addConfigValue("ecosystem:no_update_news", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("ecosystem:no_update_news", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("ecosystem:no_donation_nag", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("ecosystem:no_donation_nag", Hyprlang::INT{0});
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "../PresentationTime.hpp"
|
#include "../PresentationTime.hpp"
|
||||||
#include "../DRMSyncobj.hpp"
|
#include "../DRMSyncobj.hpp"
|
||||||
#include "../../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
|
#include "config/ConfigValue.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
class CDefaultSurfaceRole : public ISurfaceRole {
|
class CDefaultSurfaceRole : public ISurfaceRole {
|
||||||
|
@ -423,12 +424,14 @@ void CWLSurfaceResource::unlockPendingState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurfaceResource::commitPendingState() {
|
void CWLSurfaceResource::commitPendingState() {
|
||||||
auto const previousBuffer = current.buffer;
|
static auto PDROP = CConfigValue<Hyprlang::INT>("render:allow_early_buffer_release");
|
||||||
current = pending;
|
auto const previousBuffer = current.buffer;
|
||||||
|
current = pending;
|
||||||
pending.damage.clear();
|
pending.damage.clear();
|
||||||
pending.bufferDamage.clear();
|
pending.bufferDamage.clear();
|
||||||
pending.newBuffer = false;
|
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();
|
events.roleCommit.emit();
|
||||||
|
|
||||||
|
@ -450,8 +453,10 @@ void CWLSurfaceResource::commitPendingState() {
|
||||||
// release the buffer if it's synchronous as update() has done everything thats needed
|
// release the buffer if it's synchronous as update() has done everything thats needed
|
||||||
// so we can let the app know we're done.
|
// 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.
|
// 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())
|
if (current.buffer->buffer->isSynchronous() && *PDROP) {
|
||||||
// dropCurrentBuffer();
|
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
|
// TODO: we should _accumulate_ and not replace above if sync
|
||||||
|
|
Loading…
Reference in a new issue