summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-02-04 09:00:54 -0500
committerChris Michael <cpmichael@osg.samsung.com>2016-02-04 09:27:40 -0500
commit26eefa970fafb45b0b8920e7ca79f721670e9e75 (patch)
treed82fe0ba79ce54e78e6376d87887f1dedcf92f82
parentbb774a538e0f3a74cf9737f69a7ccba7b6909e61 (diff)
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 <cpmichael@osg.samsung.com>
-rw-r--r--src/lib/ecore_drm/Ecore_Drm.h4
-rw-r--r--src/lib/ecore_drm/ecore_drm_output.c28
2 files changed, 32 insertions, 0 deletions
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
1006/* @since 1.18 */ 1006/* @since 1.18 */
1007EAPI unsigned int ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type); 1007EAPI unsigned int ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type);
1008 1008
1009/* TODO: doxy */
1010/* @since 1.18 */
1011EAPI Eina_Bool ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation);
1012
1009/** 1013/**
1010 * Enable key remap functionality on a Ecore_Drm_Evdev 1014 * Enable key remap functionality on a Ecore_Drm_Evdev
1011 * 1015 *
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
1500 1500
1501 return rot; 1501 return rot;
1502} 1502}
1503
1504EAPI Eina_Bool
1505ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation)
1506{
1507 Ecore_Drm_Plane *plane;
1508 Eina_List *l;
1509
1510 EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
1511
1512 EINA_LIST_FOREACH(output->planes, l, plane)
1513 {
1514 if (plane->type != type) continue;
1515 if ((plane->supported_rotations & rotation) == 0)
1516 {
1517 WRN("Unsupported rotation");
1518 return EINA_FALSE;
1519 }
1520
1521 drmModeObjectSetProperty(output->dev->drm.fd,
1522 output->primary_plane_id,
1523 DRM_MODE_OBJECT_PLANE,
1524 output->rotation_prop_id,
1525 plane->rotation_map[ffs(rotation)]);
1526 break;
1527 }
1528
1529 return EINA_TRUE;
1530}