libdrm_radeon: Optimize cs_gem_reloc to do less looping.
authorPauli Nieminen <suokkos@gmail.com>
Sat, 29 Aug 2009 09:08:57 +0000 (12:08 +0300)
committerPauli Nieminen <suokkos@gmail.com>
Wed, 17 Mar 2010 10:42:21 +0000 (12:42 +0200)
commit966c9907c040b4fe4b288b4a9d82598797aee743
tree59a9f29ede30ab039a3a4151d2a9b1a9d30796cc
parent21105bc186d188f0bfc2f41c52b4b0ceb6742cf5
libdrm_radeon: Optimize cs_gem_reloc to do less looping.

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>
configure.ac
radeon/radeon_bo_gem.c
radeon/radeon_bo_gem.h
radeon/radeon_cs.c
radeon/radeon_cs.h
radeon/radeon_cs_gem.c
radeon/radeon_cs_int.h
xf86atomic.h