From 1ae9ead82cf9de09926518160eb1616595c6840a Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:13:44 +0300 Subject: [PATCH] drm: pass explicitOutFence pointer and do not touch the value (#10) * pass explicitOutFence pointer and do not touch the value * add resetExplicitFences --- include/aquamarine/output/Output.hpp | 1 + src/backend/drm/impl/Atomic.cpp | 4 ++-- src/output/Output.cpp | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/aquamarine/output/Output.hpp b/include/aquamarine/output/Output.hpp index d6d6723..957ff41 100644 --- a/include/aquamarine/output/Output.hpp +++ b/include/aquamarine/output/Output.hpp @@ -82,6 +82,7 @@ namespace Aquamarine { void setBuffer(Hyprutils::Memory::CSharedPointer buffer); void setExplicitInFence(int64_t fenceFD); // -1 removes void setExplicitOutFence(int64_t fenceFD); // -1 removes + void resetExplicitFences(); private: SInternalState internalState; diff --git a/src/backend/drm/impl/Atomic.cpp b/src/backend/drm/impl/Atomic.cpp index 6869956..724cd5c 100644 --- a/src/backend/drm/impl/Atomic.cpp +++ b/src/backend/drm/impl/Atomic.cpp @@ -101,8 +101,8 @@ void Aquamarine::CDRMAtomicRequest::addConnector(Hyprutils::Memory::CSharedPoint add(connector->crtc->id, connector->crtc->props.active, enable); if (enable) { - if (connector->output->supportsExplicit && STATE.explicitOutFence >= 0) - add(connector->crtc->id, connector->crtc->props.out_fence_ptr, STATE.explicitOutFence); + if (connector->output->supportsExplicit && STATE.committed & COutputState::AQ_OUTPUT_STATE_EXPLICIT_OUT_FENCE) + add(connector->crtc->id, connector->crtc->props.out_fence_ptr, (uintptr_t)&STATE.explicitOutFence); if (connector->crtc->props.gamma_lut && data.atomic.gammad) add(connector->crtc->id, connector->crtc->props.gamma_lut, data.atomic.gammaLut); diff --git a/src/output/Output.cpp b/src/output/Output.cpp index bad45ea..20e39ce 100644 --- a/src/output/Output.cpp +++ b/src/output/Output.cpp @@ -101,15 +101,17 @@ void Aquamarine::COutputState::setExplicitInFence(int64_t fenceFD) { } void Aquamarine::COutputState::setExplicitOutFence(int64_t fenceFD) { - internalState.explicitOutFence = fenceFD; + // internalState.explicitOutFence = fenceFD; internalState.committed |= AQ_OUTPUT_STATE_EXPLICIT_OUT_FENCE; } +void Aquamarine::COutputState::resetExplicitFences() { + // fences are now used, let's reset them to not confuse ourselves later. + internalState.explicitInFence = -1; + internalState.explicitOutFence = -1; +} + void Aquamarine::COutputState::onCommit() { internalState.committed = 0; internalState.damage.clear(); - - // fences are now used, let's reset them to not confuse ourselves later. - internalState.explicitInFence = -1; - internalState.explicitOutFence = -1; }