From 8ed37dc475e86593c66af27cb0321e5f73e4ba3b Mon Sep 17 00:00:00 2001 From: UjinT34 Date: Sun, 6 Oct 2024 15:09:44 +0300 Subject: [PATCH] do not set cursor planeProps unless smth changed --- include/aquamarine/output/Output.hpp | 1 + src/backend/drm/DRM.cpp | 4 ++++ src/backend/drm/impl/Atomic.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/aquamarine/output/Output.hpp b/include/aquamarine/output/Output.hpp index 1288a1f..41e4da3 100644 --- a/include/aquamarine/output/Output.hpp +++ b/include/aquamarine/output/Output.hpp @@ -53,6 +53,7 @@ namespace Aquamarine { AQ_OUTPUT_STATE_EXPLICIT_IN_FENCE = (1 << 8), AQ_OUTPUT_STATE_EXPLICIT_OUT_FENCE = (1 << 9), AQ_OUTPUT_STATE_CTM = (1 << 10), + AQ_OUTPUT_STATE_CURSOR = (1 << 11), }; struct SInternalState { diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index f69a444..303e07e 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -1657,6 +1657,7 @@ bool Aquamarine::CDRMOutput::setCursor(SP buffer, const Vector2D& hotsp if (!connector->crtc) return false; + state->internalState.committed |= COutputState::AQ_OUTPUT_STATE_CURSOR; if (!buffer) setCursorVisible(false); else { @@ -1731,6 +1732,9 @@ bool Aquamarine::CDRMOutput::setCursor(SP buffer, const Vector2D& hotsp void Aquamarine::CDRMOutput::moveCursor(const Vector2D& coord, bool skipSchedule) { cursorPos = coord; // cursorVisible = true; + if (!skipSchedule) + state->internalState.committed |= COutputState::AQ_OUTPUT_STATE_CURSOR; + backend->impl->moveCursor(connector, skipSchedule); } diff --git a/src/backend/drm/impl/Atomic.cpp b/src/backend/drm/impl/Atomic.cpp index b031076..d766014 100644 --- a/src/backend/drm/impl/Atomic.cpp +++ b/src/backend/drm/impl/Atomic.cpp @@ -123,7 +123,7 @@ void Aquamarine::CDRMAtomicRequest::addConnector(Hyprutils::Memory::CSharedPoint if (connector->crtc->primary->props.fb_damage_clips) add(connector->crtc->primary->id, connector->crtc->primary->props.fb_damage_clips, data.atomic.fbDamage); - if (connector->crtc->cursor) { + if (connector->crtc->cursor && STATE.committed & COutputState::AQ_OUTPUT_STATE_CURSOR) { if (!connector->output->cursorVisible) planeProps(connector->crtc->cursor, nullptr, 0, {}); else