From 6bb4ebdf04ef22995f8a3cfc9a525e8ec0a48316 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 22 Nov 2022 13:35:36 +0100 Subject: [PATCH] backends/drm: set hdr metadata to 0 Otherwise we might have broken colors from leftover state of other compositors --- src/backends/drm/drm_connector.cpp | 3 ++- src/backends/drm/drm_connector.h | 1 + src/backends/drm/drm_pipeline.cpp | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_connector.cpp b/src/backends/drm/drm_connector.cpp index edc1fbfd97..524fe9aa43 100644 --- a/src/backends/drm/drm_connector.cpp +++ b/src/backends/drm/drm_connector.cpp @@ -113,7 +113,8 @@ DrmConnector::DrmConnector(DrmGpu *gpu, uint32_t connectorId) {QByteArrayLiteral("Good"), QByteArrayLiteral("Bad")}), PropertyDefinition(QByteArrayLiteral("content type"), Requirement::Optional, {QByteArrayLiteral("No Data"), QByteArrayLiteral("Graphics"), QByteArrayLiteral("Photo"), QByteArrayLiteral("Cinema"), QByteArrayLiteral("Game")}), - PropertyDefinition(QByteArrayLiteral("panel orientation"), Requirement::Optional, {QByteArrayLiteral("Normal"), QByteArrayLiteral("Upside Down"), QByteArrayLiteral("Left Side Up"), QByteArrayLiteral("Right Side Up")})}, + PropertyDefinition(QByteArrayLiteral("panel orientation"), Requirement::Optional, {QByteArrayLiteral("Normal"), QByteArrayLiteral("Upside Down"), QByteArrayLiteral("Left Side Up"), QByteArrayLiteral("Right Side Up")}), + PropertyDefinition(QByteArrayLiteral("HDR_OUTPUT_METADATA"), Requirement::Optional)}, DRM_MODE_OBJECT_CONNECTOR) , m_pipeline(std::make_unique(this)) , m_conn(drmModeGetConnector(gpu->fd(), connectorId)) diff --git a/src/backends/drm/drm_connector.h b/src/backends/drm/drm_connector.h index 803186c1f9..b60afca7ca 100644 --- a/src/backends/drm/drm_connector.h +++ b/src/backends/drm/drm_connector.h @@ -66,6 +66,7 @@ public: LinkStatus = 11, ContentType = 12, PanelOrientation = 13, + HdrMetadata = 14, Count }; diff --git a/src/backends/drm/drm_pipeline.cpp b/src/backends/drm/drm_pipeline.cpp index 65506ff03d..afeed4263e 100644 --- a/src/backends/drm/drm_pipeline.cpp +++ b/src/backends/drm/drm_pipeline.cpp @@ -261,6 +261,9 @@ void DrmPipeline::prepareAtomicModeset() } bpc->setPending(std::min(bpc->maxValue(), preferred)); } + if (const auto hdr = m_connector->getProp(DrmConnector::PropertyIndex::HdrMetadata)) { + hdr->setPending(0); + } m_pending.crtc->setPending(DrmCrtc::PropertyIndex::Active, 1); m_pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, m_pending.mode->blobId());