From a78dc2d8164692e984ad162f603f8b0d052934e9 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 6 Feb 2018 09:07:26 -0500 Subject: [PATCH] ecore-drm2: Add API functions to get/set output relative mode These API functions will be used inside Enlightenment in order to determine the proper extended screen size based on outputs relative position. @feature Signed-off-by: Chris Michael --- src/lib/ecore_drm2/Ecore_Drm2.h | 34 +++++++++++++++++++++++++ src/lib/ecore_drm2/ecore_drm2_outputs.c | 14 ++++++++++ src/lib/ecore_drm2/ecore_drm2_private.h | 5 ++++ 3 files changed, 53 insertions(+) diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h index bede4e5406..7904813c8c 100644 --- a/src/lib/ecore_drm2/Ecore_Drm2.h +++ b/src/lib/ecore_drm2/Ecore_Drm2.h @@ -39,6 +39,17 @@ typedef enum _Ecore_Drm2_Fb_Status ECORE_DRM2_FB_STATUS_PLANE_RELEASE = 32, } Ecore_Drm2_Fb_Status; +typedef enum _Ecore_Drm2_Relative_Mode +{ + ECORE_DRM2_RELATIVE_MODE_UNKNOWN, + ECORE_DRM2_RELATIVE_MODE_NONE, + ECORE_DRM2_RELATIVE_MODE_CLONE, + ECORE_DRM2_RELATIVE_MODE_TO_LEFT, + ECORE_DRM2_RELATIVE_MODE_TO_RIGHT, + ECORE_DRM2_RELATIVE_MODE_TO_ABOVE, + ECORE_DRM2_RELATIVE_MODE_TO_BELOW +} Ecore_Drm2_Relative_Mode; + /* opaque structure to represent a drm device */ typedef struct _Ecore_Drm2_Device Ecore_Drm2_Device; @@ -790,6 +801,29 @@ EAPI void ecore_drm2_output_user_data_set(Ecore_Drm2_Output *o, void *data); */ EAPI unsigned int ecore_drm2_output_subpixel_get(const Ecore_Drm2_Output *output); +/** + * Set the relative mode for an output + * + * @param output The output to set relative mode + * @param relative The relative mode to set + * + * @ingroup Ecore_Drm2_Output_Group + * @since 1.21 + */ +EAPI void ecore_drm2_output_relative_mode_set(Ecore_Drm2_Output *output, Ecore_Drm2_Relative_Mode mode); + +/** + * Get the relative mode of an output + * + * @param output The output to retrieve relative mode for + * + * @return The relative mode of a given output + * + * @ingroup Ecore_Drm2_Output_Group + * @since 1.21 + */ +EAPI Ecore_Drm2_Relative_Mode ecore_drm2_output_relative_mode_get(Ecore_Drm2_Output *output); + /** * @defgroup Ecore_Drm2_Fb_Group Drm framebuffer functions * diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index 472c3c5f6b..79a22c5363 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -1653,3 +1653,17 @@ ecore_drm2_output_pending_get(Ecore_Drm2_Output *output) return EINA_FALSE; } + +EAPI void +ecore_drm2_output_relative_mode_set(Ecore_Drm2_Output *output, Ecore_Drm2_Relative_Mode mode) +{ + EINA_SAFETY_ON_NULL_RETURN(output); + output->relative.mode = mode; +} + +EAPI Ecore_Drm2_Relative_Mode +ecore_drm2_output_relative_mode_get(Ecore_Drm2_Output *output) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(output, ECORE_DRM2_RELATIVE_MODE_UNKNOWN); + return output->relative.mode; +} diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h index 3c1040d57b..c2a59e4eee 100644 --- a/src/lib/ecore_drm2/ecore_drm2_private.h +++ b/src/lib/ecore_drm2/ecore_drm2_private.h @@ -232,6 +232,11 @@ struct _Ecore_Drm2_Output Ecore_Drm2_Backlight_Type type; } backlight; + struct + { + Ecore_Drm2_Relative_Mode mode; + } relative; + drmModeCrtcPtr ocrtc; /* prep is for state we're preparing and have never