aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2018-02-10 10:24:49 +0100
committerVincent Vanlaer <vincent.vanlaer@skynet.be>2018-02-10 10:24:49 +0100
commit7cb828ac70c0c41005a761d9011f8b0ca8904688 (patch)
tree966ccbcb93a190f3097b21cbde8fb376e9ae6bdc /backend/drm
parentdd69d7b7640fd4f957cee27eb274152cf8311f0c (diff)
Fallback gamma on legacy if properties don't exist
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/atomic.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c
index 166d60a0..526b2731 100644
--- a/backend/drm/atomic.c
+++ b/backend/drm/atomic.c
@@ -201,6 +201,12 @@ static bool atomic_crtc_set_gamma(struct wlr_drm_backend *drm,
uint32_t size) {
struct drm_color_lut gamma[size];
+ // Fallback to legacy gamma interface when gamma properties are not available
+ // (can happen on older intel gpu's that support gamma but not degamma)
+ if (crtc->props.gamma_lut == 0) {
+ return legacy_iface.crtc_set_gamma(drm, crtc, r, g, b, size);
+ }
+
for (uint32_t i = 0; i < size; i++) {
gamma[i].red = r[i];
gamma[i].green = g[i];
@@ -227,6 +233,10 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm,
struct wlr_drm_crtc *crtc) {
uint64_t gamma_lut_size;
+ if (crtc->props.gamma_lut_size == 0) {
+ return legacy_iface.crtc_get_gamma_size(drm, crtc);
+ }
+
if (!wlr_drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size,
&gamma_lut_size)) {
wlr_log(L_ERROR, "Unable to get gamma lut size");