Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.h
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 57 | public: | |||
---|---|---|---|---|---|
90 | enum class DpmsMode { | 90 | enum class DpmsMode { | ||
91 | On = DRM_MODE_DPMS_ON, | 91 | On = DRM_MODE_DPMS_ON, | ||
92 | Standby = DRM_MODE_DPMS_STANDBY, | 92 | Standby = DRM_MODE_DPMS_STANDBY, | ||
93 | Suspend = DRM_MODE_DPMS_SUSPEND, | 93 | Suspend = DRM_MODE_DPMS_SUSPEND, | ||
94 | Off = DRM_MODE_DPMS_OFF | 94 | Off = DRM_MODE_DPMS_OFF | ||
95 | }; | 95 | }; | ||
96 | void setDpms(DpmsMode mode); | 96 | void setDpms(DpmsMode mode); | ||
97 | bool isDpmsEnabled() const { | 97 | bool isDpmsEnabled() const { | ||
98 | return m_dpmsMode == DpmsMode::On; | 98 | // We care for current as well as pending mode in order to allow first present in AMS. | ||
99 | return m_dpmsModePending == DpmsMode::On; | ||||
99 | } | 100 | } | ||
100 | 101 | | |||
101 | QByteArray uuid() const { | 102 | QByteArray uuid() const { | ||
102 | return m_uuid; | 103 | return m_uuid; | ||
103 | } | 104 | } | ||
104 | 105 | | |||
105 | Q_SIGNALS: | 106 | Q_SIGNALS: | ||
106 | void dpmsChanged(); | 107 | void dpmsChanged(); | ||
107 | 108 | | |||
108 | private: | 109 | private: | ||
109 | friend class DrmBackend; | 110 | friend class DrmBackend; | ||
110 | friend class DrmCrtc; // TODO: For use of setModeLegacy. Remove later when we allow multiple connectors per crtc | 111 | friend class DrmCrtc; // TODO: For use of setModeLegacy. Remove later when we allow multiple connectors per crtc | ||
111 | // and save the connector ids in the DrmCrtc instance. | 112 | // and save the connector ids in the DrmCrtc instance. | ||
112 | DrmOutput(DrmBackend *backend); | 113 | DrmOutput(DrmBackend *backend); | ||
113 | bool presentAtomically(DrmBuffer *buffer); | 114 | bool presentAtomically(DrmBuffer *buffer); | ||
115 | | ||||
116 | enum class AtomicCommitMode { | ||||
117 | Test, | ||||
118 | Real | ||||
119 | }; | ||||
120 | bool doAtomicCommit(AtomicCommitMode mode); | ||||
121 | | ||||
114 | bool presentLegacy(DrmBuffer *buffer); | 122 | bool presentLegacy(DrmBuffer *buffer); | ||
115 | bool setModeLegacy(DrmBuffer *buffer); | 123 | bool setModeLegacy(DrmBuffer *buffer); | ||
116 | void initEdid(drmModeConnector *connector); | 124 | void initEdid(drmModeConnector *connector); | ||
117 | void initDpms(drmModeConnector *connector); | 125 | void initDpms(drmModeConnector *connector); | ||
118 | bool isCurrentMode(const drmModeModeInfo *mode) const; | 126 | bool isCurrentMode(const drmModeModeInfo *mode) const; | ||
119 | void initUuid(); | 127 | void initUuid(); | ||
120 | void setGlobalPos(const QPoint &pos); | 128 | void setGlobalPos(const QPoint &pos); | ||
121 | void setScale(qreal scale); | 129 | void setScale(qreal scale); | ||
122 | 130 | | |||
123 | void pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer); | | |||
124 | bool initPrimaryPlane(); | 131 | bool initPrimaryPlane(); | ||
125 | bool initCursorPlane(); | 132 | bool initCursorPlane(); | ||
126 | DrmObject::AtomicReturn atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | 133 | | ||
134 | void dpmsOnHandler(); | ||||
135 | void dpmsOffHandler(); | ||||
136 | bool dpmsAtomicOff(); | ||||
137 | bool atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | ||||
127 | 138 | | |||
128 | DrmBackend *m_backend; | 139 | DrmBackend *m_backend; | ||
129 | DrmConnector *m_conn = nullptr; | 140 | DrmConnector *m_conn = nullptr; | ||
130 | DrmCrtc *m_crtc = nullptr; | 141 | DrmCrtc *m_crtc = nullptr; | ||
131 | QPoint m_globalPos; | 142 | QPoint m_globalPos; | ||
132 | qreal m_scale = 1; | 143 | qreal m_scale = 1; | ||
133 | bool m_lastGbm = false; | 144 | bool m_lastGbm = false; | ||
134 | drmModeModeInfo m_mode; | 145 | drmModeModeInfo m_mode; | ||
135 | Edid m_edid; | 146 | Edid m_edid; | ||
136 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | 147 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | ||
137 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | 148 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | ||
138 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | 149 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | ||
139 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | 150 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | ||
140 | DpmsMode m_dpmsMode = DpmsMode::On; | 151 | DpmsMode m_dpmsMode = DpmsMode::On; | ||
152 | DpmsMode m_dpmsModePending = DpmsMode::On; | ||||
141 | QByteArray m_uuid; | 153 | QByteArray m_uuid; | ||
142 | 154 | | |||
143 | uint32_t m_blobId = 0; | 155 | uint32_t m_blobId = 0; | ||
144 | DrmPlane* m_primaryPlane = nullptr; | 156 | DrmPlane* m_primaryPlane = nullptr; | ||
145 | DrmPlane* m_cursorPlane = nullptr; | 157 | DrmPlane* m_cursorPlane = nullptr; | ||
146 | QVector<DrmPlane*> m_planesFlipList; | 158 | QVector<DrmPlane*> m_nextPlanesFlipList; | ||
159 | bool m_pageFlipPending = false; | ||||
160 | bool m_dpmsAtomicOffPending = false; | ||||
161 | bool m_modesetRequested = true; | ||||
147 | }; | 162 | }; | ||
148 | 163 | | |||
149 | } | 164 | } | ||
150 | 165 | | |||
151 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | 166 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | ||
152 | 167 | | |||
153 | #endif | 168 | #endif | ||
154 | 169 | |