swr: [rasterizer core] RingBuffer class for DC/DS
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 19 Feb 2016 23:55:23 +0000 (17:55 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Fri, 25 Mar 2016 19:26:17 +0000 (14:26 -0500)
commit45f0ce168ce21a7a95f48d3164e42a947732b896
tree91b6f713406ae956674a91c42aab0ffaa104abbc
parentdd0f9eed8cda45ed1373abebad7dd2398a16e9a7
swr: [rasterizer core] RingBuffer class for DC/DS

Use head/tail ring buffer indices for thread synchronization.

1. SwrWaitForIdle loops until ring is empty. (head == tail)
2. GetDrawContext waits until ring is not full. (head - tail) == Ring Size
3. Draw enqueues by incrementing head.
4. Last worker thread to move past a DC dequeues by incrementing tail.

Todo: To reduce contention we can cache the tail in the API thread. For
example, if you know you have 64 free entries in the ring then you don't
need to keep checking the tail until you used those 64 entries.
src/gallium/drivers/swr/Makefile.sources-arch
src/gallium/drivers/swr/rasterizer/common/os.h
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/context.h
src/gallium/drivers/swr/rasterizer/core/ringbuffer.h [new file with mode: 0644]
src/gallium/drivers/swr/rasterizer/core/threads.cpp