drm/legacy: avoid crashing on missing crtcs

This commit is contained in:
Vaxry 2024-06-30 21:43:18 +02:00
parent 25836ee88e
commit cef415f033

View file

@ -151,12 +151,16 @@ bool Aquamarine::CDRMLegacyImpl::commit(Hyprutils::Memory::CSharedPointer<SDRMCo
} }
bool Aquamarine::CDRMLegacyImpl::reset() { bool Aquamarine::CDRMLegacyImpl::reset() {
bool ok = true;
for (auto& connector : backend->connectors) { for (auto& connector : backend->connectors) {
if (!connector->crtc)
continue;
if (int ret = drmModeSetCrtc(backend->gpu->fd, connector->crtc->id, 0, 0, 0, nullptr, 0, nullptr); ret) { 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))); connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: reset failed: {}", strerror(-ret)));
return false; ok = false;
} }
} }
return true; return ok;
} }