Signed-off-by: Aleksey Kuleshov rndfax@yandex.ru --- xf86drm.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/xf86drm.h b/xf86drm.h index 40c55c9..2ba75d9 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -462,6 +462,27 @@ do { register unsigned int __old __asm("o0"); \ : "cr0", "memory"); \ } while (0)
+#elif defined(__mips__) + +#define DRM_CAS(lock, old, new, ret) \ + do { \ + int tmp; \ + asm volatile( \ + ".set push;" \ + ".set noreorder;" \ + ".set mips32;" \ + "ll %[_tmp], %[_lock];" \ + "bne %[_tmp], %[_old], 1f;" \ + "li %[_ret], 1;" \ + "sc %[_new], %[_lock];" \ + "xori %[_ret], %[_new], 1;" \ + "1:" \ + ".set pop;" \ + : [_lock] "=m" (__drm_dummy_lock(lock)), \ + [_tmp] "=&r" (tmp), [_ret] "=&r" (ret) \ + : [_old] "r" (old), [_new] "r" (new)); \ + } while (0) + #endif /* architecture */ #endif /* __GNUC__ >= 2 */
@@ -471,7 +492,7 @@ do { register unsigned int __old __asm("o0"); \
#if defined(__alpha__) #define DRM_CAS_RESULT(_result) long _result -#elif defined(__powerpc__) +#elif defined(__powerpc__) || defined(__mips__) #define DRM_CAS_RESULT(_result) int _result #else #define DRM_CAS_RESULT(_result) char _result
On Thu, May 14, 2015 at 5:12 AM, Aleksey Kuleshov rndfax@yandex.ru wrote:
Signed-off-by: Aleksey Kuleshov rndfax@yandex.ru
At least a few years ago, DRM_CAS was only used by DRI1 which is pretty dead at this point. Has something changed?
What problem are you trying to solve?
I don't really know much about the current status of using DRM_CAS macro, but the reality is that there is a company Vivante which provides OpenGL driver for their 3D core which uses DRM_CAS for locking. There is a chip with mips processor and Vivante core (I'm part of that chip) => no support for mips in xf86drm.h => add mips for DRM_CAS => share with community.
If it's deprecated (or dead) then of course this patch is odd and adding obsolete functionality is odd too. So you can just ignore this patch for sure.
14.05.2015, 22:04, "Matt Turner" mattst88@gmail.com:
On Thu, May 14, 2015 at 5:12 AM, Aleksey Kuleshov rndfax@yandex.ru wrote:
Signed-off-by: Aleksey Kuleshov rndfax@yandex.ru ---
At least a few years ago, DRM_CAS was only used by DRI1 which is pretty dead at this point. Has something changed?
What problem are you trying to solve?
dri-devel@lists.freedesktop.org