Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.h
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
56 | public: | 56 | public: | ||
57 | struct Edid { | 57 | struct Edid { | ||
58 | QByteArray eisaId; | 58 | QByteArray eisaId; | ||
59 | QByteArray monitorName; | 59 | QByteArray monitorName; | ||
60 | QByteArray serialNumber; | 60 | QByteArray serialNumber; | ||
61 | QSize physicalSize; | 61 | QSize physicalSize; | ||
62 | }; | 62 | }; | ||
63 | virtual ~DrmOutput(); | 63 | virtual ~DrmOutput(); | ||
64 | void cleanup(); | 64 | void releaseGbm(); | ||
65 | void showCursor(DrmBuffer *buffer); | 65 | void showCursor(DrmBuffer *buffer); | ||
66 | void hideCursor(); | 66 | void hideCursor(); | ||
67 | void moveCursor(const QPoint &globalPos); | 67 | void moveCursor(const QPoint &globalPos); | ||
68 | bool init(drmModeConnector *connector); | 68 | bool init(drmModeConnector *connector); | ||
69 | bool present(DrmBuffer *buffer); | 69 | bool present(DrmBuffer *buffer); | ||
70 | void pageFlipped(); | 70 | void pageFlipped(); | ||
71 | void restoreSaved(); | | |||
72 | bool blank(); | | |||
73 | 71 | | |||
74 | /** | 72 | /** | ||
75 | * This sets the changes and tests them against the DRM output | 73 | * This sets the changes and tests them against the DRM output | ||
76 | */ | 74 | */ | ||
77 | void setChanges(KWayland::Server::OutputChangeSet *changeset); | 75 | void setChanges(KWayland::Server::OutputChangeSet *changeset); | ||
78 | bool commitChanges(); | 76 | bool commitChanges(); | ||
79 | 77 | | |||
80 | QSize pixelSize() const; | 78 | QSize pixelSize() const; | ||
Show All 22 Lines | 100 | QByteArray uuid() const { | |||
103 | return m_uuid; | 101 | return m_uuid; | ||
104 | } | 102 | } | ||
105 | 103 | | |||
106 | Q_SIGNALS: | 104 | Q_SIGNALS: | ||
107 | void dpmsChanged(); | 105 | void dpmsChanged(); | ||
108 | 106 | | |||
109 | private: | 107 | private: | ||
110 | friend class DrmBackend; | 108 | friend class DrmBackend; | ||
109 | friend class DrmCrtc; // TODO: For use of setModeLegacy. Remove later when we allow multiple connectors per crtc | ||||
110 | // and save the connector ids in the DrmCrtc instance. | ||||
111 | DrmOutput(DrmBackend *backend); | 111 | DrmOutput(DrmBackend *backend); | ||
112 | void cleanupBlackBuffer(); | | |||
113 | bool presentAtomically(DrmBuffer *buffer); | 112 | bool presentAtomically(DrmBuffer *buffer); | ||
114 | bool presentLegacy(DrmBuffer *buffer); | 113 | bool presentLegacy(DrmBuffer *buffer); | ||
115 | bool setModeLegacy(DrmBuffer *buffer); | 114 | bool setModeLegacy(DrmBuffer *buffer); | ||
116 | void initEdid(drmModeConnector *connector); | 115 | void initEdid(drmModeConnector *connector); | ||
117 | void initDpms(drmModeConnector *connector); | 116 | void initDpms(drmModeConnector *connector); | ||
118 | bool isCurrentMode(const drmModeModeInfo *mode) const; | 117 | bool isCurrentMode(const drmModeModeInfo *mode) const; | ||
119 | void initUuid(); | 118 | void initUuid(); | ||
120 | void setGlobalPos(const QPoint &pos); | 119 | void setGlobalPos(const QPoint &pos); | ||
121 | void setScale(qreal scale); | 120 | void setScale(qreal scale); | ||
122 | 121 | | |||
123 | void pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer); | 122 | void pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer); | ||
124 | bool initPrimaryPlane(); | 123 | bool initPrimaryPlane(); | ||
125 | bool initCursorPlane(); | 124 | bool initCursorPlane(); | ||
126 | DrmObject::AtomicReturn atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | 125 | DrmObject::AtomicReturn atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | ||
127 | 126 | | |||
128 | DrmBackend *m_backend; | 127 | DrmBackend *m_backend; | ||
128 | DrmConnector *m_conn = nullptr; | ||||
129 | DrmCrtc *m_crtc = nullptr; | ||||
129 | QPoint m_globalPos; | 130 | QPoint m_globalPos; | ||
130 | qreal m_scale = 1; | 131 | qreal m_scale = 1; | ||
131 | quint32 m_crtcId = 0; | | |||
132 | quint32 m_connector = 0; | | |||
133 | quint32 m_lastStride = 0; | 132 | quint32 m_lastStride = 0; | ||
134 | bool m_lastGbm = false; | 133 | bool m_lastGbm = false; | ||
135 | drmModeModeInfo m_mode; | 134 | drmModeModeInfo m_mode; | ||
136 | DrmBuffer *m_currentBuffer = nullptr; | | |||
137 | DrmBuffer *m_nextBuffer = nullptr; | | |||
138 | DrmBuffer *m_blackBuffer = nullptr; | | |||
139 | struct CrtcCleanup { | | |||
140 | static void inline cleanup(_drmModeCrtc *ptr) { | | |||
141 | drmModeFreeCrtc(ptr); // TODO: Atomically? See compositor-drm.c l.3670 | | |||
142 | } | | |||
143 | }; | | |||
144 | Edid m_edid; | 135 | Edid m_edid; | ||
145 | QScopedPointer<_drmModeCrtc, CrtcCleanup> m_savedCrtc; | | |||
146 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | 136 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | ||
147 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | 137 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | ||
148 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | 138 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | ||
149 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | 139 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | ||
150 | DpmsMode m_dpmsMode = DpmsMode::On; | 140 | DpmsMode m_dpmsMode = DpmsMode::On; | ||
151 | QByteArray m_uuid; | 141 | QByteArray m_uuid; | ||
152 | 142 | | |||
153 | DrmConnector *m_conn = nullptr; | | |||
154 | DrmCrtc *m_crtc = nullptr; | | |||
155 | uint32_t m_blobId = 0; | 143 | uint32_t m_blobId = 0; | ||
156 | DrmPlane* m_primaryPlane = nullptr; | 144 | DrmPlane* m_primaryPlane = nullptr; | ||
157 | DrmPlane* m_cursorPlane = nullptr; | 145 | DrmPlane* m_cursorPlane = nullptr; | ||
158 | QVector<DrmPlane*> m_planesFlipList; | 146 | QVector<DrmPlane*> m_planesFlipList; | ||
159 | }; | 147 | }; | ||
160 | 148 | | |||
161 | } | 149 | } | ||
162 | 150 | | |||
163 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | 151 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | ||
164 | 152 | | |||
165 | #endif | 153 | #endif | ||
166 | 154 | |