diff options
Diffstat (limited to 'libdrm/radeon/radeon_cs.h')
-rw-r--r-- | libdrm/radeon/radeon_cs.h | 7 |
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; |