From 7926fce5981570280ba6e99d98b563c7476e6e4e Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 1 Apr 2021 14:19:48 +0300 Subject: [PATCH] platforms/drm: Make DrmObject::m_id private There's already a getter for the object id. --- src/plugins/platforms/drm/drm_object.h | 3 +-- src/plugins/platforms/drm/drm_object_connector.cpp | 4 ++-- src/plugins/platforms/drm/drm_object_crtc.cpp | 4 ++-- src/plugins/platforms/drm/drm_object_plane.cpp | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/drm/drm_object.h b/src/plugins/platforms/drm/drm_object.h index 2bf648ec87..3924368494 100644 --- a/src/plugins/platforms/drm/drm_object.h +++ b/src/plugins/platforms/drm/drm_object.h @@ -98,8 +98,6 @@ protected: class Property; bool atomicAddProperty(drmModeAtomicReq *req, Property *property) const; - const uint32_t m_id; - // for comparison with received name of DRM object QVector m_props; @@ -165,6 +163,7 @@ protected: private: DrmGpu *m_gpu; QVector m_propsNames; + const uint32_t m_id; }; } diff --git a/src/plugins/platforms/drm/drm_object_connector.cpp b/src/plugins/platforms/drm/drm_object_connector.cpp index cfbd43f8b1..ff816a7eae 100644 --- a/src/plugins/platforms/drm/drm_object_connector.cpp +++ b/src/plugins/platforms/drm/drm_object_connector.cpp @@ -31,7 +31,7 @@ DrmConnector::~DrmConnector() = default; bool DrmConnector::init() { - qCDebug(KWIN_DRM) << "Creating connector" << m_id; + qCDebug(KWIN_DRM) << "Creating connector" << id(); if (!initProps({ PropertyDefinition(QByteArrayLiteral("CRTC_ID")), @@ -85,7 +85,7 @@ bool DrmConnector::init() bool DrmConnector::isConnected() { - DrmScopedPointer con(drmModeGetConnector(gpu()->fd(), m_id)); + DrmScopedPointer con(drmModeGetConnector(gpu()->fd(), id())); if (!con) { return false; } diff --git a/src/plugins/platforms/drm/drm_object_crtc.cpp b/src/plugins/platforms/drm/drm_object_crtc.cpp index b3d05bd3d2..dfb574a4ed 100644 --- a/src/plugins/platforms/drm/drm_object_crtc.cpp +++ b/src/plugins/platforms/drm/drm_object_crtc.cpp @@ -30,7 +30,7 @@ bool DrmCrtc::init() if (!m_crtc) { return false; } - qCDebug(KWIN_DRM) << "Init for CRTC:" << resIndex() << "id:" << m_id; + qCDebug(KWIN_DRM) << "Init for CRTC:" << resIndex() << "id:" << id(); return initProps({ PropertyDefinition(QByteArrayLiteral("MODE_ID")), PropertyDefinition(QByteArrayLiteral("ACTIVE")), @@ -76,7 +76,7 @@ bool DrmCrtc::setGammaRamp(const GammaRamp &gamma) uint16_t *green = const_cast(gamma.green()); uint16_t *blue = const_cast(gamma.blue()); - const bool isError = drmModeCrtcSetGamma(gpu()->fd(), m_id, + const bool isError = drmModeCrtcSetGamma(gpu()->fd(), id(), gamma.size(), red, green, blue); return !isError; diff --git a/src/plugins/platforms/drm/drm_object_plane.cpp b/src/plugins/platforms/drm/drm_object_plane.cpp index cab44dcd8f..9f9413d437 100644 --- a/src/plugins/platforms/drm/drm_object_plane.cpp +++ b/src/plugins/platforms/drm/drm_object_plane.cpp @@ -22,11 +22,11 @@ DrmPlane::DrmPlane(DrmGpu *gpu, uint32_t plane_id) bool DrmPlane::init() { - qCDebug(KWIN_DRM) << "Atomic init for plane:" << m_id; - DrmScopedPointer p(drmModeGetPlane(gpu()->fd(), m_id)); + qCDebug(KWIN_DRM) << "Atomic init for plane:" << id(); + DrmScopedPointer p(drmModeGetPlane(gpu()->fd(), id())); if (!p) { - qCWarning(KWIN_DRM) << "Failed to get kernel plane" << m_id; + qCWarning(KWIN_DRM) << "Failed to get kernel plane" << id(); return false; }