diff options
Diffstat (limited to 'kms++/src')
-rw-r--r-- | kms++/src/connector.cpp | 16 | ||||
-rw-r--r-- | kms++/src/crtc.cpp | 8 | ||||
-rw-r--r-- | kms++/src/encoder.cpp | 8 |
3 files changed, 31 insertions, 1 deletions
diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp index 7c6c179..48c5815 100644 --- a/kms++/src/connector.cpp +++ b/kms++/src/connector.cpp @@ -73,13 +73,27 @@ Connector::Connector(Card &card, uint32_t id, uint32_t idx) m_fullname = name + "-" + to_string(m_priv->drm_connector->connector_type_id); } - Connector::~Connector() { drmModeFreeConnector(m_priv->drm_connector); delete m_priv; } +void Connector::refresh() +{ + drmModeFreeConnector(m_priv->drm_connector); + + m_priv->drm_connector = drmModeGetConnector(this->card().fd(), this->id()); + assert(m_priv->drm_connector); + + // XXX drmModeGetConnector() does forced probe, which seems to change (at least) EDID blob id. + // XXX So refresh the props again here. + refresh_props(); + + const auto& name = connector_names.at(m_priv->drm_connector->connector_type); + m_fullname = name + "-" + to_string(m_priv->drm_connector->connector_type_id); +} + void Connector::setup() { if (m_priv->drm_connector->encoder_id != 0) diff --git a/kms++/src/crtc.cpp b/kms++/src/crtc.cpp index 4c2f5ce..2d41bfa 100644 --- a/kms++/src/crtc.cpp +++ b/kms++/src/crtc.cpp @@ -31,6 +31,14 @@ Crtc::~Crtc() delete m_priv; } +void Crtc::refresh() +{ + drmModeFreeCrtc(m_priv->drm_crtc); + + m_priv->drm_crtc = drmModeGetCrtc(this->card().fd(), this->id()); + assert(m_priv->drm_crtc); +} + void Crtc::setup() { for (Plane* plane : card().get_planes()) { diff --git a/kms++/src/encoder.cpp b/kms++/src/encoder.cpp index 2168f2f..9cd5304 100644 --- a/kms++/src/encoder.cpp +++ b/kms++/src/encoder.cpp @@ -45,6 +45,14 @@ Encoder::~Encoder() delete m_priv; } +void Encoder::refresh() +{ + drmModeFreeEncoder(m_priv->drm_encoder); + + m_priv->drm_encoder = drmModeGetEncoder(this->card().fd(), this->id()); + assert(m_priv->drm_encoder); +} + Crtc* Encoder::get_crtc() const { if (m_priv->drm_encoder->crtc_id) |