summaryrefslogtreecommitdiff
path: root/xf86atomic.h
AgeCommit message (Collapse)AuthorFilesLines
2022-08-23atomic: fix atomic_add_unless() fallback's return valueEric Engestrom1-1/+1
According to the kernel documentation: Returns non-zero if @v was not @u, and zero otherwise. Fixes: 63fc571863aa64683400 ("atomic: add atomic_add_unless()") Closes: https://gitlab.freedesktop.org/mesa/drm/issues/17 Signed-off-by: David Shao <davshao@gmail.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> [Eric: fix its callers to maintain current behaviour] Signed-off-by: Eric Engestrom <eric@engestrom.ch>
2019-12-06xf86atomic: require CAS support in libatomic_opsThomas Petazzoni1-0/+1
Since AO_compare_and_swap_full() is used by libdrm, AO_REQUIRE_CAS must be defined before including <atomic_ops.h> so that we are sure that CAS support will be provided. This is necessary to make sure that the AO_compare_and_swap_full() function will be provided on all architectures, including the ones that don't have built-in CAS support such as SPARCv8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Seiderer <ps.report@gmx.net> Acked-by: Eric Engestrom <eric.engestrom@intel.com>
2019-02-19freedreno: revert bad freedreno/atomic_ops commitsEric Engestrom1-2/+0
This reverts 6d2379857b6fccc1cade "xf86atomic: #undef internal define" and b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef". I didn't realise at the time that freedreno/freedreno_ringbuffer.h gets installed, and then used by Mesa for instance. These two commits were fine in libdrm, but broke Mesa which needs to use struct fd_ringbuffer but doesn't need to access ::refcnt. The hack that I removed serves to keep the struct at the correct size while only exposing the ::refcnt member within libdrm. Fixes: 6d2379857b6fccc1cade "xf86atomic: #undef internal define" Fixes: b541d21a0a908bf98d44 "freedreno: remove always-defined #ifdef" Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-01-03xf86atomic: #undef internal defineEric Engestrom1-0/+2
Thanks to the #error just above, any file including this header can only see one state for this macro: defined, with the value `1`. Let's just #undef it once we're done using it in here so that other files don't misconstrue any meaning to it. Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-20meson,configure: include config.h automaticallyEric Engestrom1-4/+0
This will prevent any more missing `#include "config.h"` bug, at the cost of having to recompile some files that didn't need to be when changing build options. Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-01-29xf86atomic: fix -Wundef warningEric Engestrom1-1/+1
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2015-09-21Fix SunOS/NetBSD atomic macroEmil Velikov1-1/+1
Reported-by: Evgeny Litvinenko <evgeny.v.litvinenko@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13Use __sync_add_and_fetch instead of __sync_fetch_and_add for atomic_dec_and_testMaarten Lankhorst1-1/+1
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com> Acked-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-03-13Add atomic_inc_return to atomics.Maarten Lankhorst1-0/+3
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com> Acked-By: Emil Velikov <emil.l.velikov@gmail.com>
2015-02-12Stop undefining _ATOMIC_TYPE in Solaris/NetBSD section of xf86atomic.hAlan Coopersmith1-5/+4
Since the atomic_set() macro references _ATOMIC_TYPE, undefining it broke that macro, resulting in build errors of: "intel_bufmgr_gem.c", line 775: undefined symbol: _ATOMIC_TYPE Now that we're leaving the macro in the namespace, renamed it to start with LIBDRM_ instead of _ to avoid polluting others namespace. Regression introduced in 87fdd32c8779648 Add NetBSD atomic ops support. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-By: Thomas Klausner <wiz@NetBSD.org>
2015-01-26Add NetBSD atomic ops support.Thomas Klausner1-3/+10
Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
2015-01-26Fix libdrm's atomic_dec_and_test on Solaris.Thomas Klausner1-1/+1
_nv means new value, not old value! Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
2014-09-15atomic: add atomic_add_unless()Lionel Landwerlin1-0/+9
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2010-04-16Correct the Solaris definitions of atomic_add & atomic_decAlan Coopersmith1-2/+2
The #defines added in 966c9907c040b4fe4b288b4a9d82598797aee743 were mapping these to functions that don't exist. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-03-17libdrm_radeon: Optimize cs_gem_reloc to do less looping.Pauli Nieminen1-0/+6
bo->referenced_in_cs is checked if bo is already in cs. Adding and removing reference in bo is done with atomic operations to allow parallel access to a bo from multiple contexts. cs->id generation code quarentees there is not duplicated ids which limits number of cs->ids to 32. If there is more cs objects rest will get id 0. V2: - Fix configure to check for atomics operations if libdrm_radeon is only selected. - Make atomic operations private to libdrm. This optimization decreases cs_write_reloc share of torcs profiling from 4.3% to 2.6%. Tested-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
2010-03-17libdrm: Move intel_atomic.h to libdrm core for sharing.Pauli Nieminen1-0/+93
intel_atomic.h includes very usefull atomic operations for lock free parrallel access of variables. Moving these to core libdrm for code sharing with radeon. Signed-off-by: Pauli Nieminen <suokkos@gmail.com>