1 From 2e3dd0040e676530f7e735fab335ff449b9b3f4d Mon Sep 17 00:00:00 2001
2 From: Lauren Post <lauren.post@freescale.com>
3 Date: Tue, 22 Mar 2016 22:08:25 +0100
4 Subject: [PATCH] Add ARM support into xf86drm.h
6 This provides support for Xorg interface. Without this the vivante
7 samples will hang during close requiring a reboot
9 [Adapted from yocto project]
10 Upstream-Status: Pending
11 Signed-off-by: Lauren Post <lauren.post@freescale.com>
12 Signed-off-by: Evan Kotara <evan.kotara@freescale.com>
13 [Thomas: change CAS code to only be used on ARMv6/ARMv7, and not
14 ARMv4/ARMv5, which don't support ldrex/strex. If no CAS implementation
15 is provided libdrm falls back to a system call for locking/unlocking.]
16 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
18 xf86drm.h | 22 ++++++++++++++++++++++
19 1 file changed, 22 insertions(+)
21 diff --git a/xf86drm.h b/xf86drm.h
22 index 481d882..72341f6 100644
25 @@ -469,6 +469,28 @@ do { register unsigned int __old __asm("o0"); \
29 +# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
30 + || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
31 + || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) \
32 + || defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
33 + || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
34 + || defined(__ARM_ARCH_7EM__)
36 + #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
38 + #define DRM_CAS(lock,old,new,__ret) \
40 + __asm__ __volatile__ ( \
41 + "1: ldrex %0, [%1]\n" \
44 + " strexeq %0, %3, [%1]\n" \
47 + : "r" (lock), "r" (old), "r" (new) \
51 #endif /* architecture */
52 #endif /* __GNUC__ >= 2 */