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 {
|
class IDRMImplementation {
|
||||||
public:
|
public:
|
||||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data) = 0;
|
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.
|
// 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;
|
virtual bool moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector) = 0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Aquamarine {
|
||||||
public:
|
public:
|
||||||
CDRMAtomicImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
CDRMAtomicImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
||||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data);
|
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);
|
virtual bool moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Aquamarine {
|
||||||
public:
|
public:
|
||||||
CDRMLegacyImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
CDRMLegacyImpl(Hyprutils::Memory::CSharedPointer<CDRMBackend> backend_);
|
||||||
virtual bool commit(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector, SDRMConnectorCommitData& data);
|
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);
|
virtual bool moveCursor(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -253,15 +253,8 @@ void Aquamarine::CDRMBackend::restoreAfterVT() {
|
||||||
|
|
||||||
backend->log(AQ_LOG_DEBUG, "drm: Rescanned connectors");
|
backend->log(AQ_LOG_DEBUG, "drm: Rescanned connectors");
|
||||||
|
|
||||||
for (auto& c : connectors) {
|
if (!impl->reset())
|
||||||
if (!c->crtc)
|
backend->log(AQ_LOG_ERROR, "drm: failed reset");
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& c : connectors) {
|
for (auto& c : connectors) {
|
||||||
if (!c->crtc)
|
if (!c->crtc)
|
||||||
|
@ -524,6 +517,7 @@ void Aquamarine::CDRMBackend::scanConnectors() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CDRMBackend::start() {
|
bool Aquamarine::CDRMBackend::start() {
|
||||||
|
impl->reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ bool Aquamarine::CDRMAtomicImpl::commit(Hyprutils::Memory::CSharedPointer<SDRMCo
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CDRMAtomicImpl::reset(Hyprutils::Memory::CSharedPointer<SDRMConnector> connector) {
|
bool Aquamarine::CDRMAtomicImpl::reset() {
|
||||||
CDRMAtomicRequest request(backend);
|
CDRMAtomicRequest request(backend);
|
||||||
|
|
||||||
for (auto& crtc : backend->crtcs) {
|
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);
|
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)
|
if (!connector->output->cursorVisible || !connector->output->state->state().enabled || !connector->crtc || !connector->crtc->cursor)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -150,13 +150,12 @@ bool Aquamarine::CDRMLegacyImpl::commit(Hyprutils::Memory::CSharedPointer<SDRMCo
|
||||||
return commitInternal(connector, data);
|
return commitInternal(connector, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Aquamarine::CDRMLegacyImpl::reset(SP<SDRMConnector> connector) {
|
bool Aquamarine::CDRMLegacyImpl::reset() {
|
||||||
if (!connector->crtc)
|
for (auto& connector : backend->connectors) {
|
||||||
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)));
|
||||||
if (int ret = drmModeSetCrtc(backend->gpu->fd, connector->crtc->id, 0, 0, 0, nullptr, 0, nullptr); ret) {
|
return false;
|
||||||
connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: reset failed: {}", strerror(-ret)));
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue