From e1d4c0e092aeff8b77f343ea0ccab3b92d2922ed Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sat, 16 Dec 2023 17:59:54 +0100 Subject: [PATCH] core: move content type to OutputFrame --- src/backends/drm/drm_output.cpp | 5 ++++- src/compositor.cpp | 2 +- src/core/output.cpp | 10 ---------- src/core/output.h | 11 ----------- src/core/renderbackend.cpp | 10 ++++++++++ src/core/renderbackend.h | 4 ++++ src/effect/globals.h | 8 ++++++++ 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index 00d514017a..3c90d0b120 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -270,7 +270,10 @@ bool DrmOutput::present(const std::shared_ptr &frame) { m_frame = frame; RenderLoopPrivate *renderLoopPrivate = RenderLoopPrivate::get(m_renderLoop.get()); - const auto type = DrmConnector::kwinToDrmContentType(contentType()); + auto type = m_pipeline->contentType(); + if (frame->contentType()) { + type = DrmConnector::kwinToDrmContentType(*frame->contentType()); + } if (m_pipeline->presentationMode() != renderLoopPrivate->presentationMode || type != m_pipeline->contentType()) { m_pipeline->setPresentationMode(renderLoopPrivate->presentationMode); m_pipeline->setContentType(type); diff --git a/src/compositor.cpp b/src/compositor.cpp index f53a119c0c..de471e433e 100644 --- a/src/compositor.cpp +++ b/src/compositor.cpp @@ -166,7 +166,7 @@ void Compositor::composite(RenderLoop *renderLoop) SurfaceItem *scanoutCandidate = superLayer->delegate()->scanoutCandidate(); renderLoop->setFullscreenSurface(scanoutCandidate); - output->setContentType(scanoutCandidate ? scanoutCandidate->contentType() : ContentType::None); + frame->setContentType(scanoutCandidate ? scanoutCandidate->contentType() : ContentType::None); bool directScanout = false; if (scanoutCandidate) { diff --git a/src/core/output.cpp b/src/core/output.cpp index f4afcff82d..c46427b157 100644 --- a/src/core/output.cpp +++ b/src/core/output.cpp @@ -564,16 +564,6 @@ bool Output::setGammaRamp(const std::shared_ptr &transforma return false; } -ContentType Output::contentType() const -{ - return m_contentType; -} - -void Output::setContentType(ContentType contentType) -{ - m_contentType = contentType; -} - OutputTransform Output::panelOrientation() const { return m_information.panelOrientation; diff --git a/src/core/output.h b/src/core/output.h index 6bdb88f62a..2def01901c 100644 --- a/src/core/output.h +++ b/src/core/output.h @@ -31,13 +31,6 @@ class ColorTransformation; class IccProfile; class OutputChangeSet; -enum class ContentType { - None = 0, - Photo = 1, - Video = 2, - Game = 3, -}; - /** * The OutputTransform type is used to describe the transform applied to the output content. */ @@ -319,9 +312,6 @@ public: RenderLoop::VrrPolicy vrrPolicy() const; RgbRange rgbRange() const; - ContentType contentType() const; - void setContentType(ContentType contentType); - bool isPlaceholder() const; bool isNonDesktop() const; OutputTransform panelOrientation() const; @@ -470,7 +460,6 @@ protected: QUuid m_uuid; int m_directScanoutCount = 0; int m_refCount = 1; - ContentType m_contentType = ContentType::None; }; inline QRect Output::rect() const diff --git a/src/core/renderbackend.cpp b/src/core/renderbackend.cpp index 845abc6e9d..677ebe3725 100644 --- a/src/core/renderbackend.cpp +++ b/src/core/renderbackend.cpp @@ -38,6 +38,16 @@ void OutputFrame::failed() RenderLoopPrivate::get(m_loop)->notifyFrameFailed(); } +void OutputFrame::setContentType(ContentType type) +{ + m_contentType = type; +} + +std::optional OutputFrame::contentType() const +{ + return m_contentType; +} + RenderBackend::RenderBackend(QObject *parent) : QObject(parent) { diff --git a/src/core/renderbackend.h b/src/core/renderbackend.h index 6f073509e4..7586f59354 100644 --- a/src/core/renderbackend.h +++ b/src/core/renderbackend.h @@ -49,9 +49,13 @@ public: void addFeedback(std::unique_ptr &&feedback); + void setContentType(ContentType type); + std::optional contentType() const; + private: RenderLoop *const m_loop; std::vector> m_feedbacks; + std::optional m_contentType; }; /** diff --git a/src/effect/globals.h b/src/effect/globals.h index 1099e9dbfc..4dc05e5d1e 100644 --- a/src/effect/globals.h +++ b/src/effect/globals.h @@ -281,6 +281,14 @@ enum class PresentationMode { }; Q_ENUM_NS(PresentationMode); +enum class ContentType { + None = 0, + Photo = 1, + Video = 2, + Game = 3, +}; +Q_ENUM_NS(ContentType); + } // namespace Q_DECLARE_METATYPE(std::chrono::nanoseconds)