summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_memory.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-07-16 14:40:30 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-07-16 17:24:21 +0100
commit2f6d47a7c8d6e69e5154de44115aab9ba35a41d2 (patch)
tree8919f6686b6f7db8aa3d3305084076d8884afb15 /src/gallium/drivers/llvmpipe/lp_memory.c
parentb7fff13d58b57870807bae2f43fa2854b551b267 (diff)
llvmpipe: use single swizzled tile
Use a single swizzled tile per colorbuf (and per thread) to avoid accumulating large amounts of cached swizzled data. Now that the SSE3 code has been merged to master, the performance delta of this change is minimal, the main benefit is reduced memory usage due to no longer keeping swizzled copies of render targets. It's clear from the performance of the in-place version of this code that there is still quite a bit of time being spent swizzling & unswizzling, but it's not clear exactly how to reduce that.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_memory.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_memory.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_memory.c b/src/gallium/drivers/llvmpipe/lp_memory.c
index 61d16668eb..0f55d4a80a 100644
--- a/src/gallium/drivers/llvmpipe/lp_memory.c
+++ b/src/gallium/drivers/llvmpipe/lp_memory.c
@@ -29,32 +29,17 @@
#include "lp_limits.h"
#include "lp_memory.h"
-
-/** 32bpp RGBA dummy tile to use in out of memory conditions */
-static PIPE_ALIGN_VAR(16) uint8_t lp_dummy_tile[TILE_SIZE * TILE_SIZE * 4];
-
-static unsigned lp_out_of_memory = 0;
-
-
-uint8_t *
-lp_get_dummy_tile(void)
-{
- if (lp_out_of_memory++ < 10) {
- debug_printf("llvmpipe: out of memory. Using dummy tile memory.\n");
- }
- return lp_dummy_tile;
-}
-
-uint8_t *
-lp_get_dummy_tile_silent(void)
-{
- return lp_dummy_tile;
-}
-
-
-boolean
-lp_is_dummy_tile(void *tile)
-{
- return tile == lp_dummy_tile;
-}
+/**
+ * 32bpp RGBA swizzled tiles. One for for each thread and each
+ * possible colorbuf. Adds up to quite a bit 8*8*64*64*4 == 1MB.
+ * Several schemes exist to reduce this, such as scaling back the
+ * number of threads or using a smaller tilesize when multiple
+ * colorbuffers are bound.
+ */
+PIPE_ALIGN_VAR(16) uint8_t lp_swizzled_cbuf[LP_MAX_THREADS][PIPE_MAX_COLOR_BUFS][TILE_SIZE * TILE_SIZE * 4];
+
+
+/* A single dummy tile used in a couple of out-of-memory situations.
+ */
+PIPE_ALIGN_VAR(16) uint8_t lp_dummy_tile[TILE_SIZE * TILE_SIZE * 4];