diff options
author | Chris Michael <cpmichael@osg.samsung.com> | 2016-01-20 10:48:38 -0500 |
---|---|---|
committer | Chris Michael <cpmichael@osg.samsung.com> | 2016-02-04 09:36:33 -0500 |
commit | b8ceaf0d403ce640ed6a485a59a3bd5a7b06a260 (patch) | |
tree | c53a3f5ee38db264d9c47e80280459629e461f46 /src/lib/ecore_drm/ecore_drm_output.c | |
parent | 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 (diff) |
ecore-drm: Add API functions for rotation support
This adds 2 new API functions for getting supported rotations of an
output, and for setting rotation on an output
@feature
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_drm/ecore_drm_output.c | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_output.c b/src/lib/ecore_drm/ecore_drm_output.c index 1ac8f9a220..3c27387fa4 100644 --- a/src/lib/ecore_drm/ecore_drm_output.c +++ b/src/lib/ecore_drm/ecore_drm_output.c | |||
@@ -648,7 +648,11 @@ _ecore_drm_output_create(Ecore_Drm_Device *dev, drmModeRes *res, drmModeConnecto | |||
648 | (conn->count_modes == 0) ? ", built-in" : ""); | 648 | (conn->count_modes == 0) ? ", built-in" : ""); |
649 | } | 649 | } |
650 | 650 | ||
651 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
651 | _ecore_drm_output_planes_get(output); | 652 | _ecore_drm_output_planes_get(output); |
653 | ======= | ||
654 | _ecore_drm_output_planes_find(output); | ||
655 | >>>>>>> ecore-drm: Add API functions for rotation support | ||
652 | 656 | ||
653 | return output; | 657 | return output; |
654 | 658 | ||
@@ -885,6 +889,100 @@ _ecore_drm_output_render_disable(Ecore_Drm_Output *output) | |||
885 | ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF); | 889 | ecore_drm_output_dpms_set(output, DRM_MODE_DPMS_OFF); |
886 | } | 890 | } |
887 | 891 | ||
892 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
893 | ======= | ||
894 | #if 0 | ||
895 | static void | ||
896 | _ecore_drm_output_planes_get(Ecore_Drm_Device *dev) | ||
897 | { | ||
898 | drmModePlaneRes *pres; | ||
899 | unsigned int i = 0, j = 0; | ||
900 | int k = 0; | ||
901 | |||
902 | pres = drmModeGetPlaneResources(dev->drm.fd); | ||
903 | if (!pres) return; | ||
904 | |||
905 | for (; i < pres->count_planes; i++) | ||
906 | { | ||
907 | drmModePlane *plane; | ||
908 | drmModeObjectPropertiesPtr props; | ||
909 | int type = -1; | ||
910 | |||
911 | plane = drmModeGetPlane(dev->drm.fd, pres->planes[i]); | ||
912 | if (!plane) continue; | ||
913 | |||
914 | props = drmModeObjectGetProperties(dev->drm.fd, plane->plane_id, | ||
915 | DRM_MODE_OBJECT_PLANE); | ||
916 | if (!props) goto free_plane; | ||
917 | |||
918 | DBG("Plane %u Properties:", plane->plane_id); | ||
919 | |||
920 | for (j = 0; type == -1 && j < props->count_props; j++) | ||
921 | { | ||
922 | drmModePropertyPtr prop; | ||
923 | |||
924 | prop = drmModeGetProperty(dev->drm.fd, props->props[j]); | ||
925 | if (!prop) continue; | ||
926 | |||
927 | if (!strcmp(prop->name, "type")) | ||
928 | type = props->prop_values[j]; | ||
929 | |||
930 | drmModeFreeProperty(prop); | ||
931 | } | ||
932 | |||
933 | DBG("\tFormats:"); | ||
934 | for (j = 0; j < plane->count_formats; j++) | ||
935 | DBG("\t\t%4.4s", (char *)&plane->formats[j]); | ||
936 | |||
937 | for (j = 0; j < props->count_props; j++ ) | ||
938 | { | ||
939 | drmModePropertyPtr prop; | ||
940 | |||
941 | prop = drmModeGetProperty(dev->drm.fd, props->props[j]); | ||
942 | if (!prop) continue; | ||
943 | |||
944 | DBG("\tProperty Name: %s", prop->name); | ||
945 | |||
946 | if (prop->flags & DRM_MODE_PROP_RANGE) | ||
947 | { | ||
948 | DBG("\t\tRange Property"); | ||
949 | for (k = 0; k < prop->count_values; k++) | ||
950 | DBG("\t\t\t%"PRIu64, prop->values[k]); | ||
951 | } | ||
952 | if (prop->flags & DRM_MODE_PROP_ENUM) | ||
953 | { | ||
954 | DBG("\t\tEnum Property"); | ||
955 | for (k = 0; k < prop->count_enums; k++) | ||
956 | DBG("\t\t\t%s=%llu", prop->enums[k].name, | ||
957 | prop->enums[k].value); | ||
958 | } | ||
959 | if (prop->flags & DRM_MODE_PROP_BITMASK) | ||
960 | { | ||
961 | DBG("\t\tBitmask Property"); | ||
962 | for (k = 0; k < prop->count_enums; k++) | ||
963 | DBG("\t\t\t%s=0x%llx", prop->enums[k].name, | ||
964 | (1LL << prop->enums[k].value)); | ||
965 | } | ||
966 | |||
967 | DBG("\t\tValue: %"PRIu64, props->prop_values[j]); | ||
968 | |||
969 | drmModeFreeProperty(prop); | ||
970 | } | ||
971 | |||
972 | DBG("\tCurrent Crtc: %d", plane->crtc_id); | ||
973 | DBG("\tPossible Crtcs: 0x%08x", plane->possible_crtcs); | ||
974 | |||
975 | drmModeFreeObjectProperties(props); | ||
976 | |||
977 | free_plane: | ||
978 | drmModeFreePlane(plane); | ||
979 | } | ||
980 | |||
981 | drmModeFreePlaneResources(pres); | ||
982 | } | ||
983 | #endif | ||
984 | |||
985 | >>>>>>> ecore-drm: Add API functions for rotation support | ||
888 | /* public functions */ | 986 | /* public functions */ |
889 | 987 | ||
890 | /** | 988 | /** |
@@ -957,6 +1055,12 @@ next: | |||
957 | drmModeFreeConnector(conn); | 1055 | drmModeFreeConnector(conn); |
958 | } | 1056 | } |
959 | 1057 | ||
1058 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
1059 | ======= | ||
1060 | /* TODO: Planes */ | ||
1061 | /* _ecore_drm_output_planes_get(dev); */ | ||
1062 | |||
1063 | >>>>>>> ecore-drm: Add API functions for rotation support | ||
960 | ret = EINA_TRUE; | 1064 | ret = EINA_TRUE; |
961 | if (eina_list_count(dev->outputs) < 1) | 1065 | if (eina_list_count(dev->outputs) < 1) |
962 | ret = EINA_FALSE; | 1066 | ret = EINA_FALSE; |
@@ -1486,6 +1590,7 @@ ecore_drm_output_mode_set(Ecore_Drm_Output *output, Ecore_Drm_Output_Mode *mode, | |||
1486 | return ret; | 1590 | return ret; |
1487 | } | 1591 | } |
1488 | 1592 | ||
1593 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
1489 | EAPI unsigned int | 1594 | EAPI unsigned int |
1490 | ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type) | 1595 | ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type) |
1491 | { | 1596 | { |
@@ -1505,6 +1610,8 @@ ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Pla | |||
1505 | return rot; | 1610 | return rot; |
1506 | } | 1611 | } |
1507 | 1612 | ||
1613 | ======= | ||
1614 | >>>>>>> ecore-drm: Add API functions for rotation support | ||
1508 | EAPI Eina_Bool | 1615 | EAPI Eina_Bool |
1509 | ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation) | 1616 | ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type, unsigned int rotation) |
1510 | { | 1617 | { |
@@ -1527,8 +1634,33 @@ ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type typ | |||
1527 | DRM_MODE_OBJECT_PLANE, | 1634 | DRM_MODE_OBJECT_PLANE, |
1528 | output->rotation_prop_id, | 1635 | output->rotation_prop_id, |
1529 | plane->rotation_map[ffs(rotation)]); | 1636 | plane->rotation_map[ffs(rotation)]); |
1637 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
1530 | break; | 1638 | break; |
1639 | ======= | ||
1640 | >>>>>>> ecore-drm: Add API functions for rotation support | ||
1531 | } | 1641 | } |
1532 | 1642 | ||
1533 | return EINA_TRUE; | 1643 | return EINA_TRUE; |
1534 | } | 1644 | } |
1645 | <<<<<<< 94082f54e8ce7d47402ea5d8d57e3871f8fa98a4 | ||
1646 | ======= | ||
1647 | |||
1648 | EAPI unsigned int | ||
1649 | ecore_drm_output_supported_rotations_get(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type type) | ||
1650 | { | ||
1651 | Ecore_Drm_Plane *plane; | ||
1652 | Eina_List *l; | ||
1653 | unsigned int rot = -1; | ||
1654 | |||
1655 | EINA_SAFETY_ON_NULL_RETURN_VAL(output, rot); | ||
1656 | |||
1657 | EINA_LIST_FOREACH(output->planes, l, plane) | ||
1658 | { | ||
1659 | if (plane->type != type) continue; | ||
1660 | rot = plane->supported_rotations; | ||
1661 | break; | ||
1662 | } | ||
1663 | |||
1664 | return rot; | ||
1665 | } | ||
1666 | >>>>>>> ecore-drm: Add API functions for rotation support | ||