core: move content type to OutputFrame

This commit is contained in:
Xaver Hugl 2023-12-16 17:59:54 +01:00
parent 160f6069e8
commit e1d4c0e092
7 changed files with 27 additions and 23 deletions

View file

@ -270,7 +270,10 @@ bool DrmOutput::present(const std::shared_ptr<OutputFrame> &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);

View file

@ -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) {

View file

@ -564,16 +564,6 @@ bool Output::setGammaRamp(const std::shared_ptr<ColorTransformation> &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;

View file

@ -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

View file

@ -38,6 +38,16 @@ void OutputFrame::failed()
RenderLoopPrivate::get(m_loop)->notifyFrameFailed();
}
void OutputFrame::setContentType(ContentType type)
{
m_contentType = type;
}
std::optional<ContentType> OutputFrame::contentType() const
{
return m_contentType;
}
RenderBackend::RenderBackend(QObject *parent)
: QObject(parent)
{

View file

@ -49,9 +49,13 @@ public:
void addFeedback(std::unique_ptr<PresentationFeedback> &&feedback);
void setContentType(ContentType type);
std::optional<ContentType> contentType() const;
private:
RenderLoop *const m_loop;
std::vector<std::unique_ptr<PresentationFeedback>> m_feedbacks;
std::optional<ContentType> m_contentType;
};
/**

View file

@ -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)