backends/drm: limit max_bpc to 8 by default with docks

There's generally a lot of problems with higher than 8bpc in docking stations,
especially when multiple monitors are involved. Until these problems are hopefully
eventually fixed on the driver side, limit the bpc to 8 with docks by default
This commit is contained in:
Xaver Hugl 2024-07-16 23:10:16 +02:00
parent 63bf2db551
commit 099a1cc31f

View file

@ -314,7 +314,13 @@ bool DrmPipeline::prepareAtomicModeset(DrmAtomicCommit *commit)
// TODO migrate this env var to a proper setting // TODO migrate this env var to a proper setting
static bool ok = false; static bool ok = false;
static const int preferred = qEnvironmentVariableIntValue("KWIN_DRM_PREFER_COLOR_DEPTH", &ok); static const int preferred = qEnvironmentVariableIntValue("KWIN_DRM_PREFER_COLOR_DEPTH", &ok);
commit->addProperty(m_connector->maxBpc, ok && preferred == 24 ? 8 : 10); // docks very often have problems with higher than 8 bits per color
// see https://gitlab.freedesktop.org/drm/amd/-/issues/2598 for example
uint32_t bpc = m_connector->mstPath().isEmpty() ? 10 : 8;
if (ok) {
bpc = preferred / 3;
}
commit->addProperty(m_connector->maxBpc, std::clamp<uint32_t>(bpc, m_connector->maxBpc.minValue(), m_connector->maxBpc.maxValue()));
} }
if (m_connector->hdrMetadata.isValid()) { if (m_connector->hdrMetadata.isValid()) {
commit->addBlob(m_connector->hdrMetadata, createHdrMetadata(m_pending.colorDescription.transferFunction())); commit->addBlob(m_connector->hdrMetadata, createHdrMetadata(m_pending.colorDescription.transferFunction()));