diff options
author | Chris Michael <cp.michael@samsung.com> | 2016-11-29 09:15:07 -0500 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2016-11-29 09:15:07 -0500 |
commit | 6b350fc696de250389fdabe5e901a96ac35b110d (patch) | |
tree | 023bfff16685cead3356ba181ccf81893bfac255 | |
parent | 4b4201584f663c2b9b04017689967cd4186be20e (diff) | |
download | efl-6b350fc696de250389fdabe5e901a96ac35b110d.tar.gz |
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>
-rw-r--r-- | src/lib/ecore_drm2/Ecore_Drm2.h | 16 | ||||
-rw-r--r-- | src/lib/ecore_drm2/ecore_drm2_outputs.c | 15 |
2 files changed, 30 insertions, 1 deletions
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h index 708e31aca4..863a9c6df9 100644 --- a/src/lib/ecore_drm2/Ecore_Drm2.h +++ b/src/lib/ecore_drm2/Ecore_Drm2.h @@ -705,6 +705,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 * * Functions that deal with setup of framebuffers diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index bd0703dd45..c9f7dde024 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -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); +} |