r600g: add cs memory usage accounting and limit it v3 (backport for mesa 9.0)
authorJerome Glisse <jglisse@redhat.com>
Wed, 30 Jan 2013 20:02:32 +0000 (15:02 -0500)
committerJerome Glisse <jglisse@redhat.com>
Thu, 31 Jan 2013 19:36:28 +0000 (14:36 -0500)
commit78222e63630280b96488de0d51d1b2578e26f814
treeba45a65efdd43df7425ed191f5da37ed5251253b
parent1e8de8437a8a11f95eb745b92ed3db749b8c763c
r600g: add cs memory usage accounting and limit it v3 (backport for mesa 9.0)

We are now seing cs that can go over the vram+gtt size to avoid
failing flush early cs that goes over 70% (gtt+vram) usage. 70%
is use to allow some fragmentation.

The idea is to compute a gross estimate of memory requirement of
each draw call. After each draw call, memory will be precisely
accounted. So the uncertainty is only on the current draw call.
In practice this gave very good estimate (+/- 10% of the target
memory limit).

v2: Remove left over from testing version, remove useless NULL
    checking. Improve commit message.
v3: Add comment to code on memory accounting precision

This version is a backport for mesa 9.0

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_hw_context.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c
src/gallium/winsys/radeon/drm/radeon_drm_cs.c
src/gallium/winsys/radeon/drm/radeon_winsys.h