platforms/drm: where necessary, disconnect CRTCs after VT switch

This commit is contained in:
Xaver Hugl 2021-07-16 17:17:19 +02:00
parent f9f474d7e4
commit 97f8bfac5c
3 changed files with 22 additions and 0 deletions

View file

@ -144,12 +144,18 @@ void DrmBackend::reactivate()
for (const auto &output : qAsConst(m_outputs)) {
output->pipeline()->updateProperties();
if (output->isEnabled()) {
if (output->gpu()->atomicModeSetting() && !output->pipeline()->isConnected()) {
output->pipeline()->setActive(false);
}
output->renderLoop()->uninhibit();
output->showCursor();
} else {
output->pipeline()->setActive(false);
}
}
for (const auto &output : qAsConst(m_outputs)) {
output->pipeline()->setActive(output->isEnabled());
}
if (Compositor *compositor = Compositor::self()) {
compositor->addRepaintFull();

View file

@ -530,6 +530,16 @@ void DrmPipeline::updateProperties()
m_cursor.dirty = true;
}
bool DrmPipeline::isConnected() const
{
if (m_primaryPlane) {
return m_connector->getProp(DrmConnector::PropertyIndex::CrtcId)->current() == m_crtc->id()
&& m_primaryPlane->getProp(DrmPlane::PropertyIndex::CrtcId)->current() == m_crtc->id();
} else {
return false;
}
}
static void printProps(DrmObject *object)
{
auto list = object->properties();

View file

@ -35,6 +35,12 @@ public:
DrmPipeline(DrmGpu *gpu, DrmConnector *conn, DrmCrtc *crtc, DrmPlane *primaryPlane);
~DrmPipeline();
/**
* checks if the connector(s) and plane(s) are set to the CRTC(s)
* always returns false in legacy mode
*/
bool isConnected() const;
/**
* tests the pending commit first and commits it if the test passes
* if the test fails, there is a guarantee for no lasting changes