ecore-drm: Add API function to set output gamma
authorChris Michael <cp.michael@samsung.com>
Tue, 7 Apr 2015 16:24:07 +0000 (12:24 -0400)
committerStefan Schmidt <s.schmidt@samsung.com>
Fri, 10 Apr 2015 09:09:49 +0000 (11:09 +0200)
Summary: This commit adds new API for setting gamma of an Ecore_Drm_Output

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm/Ecore_Drm.h
src/lib/ecore_drm/ecore_drm_output.c

index e2281f9..47f5221 100644 (file)
@@ -332,6 +332,22 @@ EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output);
 EAPI void ecore_drm_output_dpms_set(Ecore_Drm_Output *output, int level);
 
 /**
+ * Set the gamma level of an Ecore_Drm_Output
+ *
+ * This function will set the gamma of an Ecore_Drm_Output
+ *
+ * @param output The Ecore_Drm_Output to set the gamma level on
+ * @param size The gamma table size to set
+ * @param r The amount to scale the red channel
+ * @param g The amount to scale the green channel
+ * @param b The amount to scale the blue channel
+ * 
+ * @ingroup Ecore_Drm_Output_Group
+ * @since 1.15
+ */
+EAPI void ecore_drm_output_gamma_set(Ecore_Drm_Output *output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b);
+
+/**
  * Get the pointer position of Ecore_Drm_Device
  *
  * This function will give the pointer position of Ecore_Drm_Device
index 950d604..5876141 100644 (file)
@@ -1089,3 +1089,15 @@ ecore_drm_output_dpms_set(Ecore_Drm_Output *output, int level)
    drmModeConnectorSetProperty(output->dev->drm.fd, output->conn_id,
                                output->dpms->prop_id, level);
 }
+
+EAPI void
+ecore_drm_output_gamma_set(Ecore_Drm_Output *output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b)
+{
+   EINA_SAFETY_ON_NULL_RETURN(output);
+   EINA_SAFETY_ON_NULL_RETURN(output->crtc);
+
+   if (output->gamma != size) return;
+
+   if (drmModeCrtcSetGamma(output->dev->drm.fd, output->crtc_id, size, r, g, b))
+     ERR("Failed to set output gamma: %m");
+}