libdrm atomic_add_unless() may reverse meaning of return value

David Shao davshao at
Mon Mar 6 00:49:57 PST 2017

For those who have frustrating glitches with applications
such as glxgears on Intel integrated graphics, the
following libdrm bug report may be of interest.
"libdrm atomic_add_unless() may reverse return value meaning"

A one character patch allows glxgears to run on
DragonFly using a hacked version of pkgsrc on an
Intel IvyBridge integrated graphics machine.

--- xf86atomic.h.orig    2015-09-22 04:34:51.000000000 +0000
+++ xf86atomic.h
@@ -111,7 +111,7 @@ static inline int atomic_add_unless(atom
     c = atomic_read(v);
     while (c != unless && (old = atomic_cmpxchg(v, c, c + add)) != c)
         c = old;
-    return c == unless;
+    return c != unless;


More information about the Users mailing list