This patch uses atomic ops available on armv6+ for DRM_CAS. For now the
patch only addresses armv7a, since factory does not support other
versions.

This was originally based on a yocto patch, libdrm-2.4.46-update-arm.patch
on timesys repository.

Index: libdrm-2.4.65/xf86drm.h
===================================================================
--- libdrm-2.4.65.orig/xf86drm.h	2016-02-23 18:41:31.965567553 -0500
+++ libdrm-2.4.65/xf86drm.h	2016-02-23 18:44:21.225556729 -0500
@@ -469,6 +469,22 @@
 		: "cr0", "memory");			\
 	} while (0)
 
+#elif defined(__arm__) && defined(__ARM_ARCH_7A__)
+       #undef DRM_DEV_MODE
+       #define DRM_DEV_MODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+
+       #define DRM_CAS(lock,old,new,__ret)             \
+       do {                                            \
+               __asm__ __volatile__ (                  \
+                       "1: ldrex %0, [%1]\n"           \
+                       "   teq %0, %2\n"               \
+                       "   strexeq %0, %3, [%1]\n"     \
+                       "   movne   %0, #1\n"           \
+               : "=&r" (__ret)                         \
+               : "r" (lock), "r" (old), "r" (new)      \
+               : "cc","memory");                       \
+       } while (0)
+
 #endif /* architecture */
 #endif /* __GNUC__ >= 2 */
 
