summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Nieminen <suokkos@gmail.com>2009-08-29 09:26:58 +0300
committerPauli Nieminen <suokkos@gmail.com>2009-08-29 09:26:58 +0300
commitf19d0ae349f091e90877dfc16ce5a32d86a27981 (patch)
treee149d555c31814c79e3ed971efe3a5fcae70f924
parenta374123566ebfe498ec786f5ec8ac027ba3855e1 (diff)
libdrm_radeon: add atomic operation for cs allocation.section_rewrite
-rw-r--r--libdrm/radeon/radeon_cs.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/libdrm/radeon/radeon_cs.h b/libdrm/radeon/radeon_cs.h
index 45f7abad..1ee6e947 100644
--- a/libdrm/radeon/radeon_cs.h
+++ b/libdrm/radeon/radeon_cs.h
@@ -135,11 +135,8 @@ static inline int radeon_cs_write_reloc(struct radeon_cs *cs,
static inline uint32_t __radeon_cs_alloc_section(struct radeon_cs *cs,
uint32_t ndw)
{
- /* If we ever want to do parellel driver we need to change
- this to atomic fetch and add operation. For now simple
- read and add is enough. */
- uint32_t begin = cs->cdw;
- cs->cdw += ndw;
+ /* Atomic operation for threading */
+ uint32_t begin = __sync_fetch_and_add(&cs->cdw, ndw);
/* Handle cs overflow */
if (begin + ndw > cs->ndw) {
return (uint32_t)-ENOMEM;