diff --git a/include/aquamarine/backend/DRM.hpp b/include/aquamarine/backend/DRM.hpp index e7bbad0..f84d943 100644 --- a/include/aquamarine/backend/DRM.hpp +++ b/include/aquamarine/backend/DRM.hpp @@ -270,7 +270,7 @@ namespace Aquamarine { class IDRMImplementation { public: virtual bool commit(Hyprutils::Memory::CSharedPointer connector, SDRMConnectorCommitData& data) = 0; - virtual bool reset(Hyprutils::Memory::CSharedPointer connector) = 0; + virtual bool reset() = 0; // moving a cursor IIRC is almost instant on most hardware so we don't have to wait for a commit. virtual bool moveCursor(Hyprutils::Memory::CSharedPointer connector) = 0; diff --git a/include/aquamarine/backend/drm/Atomic.hpp b/include/aquamarine/backend/drm/Atomic.hpp index ac1a047..400932a 100644 --- a/include/aquamarine/backend/drm/Atomic.hpp +++ b/include/aquamarine/backend/drm/Atomic.hpp @@ -7,7 +7,7 @@ namespace Aquamarine { public: CDRMAtomicImpl(Hyprutils::Memory::CSharedPointer backend_); virtual bool commit(Hyprutils::Memory::CSharedPointer connector, SDRMConnectorCommitData& data); - virtual bool reset(Hyprutils::Memory::CSharedPointer connector); + virtual bool reset(); virtual bool moveCursor(Hyprutils::Memory::CSharedPointer connector); private: diff --git a/include/aquamarine/backend/drm/Legacy.hpp b/include/aquamarine/backend/drm/Legacy.hpp index fd0a895..530dccb 100644 --- a/include/aquamarine/backend/drm/Legacy.hpp +++ b/include/aquamarine/backend/drm/Legacy.hpp @@ -7,7 +7,7 @@ namespace Aquamarine { public: CDRMLegacyImpl(Hyprutils::Memory::CSharedPointer backend_); virtual bool commit(Hyprutils::Memory::CSharedPointer connector, SDRMConnectorCommitData& data); - virtual bool reset(Hyprutils::Memory::CSharedPointer connector); + virtual bool reset(); virtual bool moveCursor(Hyprutils::Memory::CSharedPointer connector); private: diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index d680d1c..753cf9b 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -253,15 +253,8 @@ void Aquamarine::CDRMBackend::restoreAfterVT() { backend->log(AQ_LOG_DEBUG, "drm: Rescanned connectors"); - for (auto& c : connectors) { - if (!c->crtc) - continue; - - backend->log(AQ_LOG_DEBUG, std::format("drm: Resetting crtc {}", c->crtc->id)); - - if (!impl->reset(c)) - backend->log(AQ_LOG_ERROR, std::format("drm: crtc {} failed reset", c->crtc->id)); - } + if (!impl->reset()) + backend->log(AQ_LOG_ERROR, "drm: failed reset"); for (auto& c : connectors) { if (!c->crtc) @@ -524,6 +517,7 @@ void Aquamarine::CDRMBackend::scanConnectors() { } bool Aquamarine::CDRMBackend::start() { + impl->reset(); return true; } diff --git a/src/backend/drm/impl/Atomic.cpp b/src/backend/drm/impl/Atomic.cpp index ad502c6..8b2ad6b 100644 --- a/src/backend/drm/impl/Atomic.cpp +++ b/src/backend/drm/impl/Atomic.cpp @@ -272,7 +272,7 @@ bool Aquamarine::CDRMAtomicImpl::commit(Hyprutils::Memory::CSharedPointer connector) { +bool Aquamarine::CDRMAtomicImpl::reset() { CDRMAtomicRequest request(backend); for (auto& crtc : backend->crtcs) { @@ -291,7 +291,7 @@ bool Aquamarine::CDRMAtomicImpl::reset(Hyprutils::Memory::CSharedPointer connector) { +bool Aquamarine::CDRMAtomicImpl::moveCursor(SP connector) { if (!connector->output->cursorVisible || !connector->output->state->state().enabled || !connector->crtc || !connector->crtc->cursor) return true; diff --git a/src/backend/drm/impl/Legacy.cpp b/src/backend/drm/impl/Legacy.cpp index 9732458..58accde 100644 --- a/src/backend/drm/impl/Legacy.cpp +++ b/src/backend/drm/impl/Legacy.cpp @@ -150,13 +150,12 @@ bool Aquamarine::CDRMLegacyImpl::commit(Hyprutils::Memory::CSharedPointer connector) { - if (!connector->crtc) - return true; - - if (int ret = drmModeSetCrtc(backend->gpu->fd, connector->crtc->id, 0, 0, 0, nullptr, 0, nullptr); ret) { - connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: reset failed: {}", strerror(-ret))); - return false; +bool Aquamarine::CDRMLegacyImpl::reset() { + for (auto& connector : backend->connectors) { + if (int ret = drmModeSetCrtc(backend->gpu->fd, connector->crtc->id, 0, 0, 0, nullptr, 0, nullptr); ret) { + connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: reset failed: {}", strerror(-ret))); + return false; + } } return true;