From 0885834b68f96a3e60decf9d3de7157c28e36ecc Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 7 Apr 2015 12:24:07 -0400 Subject: [PATCH] ecore-drm: Add API function to set output gamma Summary: This commit adds new API for setting gamma of an Ecore_Drm_Output @feature Signed-off-by: Chris Michael --- src/lib/ecore_drm/Ecore_Drm.h | 16 ++++++++++++++++ src/lib/ecore_drm/ecore_drm_output.c | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index e2281f9..47f5221 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -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 diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 950d604..5876141 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c @@ -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"); +} -- 2.7.4