From 26eefa970fafb45b0b8920e7ca79f721670e9e75 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 4 Feb 2016 09:00:54 -0500 Subject: [PATCH] ecore-drm: Add API function to set rotation on an output This patch adds an API function to allow the Screen Setup dialog in Enlightenment to support setting rotations on an output when running under drm @feature Signed-off-by: Chris Michael --- src/lib/ecore_drm/Ecore_Drm.h | 4 ++++ src/lib/ecore_drm/ecore_drm_output.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h index 2942eeb765..0366899232 100644 --- a/src/lib/ecore_drm/Ecore_Drm.h +++ b/src/lib/ecore_drm/Ecore_Drm.h @@ -1006,6 +1006,10 @@ EAPI Eina_Bool ecore_drm_output_mode_set(Ecore_Drm_Output *output, Ecore_Drm_Out /* @since 1.18 */ EAPI unsigned int ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type); +/* TODO: doxy */ +/* @since 1.18 */ +EAPI Eina_Bool ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation); + /** * Enable key remap functionality on a Ecore_Drm_Evdev * diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 9dd4fd3e5c..aba2164b33 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c @@ -1500,3 +1500,31 @@ ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Pla return rot; } + +EAPI Eina_Bool +ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation) +{ + Ecore_Drm_Plane *plane; + Eina_List *l; + + EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE); + + EINA_LIST_FOREACH(output->planes, l, plane) + { + if (plane->type != type) continue; + if ((plane->supported_rotations & rotation) == 0) + { + WRN("Unsupported rotation"); + return EINA_FALSE; + } + + drmModeObjectSetProperty(output->dev->drm.fd, + output->primary_plane_id, + DRM_MODE_OBJECT_PLANE, + output->rotation_prop_id, + plane->rotation_map[ffs(rotation)]); + break; + } + + return EINA_TRUE; +}