Permalink
Browse files

Fix NetBSD and Solaris atomic_dec_and_test.

Based on similar patch for xsrc from Taylor R Campbell.

Bump PKGREVISION.
  • Loading branch information...
1 parent a4fe903 commit 08d93f10af7d9a985ba25b0313c70e8d552a2206 wiz committed Jul 20, 2014
Showing with 25 additions and 19 deletions.
  1. +2 −1 x11/libdrm/Makefile
  2. +2 −2 x11/libdrm/distinfo
  3. +21 −16 x11/libdrm/patches/patch-ad
View
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.44 2014/05/04 16:50:32 wiz Exp $
+# $NetBSD: Makefile,v 1.45 2014/07/20 08:29:27 wiz Exp $
DISTNAME= libdrm-2.4.54
+PKGREVISION= 1
CATEGORIES= x11 graphics
MASTER_SITES= http://dri.freedesktop.org/libdrm/
EXTRACT_SUFX= .tar.bz2
View
@@ -1,11 +1,11 @@
-$NetBSD: distinfo,v 1.42 2014/05/04 16:50:32 wiz Exp $
+$NetBSD: distinfo,v 1.43 2014/07/20 08:29:27 wiz Exp $
SHA1 (libdrm-2.4.54.tar.bz2) = b73d69b42800755ed9dfd8aa9a906fe941cfbb7e
RMD160 (libdrm-2.4.54.tar.bz2) = 260f57de82e65ff5677d6a08cfed608951f85634
Size (libdrm-2.4.54.tar.bz2) = 644930 bytes
SHA1 (patch-ab) = 66dadd3244bfa9c69be0982fd2108deb94483de2
SHA1 (patch-ac) = 67c998df7dfc0dabc86320ea6d015cede3e464ea
-SHA1 (patch-ad) = ea3ef8de8db782ddab23f182f1e6bd9d8f612a78
+SHA1 (patch-ad) = b9c8d708830c8b182c8e491fe5a9e5d0f2d44a5f
SHA1 (patch-include_drm_drm.h) = d370e83da5c39f0e49094787c5f4580758c911b0
SHA1 (patch-libkms_linux.c) = 737d0a8e7b742ee9d24fec94c72de6b4915dd675
SHA1 (patch-libkms_vmwgfx.c) = 373390c7c33df27227607ee1b8110bc65ca37af6
@@ -1,11 +1,22 @@
-$NetBSD: patch-ad,v 1.1 2010/04/19 18:46:15 tnn Exp $
+$NetBSD: patch-ad,v 1.2 2014/07/20 08:29:27 wiz Exp $
---- xf86atomic.h.orig 2010-03-22 20:39:27.000000000 +0000
+Fix Solaris atomic_dec_and_test.
+Add NetBSD atomic ops support.
+
+--- xf86atomic.h.orig 2010-05-18 17:00:43.000000000 +0000
+++ xf86atomic.h
-@@ -92,6 +92,23 @@ typedef struct { uint_t atomic; } atomic
-
- #endif
-
+@@ -85,7 +85,24 @@ typedef struct { uint_t atomic; } atomic
+ # define atomic_read(x) (int) ((x)->atomic)
+ # define atomic_set(x, val) ((x)->atomic = (uint_t)(val))
+ # define atomic_inc(x) (atomic_inc_uint (&(x)->atomic))
+-# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 1)
++# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0)
++# define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v)))
++# define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v)))
++# define atomic_cmpxchg(x, oldv, newv) atomic_cas_uint (&(x)->atomic, oldv, newv)
++
++#endif
++
+#if defined(__NetBSD__) && !defined(HAS_ATOMIC_OPS) /* NetBSD */
+
+#include <sys/atomic.h>
@@ -16,13 +27,7 @@ $NetBSD: patch-ad,v 1.1 2010/04/19 18:46:15 tnn Exp $
+# define atomic_read(x) (int) ((x)->atomic)
+# define atomic_set(x, val) ((x)->atomic = (val))
+# define atomic_inc(x) (atomic_inc_uint (&(x)->atomic))
-+# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 1)
-+# define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v)))
-+# define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v)))
-+# define atomic_cmpxchg(x, oldv, newv) atomic_cas_uint (&(x)->atomic, oldv, newv)
-+
-+#endif
-+
- #if ! HAS_ATOMIC_OPS
- #error libdrm requires atomic operations, please define them for your CPU/compiler.
- #endif
++# define atomic_dec_and_test(x) (atomic_dec_uint_nv(&(x)->atomic) == 0)
+ # define atomic_add(x, v) (atomic_add_int(&(x)->atomic, (v)))
+ # define atomic_dec(x, v) (atomic_add_int(&(x)->atomic, -(v)))
+ # define atomic_cmpxchg(x, oldv, newv) atomic_cas_uint (&(x)->atomic, oldv, newv)

0 comments on commit 08d93f1

Please sign in to comment.