summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/llvmpipe/lp_clear.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_debug.h13
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c15
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_blend.c29
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c18
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_surface.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.c6
8 files changed, 90 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_clear.c b/src/gallium/drivers/llvmpipe/lp_clear.c
index 3e8c410925..b486b243eb 100644
--- a/src/gallium/drivers/llvmpipe/lp_clear.c
+++ b/src/gallium/drivers/llvmpipe/lp_clear.c
@@ -36,6 +36,7 @@
#include "lp_clear.h"
#include "lp_context.h"
#include "lp_setup.h"
+#include "lp_debug.h"
/**
@@ -54,5 +55,8 @@ llvmpipe_clear(struct pipe_context *pipe,
if (llvmpipe->no_rast)
return;
+ if (LP_PERF & PERF_NO_DEPTH)
+ buffers &= ~PIPE_CLEAR_DEPTHSTENCIL;
+
lp_setup_clear( llvmpipe->setup, rgba, depth, stencil, buffers );
}
diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h b/src/gallium/drivers/llvmpipe/lp_debug.h
index add43e4fca..588cda52ad 100644
--- a/src/gallium/drivers/llvmpipe/lp_debug.h
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -50,6 +50,19 @@ st_print_current(void);
#define DEBUG_FENCE 0x2000
#define DEBUG_MEM 0x4000
+/* Performance flags. These are active even on release builds.
+ */
+#define PERF_TEX_MEM 0x1 /* minimize texture cache footprint */
+#define PERF_NO_MIP_LINEAR 0x2 /* MIP_FILTER_LINEAR ==> _NEAREST */
+#define PERF_NO_MIPMAPS 0x4 /* MIP_FILTER_NONE always */
+#define PERF_NO_LINEAR 0x8 /* FILTER_NEAREST always */
+#define PERF_NO_TEX 0x10 /* sample white always */
+#define PERF_NO_BLEND 0x20 /* disable blending */
+#define PERF_NO_DEPTH 0x40 /* disable depth buffering entirely */
+#define PERF_NO_ALPHATEST 0x80 /* disable alpha testing */
+
+
+extern int LP_PERF;
#ifdef DEBUG
extern int LP_DEBUG;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 0d40dc5020..f920607d05 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -68,6 +68,19 @@ static const struct debug_named_value lp_debug_flags[] = {
};
#endif
+int LP_PERF = 0;
+static const struct debug_named_value lp_perf_flags[] = {
+ { "texmem", PERF_TEX_MEM, NULL },
+ { "no_mipmap", PERF_NO_MIPMAPS, NULL },
+ { "no_linear", PERF_NO_LINEAR, NULL },
+ { "no_mip_linear", PERF_NO_MIP_LINEAR, NULL },
+ { "no_tex", PERF_NO_TEX, NULL },
+ { "no_blend", PERF_NO_BLEND, NULL },
+ { "no_depth", PERF_NO_DEPTH, NULL },
+ { "no_alphatest", PERF_NO_ALPHATEST, NULL },
+ DEBUG_NAMED_VALUE_END
+};
+
static const char *
llvmpipe_get_vendor(struct pipe_screen *screen)
@@ -372,6 +385,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
#endif
+ LP_PERF = debug_get_flags_option("LP_PERF", lp_perf_flags, 0 );
+
if (!screen)
return NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index e6a8196761..6674d281d1 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -651,11 +651,12 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->row_stride[j] = lp_tex->row_stride[j];
jit_tex->img_stride[j] = lp_tex->img_stride[j];
- if (!jit_tex->data[j]) {
+ if ((LP_PERF & PERF_TEX_MEM) ||
+ !jit_tex->data[j]) {
/* out of memory - use dummy tile memory */
jit_tex->data[j] = lp_dummy_tile;
- jit_tex->width = TILE_SIZE;
- jit_tex->height = TILE_SIZE;
+ jit_tex->width = TILE_SIZE/8;
+ jit_tex->height = TILE_SIZE/8;
jit_tex->depth = 1;
jit_tex->last_level = 0;
jit_tex->row_stride[j] = 0;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_blend.c b/src/gallium/drivers/llvmpipe/lp_state_blend.c
index 5b39d9d1a9..6bba9077d1 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_blend.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_blend.c
@@ -38,13 +38,23 @@
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_state.h"
+#include "lp_debug.h"
static void *
llvmpipe_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend)
{
- return mem_dup(blend, sizeof(*blend));
+ struct pipe_blend_state *state = mem_dup(blend, sizeof *blend);
+ int i;
+
+ if (LP_PERF & PERF_NO_BLEND) {
+ state->independent_blend_enable = 0;
+ for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
+ state->rt[i].blend_enable = 0;
+ }
+
+ return state;
}
@@ -100,7 +110,22 @@ static void *
llvmpipe_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_alpha_state *depth_stencil)
{
- return mem_dup(depth_stencil, sizeof(*depth_stencil));
+ struct pipe_depth_stencil_alpha_state *state;
+
+ state = mem_dup(depth_stencil, sizeof *depth_stencil);
+
+ if (LP_PERF & PERF_NO_DEPTH) {
+ state->depth.enabled = 0;
+ state->depth.writemask = 0;
+ state->stencil[0].enabled = 0;
+ state->stencil[1].enabled = 0;
+ }
+
+ if (LP_PERF & PERF_NO_ALPHATEST) {
+ state->alpha.enabled = 0;
+ }
+
+ return state;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 715ce2f02e..17a4a0ed02 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -37,6 +37,7 @@
#include "lp_context.h"
#include "lp_screen.h"
#include "lp_state.h"
+#include "lp_debug.h"
#include "state_tracker/sw_winsys.h"
@@ -44,7 +45,22 @@ static void *
llvmpipe_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
{
- return mem_dup(sampler, sizeof(*sampler));
+ struct pipe_sampler_state *state = mem_dup(sampler, sizeof *sampler);
+
+ if (LP_PERF & PERF_NO_MIP_LINEAR) {
+ if (state->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR)
+ state->min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
+ }
+
+ if (LP_PERF & PERF_NO_MIPMAPS)
+ state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+
+ if (LP_PERF & PERF_NO_LINEAR) {
+ state->mag_img_filter = PIPE_TEX_FILTER_NEAREST;
+ state->min_img_filter = PIPE_TEX_FILTER_NEAREST;
+ }
+
+ return state;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c
index 4b135aaf8b..cd1a5b1980 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c
@@ -60,6 +60,10 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
util_copy_framebuffer_state(&lp->framebuffer, fb);
+ if (LP_PERF & PERF_NO_DEPTH) {
+ pipe_surface_reference(&lp->framebuffer.zsbuf, NULL);
+ }
+
/* Tell draw module how deep the Z/depth buffer is */
if (lp->framebuffer.zsbuf) {
int depth_bits;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
index 65208dd5d5..4e026cc8ff 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c
@@ -48,6 +48,7 @@
#include "gallivm/lp_bld_tgsi.h"
#include "lp_jit.h"
#include "lp_tex_sample.h"
+#include "lp_debug.h"
/**
@@ -179,6 +180,11 @@ lp_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
struct lp_llvm_sampler_soa *sampler = (struct lp_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
+
+ if (LP_PERF & PERF_NO_TEX) {
+ lp_build_sample_nop(type, texel);
+ return;
+ }
lp_build_sample_soa(builder,
&sampler->dynamic_state.static_state[unit],