diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index e2281f9eea..47f5221d9d 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -331,6 +331,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 * diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 950d604a9d..58761412c4 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"); +}