forked from enlightenment/efl
ecore-drm2: Add API function to allow setting gamma of a given output
Small patch to add an API function which will allow setting the gamma level of a given output. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
4b4201584f
commit
6b350fc696
|
@ -704,6 +704,22 @@ EAPI void ecore_drm2_output_resolution_get(Ecore_Drm2_Output *output, int *w, in
|
|||
*/
|
||||
EAPI Eina_Bool ecore_drm2_output_possible_crtc_get(Ecore_Drm2_Output *output, unsigned int crtc);
|
||||
|
||||
/**
|
||||
* Set the gamma level of an Ecore_Drm_Output
|
||||
*
|
||||
* This function will set the gamma of an Ecore_Drm2_Output
|
||||
*
|
||||
* @param output The Ecore_Drm2_Output to set the gamma level on
|
||||
* @param size The gamma table size to set
|
||||
* @param red The amount to scale the red channel
|
||||
* @param green The amount to scale the green channel
|
||||
* @param blue The amount to scale the blue channel
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Output_Group
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void ecore_drm2_output_gamma_set(Ecore_Drm2_Output *output, uint16_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Drm2_Fb_Group Drm framebuffer functions
|
||||
*
|
||||
|
|
|
@ -754,7 +754,7 @@ _output_create(Ecore_Drm2_Device *dev, const drmModeRes *res, const drmModeConne
|
|||
|
||||
_output_backlight_init(output, conn->connector_type);
|
||||
|
||||
/* TODO: gamma */
|
||||
output->gamma = output->ocrtc->gamma_size;
|
||||
|
||||
_output_modes_create(dev, output, conn);
|
||||
|
||||
|
@ -1501,3 +1501,16 @@ ecore_drm2_output_release_handler_set(Ecore_Drm2_Output *o, Ecore_Drm2_Release_H
|
|||
o->release_data = data;
|
||||
o->release_cb = cb;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_drm2_output_gamma_set(Ecore_Drm2_Output *output, uint16_t size, uint16_t *red, uint16_t *green, uint16_t *blue)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(output);
|
||||
EINA_SAFETY_ON_TRUE_RETURN(output->fd < 0);
|
||||
|
||||
if (output->gamma != size) return;
|
||||
|
||||
if (sym_drmModeCrtcSetGamma(output->fd, output->crtc_id, size,
|
||||
red, green, blue) < 0)
|
||||
ERR("Failed to set gamma for Output %s: %m", output->name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue