ecore-drm: Make ecore_drm_output_rotation_set fail properly
authorDuna Oh <duna.oh@samsung.com>
Mon, 15 Feb 2016 13:44:55 +0000 (08:44 -0500)
committerChris Michael <cpmichael@osg.samsung.com>
Mon, 15 Feb 2016 13:46:08 +0000 (08:46 -0500)
When trying to set a rotation on a given output, we would previously
always be returning EINA_TRUE. We should be returning EINA_FALSE when
the rotation_set fails.

@fix

Summary: ecore_drm_output_rotation_set should be returning EINA_FALSE when the output doesn't have a plane of requested type.

Test Plan:
1. call ecore_drm_output_rotation_set() with ECORE_DRM_PLANE_TYPE_CURSOR
2. If output doesn't have a plane of ECORE_DRM_PLANE_TYPE_CURSOR, the for statement does nothing. But return value is TRUE;

Reviewers: raster, stefan_schmidt, gwanglim, devilhorns, zmike

Subscribers: input.hacker, cedric, JHyun, ManMower, jpeg

Differential Revision: https://phab.enlightenment.org/D3678

src/lib/ecore_drm/ecore_drm_output.c

index 1ac8f9a..9322ab9 100644 (file)
@@ -1510,6 +1510,7 @@ ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type typ
 {
    Ecore_Drm_Plane *plane;
    Eina_List *l;
+   Eina_Bool ret = EINA_FALSE;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
 
@@ -1522,13 +1523,18 @@ ecore_drm_output_rotation_set(Ecore_Drm_Output *output, Ecore_Drm_Plane_Type typ
              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)]);
+        if (drmModeObjectSetProperty(output->dev->drm.fd,
+                                     output->primary_plane_id,
+                                     DRM_MODE_OBJECT_PLANE,
+                                     output->rotation_prop_id,
+                                     plane->rotation_map[ffs(rotation)]) < 0)
+          {
+             WRN("Failed to set Rotation");
+             return EINA_FALSE;
+          }
+        ret = EINA_TRUE;
         break;
      }
 
-   return EINA_TRUE;
+   return ret;
 }