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 size() const; | 78 | QSize size() const; | ||
Show All 16 Lines | 94 | QByteArray uuid() const { | |||
97 | return m_uuid; | 95 | return m_uuid; | ||
98 | } | 96 | } | ||
99 | 97 | | |||
100 | Q_SIGNALS: | 98 | Q_SIGNALS: | ||
101 | void dpmsChanged(); | 99 | void dpmsChanged(); | ||
102 | 100 | | |||
103 | private: | 101 | private: | ||
104 | friend class DrmBackend; | 102 | friend class DrmBackend; | ||
103 | friend class DrmCrtc; | ||||
105 | DrmOutput(DrmBackend *backend); | 104 | DrmOutput(DrmBackend *backend); | ||
106 | void cleanupBlackBuffer(); | | |||
107 | bool presentAtomically(DrmBuffer *buffer); | 105 | bool presentAtomically(DrmBuffer *buffer); | ||
108 | bool presentLegacy(DrmBuffer *buffer); | 106 | bool presentLegacy(DrmBuffer *buffer); | ||
109 | bool setModeLegacy(DrmBuffer *buffer); | 107 | bool setModeLegacy(DrmBuffer *buffer); | ||
110 | void initEdid(drmModeConnector *connector); | 108 | void initEdid(drmModeConnector *connector); | ||
111 | void initDpms(drmModeConnector *connector); | 109 | void initDpms(drmModeConnector *connector); | ||
112 | bool isCurrentMode(const drmModeModeInfo *mode) const; | 110 | bool isCurrentMode(const drmModeModeInfo *mode) const; | ||
113 | void initUuid(); | 111 | void initUuid(); | ||
114 | void setGlobalPos(const QPoint &pos); | 112 | void setGlobalPos(const QPoint &pos); | ||
115 | 113 | | |||
116 | void pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer); | 114 | void pageFlippedBufferRemover(DrmBuffer *oldbuffer, DrmBuffer *newbuffer); | ||
117 | bool initPrimaryPlane(); | 115 | bool initPrimaryPlane(); | ||
118 | bool initCursorPlane(); | 116 | bool initCursorPlane(); | ||
119 | DrmObject::AtomicReturn atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | 117 | DrmObject::AtomicReturn atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable); | ||
120 | 118 | | |||
121 | DrmBackend *m_backend; | 119 | DrmBackend *m_backend; | ||
120 | DrmConnector *m_conn = nullptr; | ||||
121 | DrmCrtc *m_crtc = nullptr; | ||||
122 | QPoint m_globalPos; | 122 | QPoint m_globalPos; | ||
123 | quint32 m_crtcId = 0; | | |||
124 | quint32 m_connector = 0; | | |||
125 | quint32 m_lastStride = 0; | 123 | quint32 m_lastStride = 0; | ||
126 | bool m_lastGbm = false; | 124 | bool m_lastGbm = false; | ||
127 | drmModeModeInfo m_mode; | 125 | drmModeModeInfo m_mode; | ||
128 | DrmBuffer *m_currentBuffer = nullptr; | | |||
129 | DrmBuffer *m_nextBuffer = nullptr; | | |||
130 | DrmBuffer *m_blackBuffer = nullptr; | | |||
131 | struct CrtcCleanup { | | |||
132 | static void inline cleanup(_drmModeCrtc *ptr) { | | |||
133 | drmModeFreeCrtc(ptr); // TODO: Atomically? See compositor-drm.c l.3670 | | |||
134 | } | | |||
135 | }; | | |||
136 | Edid m_edid; | 126 | Edid m_edid; | ||
137 | QScopedPointer<_drmModeCrtc, CrtcCleanup> m_savedCrtc; | | |||
138 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | 127 | QPointer<KWayland::Server::OutputInterface> m_waylandOutput; | ||
139 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | 128 | QPointer<KWayland::Server::OutputDeviceInterface> m_waylandOutputDevice; | ||
140 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | 129 | QPointer<KWayland::Server::OutputChangeSet> m_changeset; | ||
141 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | 130 | KWin::ScopedDrmPointer<_drmModeProperty, &drmModeFreeProperty> m_dpms; | ||
142 | DpmsMode m_dpmsMode = DpmsMode::On; | 131 | DpmsMode m_dpmsMode = DpmsMode::On; | ||
143 | QByteArray m_uuid; | 132 | QByteArray m_uuid; | ||
144 | 133 | | |||
145 | DrmConnector *m_conn = nullptr; | | |||
146 | DrmCrtc *m_crtc = nullptr; | | |||
147 | uint32_t m_blobId = 0; | 134 | uint32_t m_blobId = 0; | ||
148 | DrmPlane* m_primaryPlane = nullptr; | 135 | DrmPlane* m_primaryPlane = nullptr; | ||
149 | DrmPlane* m_cursorPlane = nullptr; | 136 | DrmPlane* m_cursorPlane = nullptr; | ||
150 | QVector<DrmPlane*> m_planesFlipList; | 137 | QVector<DrmPlane*> m_planesFlipList; | ||
151 | }; | 138 | }; | ||
152 | 139 | | |||
153 | } | 140 | } | ||
154 | 141 | | |||
155 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | 142 | Q_DECLARE_METATYPE(KWin::DrmOutput*) | ||
156 | 143 | | |||
157 | #endif | 144 | #endif | ||
158 | 145 | |