mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 04:56:00 +01:00
drm: reset on beginning of DRM
We do not set atomic props for everything, so all else should be reset
This commit is contained in:
parent
c19bf35c02
commit
25836ee88e
6 changed files with 14 additions and 21 deletions
|
@ -270,7 +270,7 @@ namespace Aquamarine {
|
|||
class IDRMImplementation {
|
||||
public:
|
||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) = 0;
|
||||
virtual bool reset(Hyprutils::Memory::CSharedPointer<SDRMConnector> 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<SDRMConnector> connector) = 0;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Aquamarine {
|
|||
public:
|
||||
CDRMAtomicImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data);
|
||||
virtual bool reset(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||
virtual bool reset();
|
||||
virtual bool moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||
|
||||
private:
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Aquamarine {
|
|||
public:
|
||||
CDRMLegacyImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data);
|
||||
virtual bool reset(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||
virtual bool reset();
|
||||
virtual bool moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||
|
||||
private:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ bool Aquamarine::CDRMAtomicImpl::commit(Hyprutils::Memory::CSharedPointer<SDRMCo
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool Aquamarine::CDRMAtomicImpl::reset(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector) {
|
||||
bool Aquamarine::CDRMAtomicImpl::reset() {
|
||||
CDRMAtomicRequest request(backend);
|
||||
|
||||
for (auto& crtc : backend->crtcs) {
|
||||
|
@ -291,7 +291,7 @@ bool Aquamarine::CDRMAtomicImpl::reset(Hyprutils::Memory::CSharedPointer<SDRMCon
|
|||
return request.commit(DRM_MODE_ATOMIC_ALLOW_MODESET);
|
||||
}
|
||||
|
||||
bool Aquamarine::CDRMAtomicImpl::moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector) {
|
||||
bool Aquamarine::CDRMAtomicImpl::moveCursor(SP<SDRMConnector> connector) {
|
||||
if (!connector->output->cursorVisible || !connector->output->state->state().enabled || !connector->crtc || !connector->crtc->cursor)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -150,13 +150,12 @@ bool Aquamarine::CDRMLegacyImpl::commit(Hyprutils::Memory::CSharedPointer<SDRMCo
|
|||
return commitInternal(connector, data);
|
||||
}
|
||||
|
||||
bool Aquamarine::CDRMLegacyImpl::reset(SP<SDRMConnector> 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;
|
||||
|
|
Loading…
Reference in a new issue