summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2020-12-03 11:31:24 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-12-03 11:31:24 +0200
commit764d6a0b7441796806a8fb8f10b79f009d5afb36 (patch)
tree56244ecfbe2acfbb21d1724591c23318e7173558 /kms++
parent79b60742131540b4c30db9aa4342c513dee389a7 (diff)
crtc: add legacy gamma set
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/crtc.h3
-rw-r--r--kms++/src/crtc.cpp18
2 files changed, 19 insertions, 2 deletions
diff --git a/kms++/inc/kms++/crtc.h b/kms++/inc/kms++/crtc.h
index 1ba8a07..cf64a86 100644
--- a/kms++/inc/kms++/crtc.h
+++ b/kms++/inc/kms++/crtc.h
@@ -39,7 +39,8 @@ public:
uint32_t height() const;
int mode_valid() const;
Videomode mode() const;
- int gamma_size() const;
+ int legacy_gamma_size() const;
+ void legacy_gamma_set(std::vector<std::tuple<uint16_t, uint16_t, uint16_t>> v);
private:
Crtc(Card& card, uint32_t id, uint32_t idx);
diff --git a/kms++/src/crtc.cpp b/kms++/src/crtc.cpp
index 6dc4333..1c1888f 100644
--- a/kms++/src/crtc.cpp
+++ b/kms++/src/crtc.cpp
@@ -173,9 +173,25 @@ Videomode Crtc::mode() const
return drm_mode_to_video_mode(m_priv->drm_crtc->mode);
}
-int Crtc::gamma_size() const
+int Crtc::legacy_gamma_size() const
{
return m_priv->drm_crtc->gamma_size;
}
+void Crtc::legacy_gamma_set(vector<tuple<uint16_t, uint16_t, uint16_t>> v)
+{
+ uint32_t len = v.size();
+ uint16_t red[len];
+ uint16_t green[len];
+ uint16_t blue[len];
+
+ for (uint32_t i = 0; i < len; ++i) {
+ red[i] = get<0>(v[i]);
+ green[i] = get<1>(v[i]);
+ blue[i] = get<2>(v[i]);
+ }
+
+ drmModeCrtcSetGamma(card().fd(), id(), len, red, green, blue);
+}
+
} // namespace kms