From 5184ffec63390172d40ac525abb1d7b22c27457e Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 19 Feb 2015 14:47:26 -0500 Subject: [PATCH] ecore-drm Add API for querying output parameters Reviewers: zmike, devilhorns Reviewed By: devilhorns Subscribers: cedric Maniphest Tasks: T2131 Differential Revision: https://phab.enlightenment.org/D2005 --- src/lib/ecore_drm/Ecore_Drm.h | 83 ++++++++++++++++++++++++++++ src/lib/ecore_drm/ecore_drm_output.c | 53 ++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index fecd0de498..17def6ea81 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -209,4 +209,87 @@ EAPI void ecore_drm_fb_destroy(Ecore_Drm_Fb *fb); EAPI Eina_Bool ecore_drm_launcher_connect(Ecore_Drm_Device *dev); EAPI void ecore_drm_launcher_disconnect(Ecore_Drm_Device *dev); + +/** + * Get the output position of Ecore_Drm_Output + * + * This function will give the output position of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get position for + * @param *x The parameter in which output x co-ordinate is stored + * @param *y The parameter in which output y co-ordinate is stored + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI void ecore_drm_output_position_get(Ecore_Drm_Output *output, int *x, int *y); + +/** + * Get the current resolution of Ecore_Drm_Output + * + * This function will give the current resolution of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get resolution for + * @param *w The parameter in which output width is stored + * @param *h The parameter in which output height is stored + * @param *refresh The parameter in which output refresh rate is stored + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI void ecore_drm_output_current_resolution_get(Ecore_Drm_Output *output, int *w, int *h, unsigned int *refresh); + +/** + * Get the physical size of Ecore_Drm_Output + * + * This function will give the physical size (in mm) of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get physical size for + * @param *w The parameter in which output physical width is stored + * @param *h The parameter in which output physical height is stored + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI void ecore_drm_output_physical_size_get(Ecore_Drm_Output *output, int *w, int *h); + +/** + * Get the subpixel order of Ecore_Drm_Output + * + * This function will give the subpixel order of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get subpixel order for + * @return The output subpixel order + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI unsigned int ecore_drm_output_subpixel_order_get(Ecore_Drm_Output *output); + +/** + * Get the model of Ecore_Drm_Output + * + * This function will give the model of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get model for + * @return The model (do NOT eina_stringshare_del this return!) + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI Eina_Stringshare *ecore_drm_output_model_get(Ecore_Drm_Output *output); + +/** + * Get the make of Ecore_Drm_Output + * + * This function will give the make of Ecore_Drm_Output + * + * @param output The Ecore_Drm_Output to get model for + * @return The make (do NOT eina_stringshare_del this return!) + * + * @ingroup Ecore_Drm_Output_Group + * @since 1.14 + */ +EAPI Eina_Stringshare *ecore_drm_output_make_get(Ecore_Drm_Output *output); + #endif diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index aa694b71ec..827a4fcf75 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c @@ -902,3 +902,56 @@ ecore_drm_outputs_geometry_get(Ecore_Drm_Device *dev, int *x, int *y, int *w, in if (w) *w = ow; if (h) *h = oh; } + +EAPI void +ecore_drm_output_position_get(Ecore_Drm_Output *output, int *x, int *y) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + + if (x) *x = output->x; + if (y) *y = output->y; +} + +EAPI void +ecore_drm_output_current_resolution_get(Ecore_Drm_Output *output, int *w, int *h, unsigned int *refresh) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + + if (w) *w = output->current_mode->width; + if (h) *h = output->current_mode->height; + if (refresh) *refresh = output->current_mode->refresh; +} + +EAPI void +ecore_drm_output_physical_size_get(Ecore_Drm_Output *output, int *w, int *h) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + + //FIXME: This needs to be set when EDID parsing works + if (w) *w = 0; + if (h) *h = 0; +} + +EAPI unsigned int +ecore_drm_output_subpixel_order_get(Ecore_Drm_Output *output) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(output, 0); + + return output->subpixel; +} + +EAPI Eina_Stringshare * +ecore_drm_output_model_get(Ecore_Drm_Output *output) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); + + return output->model; +} + +EAPI Eina_Stringshare * +ecore_drm_output_make_get(Ecore_Drm_Output *output) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL); + + return output->make; +}