backends/drm: only update modes if actually necessary
This prevents some unneeded modesets
This commit is contained in:
parent
72d9711e5d
commit
907cf72bb0
2 changed files with 15 additions and 8 deletions
|
@ -263,9 +263,7 @@ bool DrmGpu::updateOutputs()
|
|||
conn->updateProperties();
|
||||
}
|
||||
if (conn->isConnected()) {
|
||||
if (auto output = findOutput(conn->id())) {
|
||||
output->updateModes();
|
||||
} else if (!findLeaseOutput(conn->id())) {
|
||||
if (conn->isNonDesktop() ? !findLeaseOutput(conn->id()) : !findOutput(conn->id())) {
|
||||
qCDebug(KWIN_DRM, "New %soutput on GPU %s: %s", conn->isNonDesktop() ? "non-desktop " : "", qPrintable(m_devNode), qPrintable(conn->modelName()));
|
||||
m_pipelines << conn->pipeline();
|
||||
if (conn->isNonDesktop()) {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "logging.h"
|
||||
#include "drm_pipeline.h"
|
||||
#include "drm_object_crtc.h"
|
||||
#include "drm_output.h"
|
||||
|
||||
#include <main.h>
|
||||
// frameworks
|
||||
|
@ -286,11 +287,19 @@ bool DrmConnector::needsModeset() const
|
|||
|
||||
void DrmConnector::updateModes()
|
||||
{
|
||||
m_modes.clear();
|
||||
|
||||
// reload modes
|
||||
for (int i = 0; i < m_conn->count_modes; i++) {
|
||||
m_modes.append(QSharedPointer<DrmConnectorMode>::create(this, m_conn->modes[i]));
|
||||
bool equal = m_conn->count_modes == m_modes.count();
|
||||
for (int i = 0; equal && i < m_conn->count_modes; i++) {
|
||||
equal &= checkIfEqual(m_modes[i]->nativeMode(), &m_conn->modes[i]);
|
||||
}
|
||||
if (!equal) {
|
||||
// reload modes
|
||||
m_modes.clear();
|
||||
for (int i = 0; i < m_conn->count_modes; i++) {
|
||||
m_modes.append(QSharedPointer<DrmConnectorMode>::create(this, m_conn->modes[i]));
|
||||
}
|
||||
if (const auto output = dynamic_cast<DrmOutput*>(m_pipeline->displayDevice())) {
|
||||
output->updateModes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue