summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/connector.h2
-rw-r--r--kms++/inc/kms++/crtc.h2
-rw-r--r--kms++/inc/kms++/encoder.h2
-rw-r--r--kms++/src/connector.cpp16
-rw-r--r--kms++/src/crtc.cpp8
-rw-r--r--kms++/src/encoder.cpp8
6 files changed, 37 insertions, 1 deletions
diff --git a/kms++/inc/kms++/connector.h b/kms++/inc/kms++/connector.h
index ccd7728..3407730 100644
--- a/kms++/inc/kms++/connector.h
+++ b/kms++/inc/kms++/connector.h
@@ -14,6 +14,8 @@ class Connector : public DrmPropObject
{
friend class Card;
public:
+ void refresh();
+
Videomode get_default_mode() const;
Videomode get_mode(const std::string& mode) const;
diff --git a/kms++/inc/kms++/crtc.h b/kms++/inc/kms++/crtc.h
index 14860ba..c86fc88 100644
--- a/kms++/inc/kms++/crtc.h
+++ b/kms++/inc/kms++/crtc.h
@@ -14,6 +14,8 @@ class Crtc : public DrmPropObject
friend class Card;
friend class Connector;
public:
+ void refresh();
+
const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; }
int set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode);
diff --git a/kms++/inc/kms++/encoder.h b/kms++/inc/kms++/encoder.h
index b5aac70..1d36adc 100644
--- a/kms++/inc/kms++/encoder.h
+++ b/kms++/inc/kms++/encoder.h
@@ -12,6 +12,8 @@ class Encoder : public DrmPropObject
{
friend class Card;
public:
+ void refresh();
+
Crtc* get_crtc() const;
std::vector<Crtc*> get_possible_crtcs() const;
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)