KWin
Loading...
Searching...
No Matches
drm_output.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9#pragma once
10
11#include "drm_abstract_output.h"
12#include "drm_object.h"
13#include "drm_plane.h"
14
15#include <QList>
16#include <QObject>
17#include <QPoint>
18#include <QPointer>
19#include <QSize>
20#include <QTimer>
21#include <chrono>
22#include <xf86drmMode.h>
23
24namespace KWin
25{
26
27class DrmConnector;
28class DrmGpu;
29class DrmPipeline;
30class DumbSwapchain;
31class DrmLease;
32class OutputChangeSet;
33
34class KWIN_EXPORT DrmOutput : public DrmAbstractOutput
35{
36 Q_OBJECT
37public:
38 DrmOutput(const std::shared_ptr<DrmConnector> &connector);
39 ~DrmOutput() override;
40
41 DrmConnector *connector() const;
42 DrmPipeline *pipeline() const;
43
44 bool present(const std::shared_ptr<OutputFrame> &frame) override;
45 DrmOutputLayer *primaryLayer() const override;
46 DrmOutputLayer *cursorLayer() const override;
47
48 bool queueChanges(const std::shared_ptr<OutputChangeSet> &properties);
49 void applyQueuedChanges(const std::shared_ptr<OutputChangeSet> &properties);
50 void revertQueuedChanges();
51 void updateModes();
52 void updateDpmsMode(DpmsMode dpmsMode);
53
54 bool updateCursorLayer() override;
55
56 DrmLease *lease() const;
57 bool addLeaseObjects(QList<uint32_t> &objectList);
58 void leased(DrmLease *lease);
59 void leaseEnded();
60
61 bool setChannelFactors(const QVector3D &rgb) override;
62 QVector3D channelFactors() const;
63 bool needsColormanagement() const;
64
65private:
66 bool setDrmDpmsMode(DpmsMode mode);
67 void setDpmsMode(DpmsMode mode) override;
68 bool doSetChannelFactors(const QVector3D &rgb);
69 ColorDescription createColorDescription(const std::shared_ptr<OutputChangeSet> &props) const;
70
71 QList<std::shared_ptr<OutputMode>> getModes() const;
72
73 DrmPipeline *m_pipeline;
74 const std::shared_ptr<DrmConnector> m_connector;
75
76 QTimer m_turnOffTimer;
77 DrmLease *m_lease = nullptr;
78
79 QVector3D m_channelFactors = {1, 1, 1};
80 bool m_channelFactorsNeedShaderFallback = false;
81};
82
83}
84
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)