Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_object_connector.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "drm_object_connector.h" | 20 | #include "drm_object_connector.h" | ||
21 | #include "drm_pointer.h" | ||||
21 | #include "logging.h" | 22 | #include "logging.h" | ||
22 | 23 | | |||
23 | namespace KWin | 24 | namespace KWin | ||
24 | { | 25 | { | ||
25 | 26 | | |||
26 | DrmConnector::DrmConnector(uint32_t connector_id, int fd) | 27 | DrmConnector::DrmConnector(uint32_t connector_id, int fd) | ||
27 | : DrmObject(connector_id, fd) | 28 | : DrmObject(connector_id, fd) | ||
28 | { | 29 | { | ||
29 | 30 | ScopedDrmPointer<_drmModeConnector, &drmModeFreeConnector> con(drmModeGetConnector(fd, connector_id)); | |||
31 | if (!con) { | ||||
32 | return; | ||||
33 | } | ||||
34 | for (int i = 0; i < con->count_encoders; ++i) { | ||||
35 | m_encoders << con->encoders[i]; | ||||
36 | } | ||||
30 | } | 37 | } | ||
31 | 38 | | |||
32 | DrmConnector::~DrmConnector() = default; | 39 | DrmConnector::~DrmConnector() = default; | ||
33 | 40 | | |||
34 | bool DrmConnector::init() | 41 | bool DrmConnector::init() | ||
35 | { | 42 | { | ||
36 | qCDebug(KWIN_DRM) << "Creating connector" << m_id; | 43 | qCDebug(KWIN_DRM) << "Creating connector" << m_id; | ||
37 | 44 | | |||
Show All 18 Lines | 52 | { | |||
56 | int propCount = int(PropertyIndex::Count); | 63 | int propCount = int(PropertyIndex::Count); | ||
57 | for (int j = 0; j < propCount; ++j) { | 64 | for (int j = 0; j < propCount; ++j) { | ||
58 | initProp(j, properties); | 65 | initProp(j, properties); | ||
59 | } | 66 | } | ||
60 | drmModeFreeObjectProperties(properties); | 67 | drmModeFreeObjectProperties(properties); | ||
61 | return true; | 68 | return true; | ||
62 | } | 69 | } | ||
63 | 70 | | |||
71 | bool DrmConnector::isConnected() | ||||
72 | { | ||||
73 | ScopedDrmPointer<_drmModeConnector, &drmModeFreeConnector> con(drmModeGetConnector(m_fd, m_id)); | ||||
74 | if (!con) { | ||||
75 | return false; | ||||
76 | } | ||||
77 | return con->connection == DRM_MODE_CONNECTED; | ||||
78 | } | ||||
79 | | ||||
64 | } | 80 | } |