summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-12 08:46:33 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-12 08:46:33 +0100
commitecbcf327f02b1284163e68fc176ad45ff64e355d (patch)
tree08492bd17e3a2199fb743851e27bb24be35cdc09
parentMerge branch 'drm' (diff)
downloadblueshift-ecbcf327f02b1284163e68fc176ad45ff64e355d.tar.gz
blueshift-ecbcf327f02b1284163e68fc176ad45ff64e355d.tar.bz2
blueshift-ecbcf327f02b1284163e68fc176ad45ff64e355d.tar.xz
add blueshift_drm_set_gamma_ramps
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/blueshift_drm_c.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c
index 4e8c750..fd11be1 100644
--- a/src/blueshift_drm_c.c
+++ b/src/blueshift_drm_c.c
@@ -274,7 +274,7 @@ const char* blueshift_drm_get_connector_type_name()
/**
- * Get the current gamma ramps of the
+ * Get the current gamma ramps of the monitor connected to the connector
*
* @param crtc_index The index of the CRTC to read from
* @param gamma_size The size a gamma ramp
@@ -295,6 +295,24 @@ int blueshift_drm_get_gamma_ramps(int crtc_index, int gamma_size, uint16_t* red,
}
+/* Fails if inside a graphical environment */
+
+/**
+ * Set the gamma ramps of the of the monitor connected to the connector
+ *
+ * @param crtc_index The index of the CRTC to read from
+ * @param gamma_size The size a gamma ramp
+ * @param red The red gamma ramp
+ * @param green The green gamma ramp
+ * @param blue The blue gamma ramp
+ * @return Zero on success
+ */
+int blueshift_drm_set_gamma_ramps(int crtc_index, int gamma_size, uint16_t* red, uint16_t* green, uint16_t* blue)
+{
+ return drmModeCrtcSetGamma(drm_fd, *(drm_res->crtcs + crtc_index), gamma_size, red, green, blue);
+}
+
+
/**
* Get the extended display identification data for the monitor connected to the connector
*
@@ -430,8 +448,7 @@ int main(int argc, char** argv)
for (j = 0; j < gamma_size; j++)
*(blue + j) /= 2;
- drmModeCrtcSetGamma(drm_fd, *(drm_res->crtcs + crtc), gamma_size, red, green, blue);
- /* Fails if inside a graphical environment */
+ blueshift_drm_set_gamma_ramps(crtc, gamma_size, red, green, blue);
}
}
}