devilhorns pushed a commit to branch feature/wayland/multi-output. http://git.enlightenment.org/core/efl.git/commit/?id=087c91b7baa0eff778f919aef3daada3a864e2bd
commit 087c91b7baa0eff778f919aef3daada3a864e2bd Author: Chris Michael <cp.mich...@samsung.com> Date: Thu Mar 29 09:12:47 2018 -0400 ecore-drm2: Add API function to clone an output Add an API function which we can call from within ecore_evas_drm in order to set one output as a clone of another output. @feature --- src/lib/ecore_drm2/Ecore_Drm2.h | 18 ++++++++++++++++++ src/lib/ecore_drm2/ecore_drm2_outputs.c | 27 +++++++++++++++++++++++++++ src/lib/ecore_drm2/ecore_drm2_private.h | 1 + 3 files changed, 46 insertions(+) diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h index fb1884be2d..f4b8027491 100644 --- a/src/lib/ecore_drm2/Ecore_Drm2.h +++ b/src/lib/ecore_drm2/Ecore_Drm2.h @@ -692,6 +692,24 @@ EAPI Eina_Bool ecore_drm2_output_connected_get(Ecore_Drm2_Output *output); EAPI Eina_Bool ecore_drm2_output_cloned_get(Ecore_Drm2_Output *output); /** + * Set if a given output is cloned + * + * @param output The output to set cloned mode on + * @param clone The output of which to clone + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @brief This function should be used to perform the actual cloning. + * Please note that both ecore_drm2_output_relative_to_set and + * ecore_drm2_output_relative_mode_set should be used before + * calling this function. + * + * @ingroup Ecore_Drm2_Output_Group + * @since 1.21 + */ +EAPI Eina_Bool ecore_drm2_output_clone_set(Ecore_Drm2_Device *dev, Ecore_Drm2_Output *output, Ecore_Drm2_Output *clone); + +/** * Get the connector type of a given output * * @param output diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index a5b9e3d38d..c990ae43ca 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -1380,6 +1380,33 @@ ecore_drm2_output_cloned_get(Ecore_Drm2_Output *output) output->relative.mode == ECORE_DRM2_RELATIVE_MODE_CLONE); } +EAPI Eina_Bool +ecore_drm2_output_clone_set(Ecore_Drm2_Device *dev, Ecore_Drm2_Output *output, Ecore_Drm2_Output *clone) +{ + Eina_Bool ret = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE); + EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); + + if (clone) + { + if (ecore_drm2_output_possible_crtc_get(output, clone->crtc_id)) + { + output->relative.saved_crtc = output->crtc_id; + output->crtc_id = clone->crtc_id; + ret = EINA_TRUE; + } + } + else + { + if (output->relative.saved_crtc) + output->crtc_id = output->relative.saved_crtc; + ret = EINA_TRUE; + } + + return ret; +} + EAPI unsigned int ecore_drm2_output_connector_type_get(Ecore_Drm2_Output *output) { diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h index 490f1665e4..dfa793b5e3 100644 --- a/src/lib/ecore_drm2/ecore_drm2_private.h +++ b/src/lib/ecore_drm2/ecore_drm2_private.h @@ -234,6 +234,7 @@ struct _Ecore_Drm2_Output struct { + uint32_t saved_crtc; const char *to; Ecore_Drm2_Relative_Mode mode; } relative; --