platform/drm-tests: passing log2 values of DRM_MODE_ROTATE_<degrees> instead of passing the enum value directly for the prop_contains_value function calls to check for existence of rotation property.

kernel sends the bit position for supported rotations.
Ex:- DRM_MODE_ROTATE_0 which is 1 << 0, the kernel returns 0
as the property value. So when the function prop_contains_value
compares prop->values[i] == value the check fails as we are
comparing the bit position with the property value.

So by sending log2 values of DRM_MODE_ROTATE_<degrees> to prop_contains_value function , the comparison of prop->values[i] and value will be done properly and the check passes if the supported rotation property exists in the kernel.

BUG=b:236353170
TEST="atomictest -t orientation" passes.

Change-Id: Ia5f4911d777c05e03937f87fee644e5cc4dcf168
Signed-off-by: Srihari Uttanur <srihari.uttanur@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/drm-tests/+/3715993
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Tested-by: Altaf Basha <altaf.basha@intel.com>
Commit-Queue: Victor Ding <victording@chromium.org>
diff --git a/atomictest.c b/atomictest.c
index dff37b7..d3d0820 100644
--- a/atomictest.c
+++ b/atomictest.c
@@ -49,14 +49,9 @@
 int sw_sync_timeline_inc(int fd, unsigned count);
 int sw_sync_fence_create(int fd, const char *name, unsigned value);
 
-// TODO(gsingh) This is defined in upstream libdrm -- remove when CROS libdrm is updated.
-#ifndef DRM_ROTATE_0
-#define DRM_ROTATE_0 (1UL << 0)
-#endif
+#define DRM_MODE_ROTATE_0_LOG2 0
 
-#ifndef DRM_REFLECT_Y
-#define DRM_REFLECT_Y (1UL << 5)
-#endif
+#define DRM_MODE_REFLECT_Y_LOG2 5
 
 #define TEST_COMMIT_FAIL 1
 
@@ -526,7 +521,7 @@
 	plane->in_fence_fd.value = -1;
 
 	if (plane->rotation.pid)
-		plane->rotation.value = DRM_ROTATE_0;
+		plane->rotation.value = DRM_MODE_ROTATE_0;
 	if (plane->ctm.pid)
 		plane->ctm.value = 0;
 
@@ -1064,14 +1059,14 @@
 		CHECK(rotation_prop);
 		CHECK_RESULT(init_plane_any_format(ctx, overlay, 0, 0, crtc->width, crtc->height,
 						   crtc->crtc_id, false));
-		CHECK(prop_contains_value(rotation_prop, DRM_ROTATE_0));
-		overlay->rotation.value = DRM_ROTATE_0;
+		CHECK(prop_contains_value(rotation_prop, DRM_MODE_ROTATE_0_LOG2));
+		overlay->rotation.value = DRM_MODE_ROTATE_0;
 		set_plane_props(overlay, ctx->pset);
 		CHECK_RESULT(draw_to_plane(ctx->mapper, overlay, DRAW_LINES));
 		ret |= test_and_commit(ctx, 1e6);
 
-		if (prop_contains_value(rotation_prop, DRM_REFLECT_Y)) {
-			overlay->rotation.value = DRM_REFLECT_Y;
+		if (prop_contains_value(rotation_prop, DRM_MODE_REFLECT_Y_LOG2)) {
+			overlay->rotation.value = DRM_MODE_REFLECT_Y;
 			set_plane_props(overlay, ctx->pset);
 			ret |= test_and_commit(ctx, 1e6);
 
@@ -1090,14 +1085,14 @@
 		CHECK(rotation_prop);
 		CHECK_RESULT(init_plane_any_format(ctx, primary, 0, 0, crtc->width, crtc->height,
 						   crtc->crtc_id, false));
-		CHECK(prop_contains_value(rotation_prop, DRM_ROTATE_0));
-		primary->rotation.value = DRM_ROTATE_0;
+		CHECK(prop_contains_value(rotation_prop, DRM_MODE_ROTATE_0_LOG2));
+		primary->rotation.value = DRM_MODE_ROTATE_0;
 		set_plane_props(primary, ctx->pset);
 		CHECK_RESULT(draw_to_plane(ctx->mapper, primary, DRAW_LINES));
 		ret |= test_and_commit(ctx, 1e6);
 
-		if (prop_contains_value(rotation_prop, DRM_REFLECT_Y)) {
-			primary->rotation.value = DRM_REFLECT_Y;
+		if (prop_contains_value(rotation_prop, DRM_MODE_REFLECT_Y_LOG2)) {
+			primary->rotation.value = DRM_MODE_REFLECT_Y;
 			set_plane_props(primary, ctx->pset);
 			ret |= test_and_commit(ctx, 1e6);
 		}