summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-05-14 18:13:36 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-05-14 18:13:36 +1000
commitbc1696862c9ffa8d8f2c11d3120310e82f2e9327 (patch)
treea212a92776a05fb1ef09d1ea1864d9cc1e315440 /src/gallium
parent666ac923f016b1b231c5a8847cbe084321f697ca (diff)
parent19f15277d1871b62902031f9fa9aabf2f1bc7c40 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_vbuf.c20
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_emit.c10
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c3
-rw-r--r--src/gallium/auxiliary/gallivm/instructions.cpp30
-rw-r--r--src/gallium/auxiliary/gallivm/storage.cpp16
-rw-r--r--src/gallium/auxiliary/gallivm/storagesoa.cpp8
-rw-r--r--src/gallium/auxiliary/translate/translate.h26
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_fs.c15
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c86
-rw-r--r--src/gallium/winsys/xlib/fakeglx.c9
-rw-r--r--src/gallium/winsys/xlib/xm_api.c3
13 files changed, 128 insertions, 105 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index eef898f486..a1a3a9efaf 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -84,7 +84,7 @@ static boolean delete_blend_state(struct cso_context *ctx, void *state)
{
struct cso_blend *cso = (struct cso_blend *)state;
- if (ctx->blend == state)
+ if (ctx->blend == cso->data)
return FALSE;
if (cso->delete_state)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 2a19e6916a..86a7d1c730 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -42,6 +42,7 @@
#include "draw_vertex.h"
#include "draw_pipe.h"
#include "translate/translate.h"
+#include "translate/translate_cache.h"
/**
@@ -75,6 +76,8 @@ struct vbuf_stage {
/* Cache point size somewhere it's address won't change:
*/
float point_size;
+
+ struct translate_cache *cache;
};
@@ -220,7 +223,6 @@ vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
/* Translate from pipeline vertices to hw vertices.
*/
dst_offset = 0;
- memset(&hw_key, 0, sizeof(hw_key));
for (i = 0; i < vbuf->vinfo->num_attribs; i++) {
unsigned emit_sz = 0;
@@ -277,12 +279,10 @@ vbuf_set_prim( struct vbuf_stage *vbuf, uint prim )
/* Don't bother with caching at this stage:
*/
if (!vbuf->translate ||
- memcmp(&vbuf->translate->key, &hw_key, sizeof(hw_key)) != 0)
+ translate_key_compare(&vbuf->translate->key, &hw_key) != 0)
{
- if (vbuf->translate)
- vbuf->translate->release(vbuf->translate);
-
- vbuf->translate = translate_create( &hw_key );
+ translate_key_sanitize(&hw_key);
+ vbuf->translate = translate_cache_find(vbuf->cache, &hw_key);
vbuf->translate->set_buffer(vbuf->translate, 1, &vbuf->point_size, 0);
}
@@ -433,6 +433,9 @@ static void vbuf_destroy( struct draw_stage *stage )
if (vbuf->render)
vbuf->render->destroy( vbuf->render );
+ if (vbuf->cache)
+ translate_cache_destroy(vbuf->cache);
+
FREE( stage );
}
@@ -463,6 +466,11 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
16 );
if (!vbuf->indices)
goto fail;
+
+ vbuf->cache = translate_cache_create();
+ if (!vbuf->cache)
+ goto fail;
+
vbuf->vertices = NULL;
vbuf->vertex_ptr = vbuf->vertices;
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index f9ac16786e..ce3a153f64 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -58,8 +58,6 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
return;
}
- memset(&hw_key, 0, sizeof(hw_key));
-
/* Must do this after set_primitive() above:
*/
vinfo = draw->render->get_vertex_info(draw->render);
@@ -122,8 +120,9 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
hw_key.output_stride = vinfo->size * 4;
if (!emit->translate ||
- memcmp(&emit->translate->key, &hw_key, sizeof(hw_key)) != 0)
+ translate_key_compare(&emit->translate->key, &hw_key) != 0)
{
+ translate_key_sanitize(&hw_key);
emit->translate = translate_cache_find(emit->cache, &hw_key);
}
}
@@ -147,7 +146,7 @@ void draw_pt_emit( struct pt_emit *emit,
hw_verts = render->allocate_vertices(render,
(ushort)translate->key.output_stride,
- (ushort)count);
+ (ushort)vertex_count);
if (!hw_verts) {
assert(0);
return;
@@ -197,7 +196,8 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw )
void draw_pt_emit_destroy( struct pt_emit *emit )
{
- translate_cache_destroy(emit->cache);
+ if (emit->cache)
+ translate_cache_destroy(emit->cache);
FREE(emit);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 1f765b73ad..100117a9ae 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -65,8 +65,6 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
fetch->vertex_size = vertex_size;
- memset(&key, 0, sizeof(key));
-
/* Always emit/leave space for a vertex header.
*
* It's worth considering whether the vertex headers should contain
@@ -110,8 +108,9 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
if (!fetch->translate ||
- memcmp(&fetch->translate->key, &key, sizeof(key)) != 0)
+ translate_key_compare(&fetch->translate->key, &key) != 0)
{
+ translate_key_sanitize(&key);
fetch->translate = translate_cache_find(fetch->cache, &key);
{
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index a4de341df8..b7b970a297 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -174,8 +174,9 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
/* Don't bother with caching at this stage:
*/
if (!feme->translate ||
- memcmp(&feme->translate->key, &key, sizeof(key)) != 0)
+ translate_key_compare(&feme->translate->key, &key) != 0)
{
+ translate_key_sanitize(&key);
feme->translate = translate_cache_find(feme->cache,
&key);
diff --git a/src/gallium/auxiliary/gallivm/instructions.cpp b/src/gallium/auxiliary/gallivm/instructions.cpp
index 95a670edaf..1a98491b82 100644
--- a/src/gallium/auxiliary/gallivm/instructions.cpp
+++ b/src/gallium/auxiliary/gallivm/instructions.cpp
@@ -166,10 +166,9 @@ llvm::Value * Instructions::rsq(llvm::Value *in1)
Value *abs = callFAbs(x);
Value *sqrt = callFSqrt(abs);
- Value *rsqrt = m_builder.CreateFDiv(ConstantFP::get(Type::FloatTy,
- APFloat(1.f)),
- sqrt,
- name("rsqrt"));
+ Value *rsqrt = m_builder.CreateFDiv(ConstantFP::get(APFloat(1.f)),
+ sqrt,
+ name("rsqrt"));
return vectorFromVals(rsqrt, rsqrt, rsqrt, rsqrt);
}
@@ -278,9 +277,8 @@ llvm::Value * Instructions::rcp(llvm::Value *in1)
Value *x1 = m_builder.CreateExtractElement(in1,
m_storage->constantInt(0),
name("x1"));
- Value *res = m_builder.CreateFDiv(ConstantFP::get(Type::FloatTy,
- APFloat(1.f)),
- x1, name("rcp"));
+ Value *res = m_builder.CreateFDiv(ConstantFP::get(APFloat(1.f)),
+ x1, name("rcp"));
return vectorFromVals(res, res, res, res);
}
@@ -319,13 +317,13 @@ llvm::Value * Instructions::dst(llvm::Value *in1, llvm::Value *in2)
m_storage->constantInt(3),
name("w"));
Value *ry = m_builder.CreateMul(y1, y2, name("tyuy"));
- return vectorFromVals(ConstantFP::get(Type::FloatTy, APFloat(1.f)),
+ return vectorFromVals(ConstantFP::get(APFloat(1.f)),
ry, z, w);
}
llvm::Value * Instructions::ex2(llvm::Value *in)
{
- llvm::Value *val = callPow(ConstantFP::get(Type::FloatTy, APFloat(2.f)),
+ llvm::Value *val = callPow(ConstantFP::get(APFloat(2.f)),
m_builder.CreateExtractElement(
in, m_storage->constantInt(0),
name("x1")));
@@ -526,7 +524,7 @@ llvm::Function * Instructions::declarePrintf()
llvm::Value * Instructions::sgt(llvm::Value *in1, llvm::Value *in2)
{
- Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+ Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
Constant *const0f = Constant::getNullValue(Type::FloatTy);
std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -547,7 +545,7 @@ llvm::Value * Instructions::sgt(llvm::Value *in1, llvm::Value *in2)
}
llvm::Value * Instructions::sge(llvm::Value *in1, llvm::Value *in2)
{
- Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+ Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
Constant *const0f = Constant::getNullValue(Type::FloatTy);
std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -571,7 +569,7 @@ llvm::Value * Instructions::sge(llvm::Value *in1, llvm::Value *in2)
llvm::Value * Instructions::slt(llvm::Value *in1, llvm::Value *in2)
{
- Constant *const1f = ConstantFP::get(Type::FloatTy, APFloat(1.000000e+00f));
+ Constant *const1f = ConstantFP::get(APFloat(1.000000e+00f));
Constant *const0f = Constant::getNullValue(Type::FloatTy);
std::vector<llvm::Value*> vec1 = extractVector(in1);
@@ -814,10 +812,10 @@ llvm::Function * Instructions::findFunction(int label)
llvm::Value * Instructions::constVector(float x, float y, float z, float w)
{
std::vector<Constant*> vec(4);
- vec[0] = ConstantFP::get(Type::FloatTy, APFloat(x));
- vec[1] = ConstantFP::get(Type::FloatTy, APFloat(y));
- vec[2] = ConstantFP::get(Type::FloatTy, APFloat(z));
- vec[3] = ConstantFP::get(Type::FloatTy, APFloat(w));
+ vec[0] = ConstantFP::get(APFloat(x));
+ vec[1] = ConstantFP::get(APFloat(y));
+ vec[2] = ConstantFP::get(APFloat(z));
+ vec[3] = ConstantFP::get(APFloat(w));
return ConstantVector::get(m_floatVecType, vec);
}
diff --git a/src/gallium/auxiliary/gallivm/storage.cpp b/src/gallium/auxiliary/gallivm/storage.cpp
index 9d9fd12360..6f373f6dd5 100644
--- a/src/gallium/auxiliary/gallivm/storage.cpp
+++ b/src/gallium/auxiliary/gallivm/storage.cpp
@@ -69,10 +69,10 @@ llvm::Constant *Storage::shuffleMask(int vec)
{
if (!m_extSwizzleVec) {
std::vector<Constant*> elems;
- elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(0.f)));
- elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(1.f)));
- elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(0.f)));
- elems.push_back(ConstantFP::get(Type::FloatTy, APFloat(1.f)));
+ elems.push_back(ConstantFP::get(APFloat(0.f)));
+ elems.push_back(ConstantFP::get(APFloat(1.f)));
+ elems.push_back(ConstantFP::get(APFloat(0.f)));
+ elems.push_back(ConstantFP::get(APFloat(1.f)));
m_extSwizzleVec = ConstantVector::get(m_floatVecType, elems);
}
@@ -295,10 +295,10 @@ llvm::Value * Storage::immediateElement(int idx)
void Storage::addImmediate(float *val)
{
std::vector<Constant*> vec(4);
- vec[0] = ConstantFP::get(Type::FloatTy, APFloat(val[0]));
- vec[1] = ConstantFP::get(Type::FloatTy, APFloat(val[1]));
- vec[2] = ConstantFP::get(Type::FloatTy, APFloat(val[2]));
- vec[3] = ConstantFP::get(Type::FloatTy, APFloat(val[3]));
+ vec[0] = ConstantFP::get(APFloat(val[0]));
+ vec[1] = ConstantFP::get(APFloat(val[1]));
+ vec[2] = ConstantFP::get(APFloat(val[2]));
+ vec[3] = ConstantFP::get(APFloat(val[3]));
m_immediates.push_back(ConstantVector::get(m_floatVecType, vec));
}
diff --git a/src/gallium/auxiliary/gallivm/storagesoa.cpp b/src/gallium/auxiliary/gallivm/storagesoa.cpp
index 0e6e68c9d7..78d754371f 100644
--- a/src/gallium/auxiliary/gallivm/storagesoa.cpp
+++ b/src/gallium/auxiliary/gallivm/storagesoa.cpp
@@ -264,10 +264,10 @@ llvm::Constant * StorageSoa::createConstGlobalVector(const std::vector<float> &v
{
VectorType *vectorType = VectorType::get(Type::FloatTy, 4);
std::vector<Constant*> immValues;
- ConstantFP *constx = ConstantFP::get(Type::FloatTy, APFloat(vec[0]));
- ConstantFP *consty = ConstantFP::get(Type::FloatTy, APFloat(vec[1]));
- ConstantFP *constz = ConstantFP::get(Type::FloatTy, APFloat(vec[2]));
- ConstantFP *constw = ConstantFP::get(Type::FloatTy, APFloat(vec[3]));
+ ConstantFP *constx = ConstantFP::get(APFloat(vec[0]));
+ ConstantFP *consty = ConstantFP::get(APFloat(vec[1]));
+ ConstantFP *constz = ConstantFP::get(APFloat(vec[2]));
+ ConstantFP *constw = ConstantFP::get(APFloat(vec[3]));
immValues.push_back(constx);
immValues.push_back(consty);
immValues.push_back(constz);
diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h
index 6c15d7e4dc..b8210af50c 100644
--- a/src/gallium/auxiliary/translate/translate.h
+++ b/src/gallium/auxiliary/translate/translate.h
@@ -47,10 +47,9 @@
struct translate_element
{
enum pipe_format input_format;
- unsigned input_buffer;
- unsigned input_offset;
-
enum pipe_format output_format;
+ unsigned input_buffer;
+ unsigned input_offset; /* can't really reduce the size of these */
unsigned output_offset;
};
@@ -96,6 +95,27 @@ struct translate *translate_lookup_or_create( struct translate_context *tctx,
struct translate *translate_create( const struct translate_key *key );
+static INLINE int translate_keysize( const struct translate_key *key )
+{
+ return 2 * sizeof(int) + key->nr_elements * sizeof(struct translate_element);
+}
+
+static INLINE int translate_key_compare( const struct translate_key *a,
+ const struct translate_key *b )
+{
+ int keysize = translate_keysize(a);
+ return memcmp(a, b, keysize);
+}
+
+
+static INLINE void translate_key_sanitize( struct translate_key *a )
+{
+ int keysize = translate_keysize(a);
+ char *ptr = (char *)a;
+ memset(ptr + keysize, 0, sizeof(*a) - keysize);
+}
+
+
/*******************************************************************************
* Private:
*/
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 625d0f9b48..8c88c192f8 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -53,7 +53,6 @@ struct quad_shade_stage
struct tgsi_sampler samplers[PIPE_MAX_SAMPLERS];
struct tgsi_exec_machine machine;
struct tgsi_exec_vector *inputs, *outputs;
- int colorOutSlot, depthOutSlot;
};
@@ -156,20 +155,6 @@ static void shade_begin(struct quad_stage *qs)
qss->samplers[i].texture = softpipe->texture[i];
}
- /* find output slots for depth, color */
- qss->colorOutSlot = -1;
- qss->depthOutSlot = -1;
- for (i = 0; i < qss->stage.softpipe->fs->info.num_outputs; i++) {
- switch (qss->stage.softpipe->fs->info.output_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- qss->depthOutSlot = i;
- break;
- case TGSI_SEMANTIC_COLOR:
- qss->colorOutSlot = i;
- break;
- }
- }
-
softpipe->fs->prepare( softpipe->fs,
&qss->machine,
qss->samplers );
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index df7be01fcd..543d86a5cb 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -209,77 +209,76 @@ static INLINE int block( int x )
/**
- * Compute mask which indicates which pixels in the 2x2 quad are actually inside
- * the triangle's bounds.
- *
- * this is pretty nasty... may need to rework flush_spans again to
- * fix it, if possible.
- */
-static unsigned calculate_mask( struct setup_context *setup, int x )
-{
- unsigned mask = 0x0;
-
- if (x >= setup->span.left[0] && x < setup->span.right[0])
- mask |= MASK_TOP_LEFT;
-
- if (x >= setup->span.left[1] && x < setup->span.right[1])
- mask |= MASK_BOTTOM_LEFT;
-
- if (x+1 >= setup->span.left[0] && x+1 < setup->span.right[0])
- mask |= MASK_TOP_RIGHT;
-
- if (x+1 >= setup->span.left[1] && x+1 < setup->span.right[1])
- mask |= MASK_BOTTOM_RIGHT;
-
- return mask;
-}
-
-
-/**
* Render a horizontal span of quads
*/
static void flush_spans( struct setup_context *setup )
{
+ const int xleft0 = setup->span.left[0];
+ const int xleft1 = setup->span.left[1];
+ const int xright0 = setup->span.right[0];
+ const int xright1 = setup->span.right[1];
int minleft, maxright;
int x;
switch (setup->span.y_flags) {
case 0x3:
/* both odd and even lines written (both quad rows) */
- minleft = MIN2(setup->span.left[0], setup->span.left[1]);
- maxright = MAX2(setup->span.right[0], setup->span.right[1]);
+ minleft = block(MIN2(xleft0, xleft1));
+ maxright = block(MAX2(xright0, xright1));
+ for (x = minleft; x <= maxright; x += 2) {
+ /* determine which of the four pixels is inside the span bounds */
+ uint mask = 0x0;
+ if (x >= xleft0 && x < xright0)
+ mask |= MASK_TOP_LEFT;
+ if (x >= xleft1 && x < xright1)
+ mask |= MASK_BOTTOM_LEFT;
+ if (x+1 >= xleft0 && x+1 < xright0)
+ mask |= MASK_TOP_RIGHT;
+ if (x+1 >= xleft1 && x+1 < xright1)
+ mask |= MASK_BOTTOM_RIGHT;
+ emit_quad( setup, x, setup->span.y, mask );
+ }
break;
case 0x1:
/* only even line written (quad top row) */
- minleft = setup->span.left[0];
- maxright = setup->span.right[0];
+ minleft = block(xleft0);
+ maxright = block(xright0);
+ for (x = minleft; x <= maxright; x += 2) {
+ uint mask = 0x0;
+ if (x >= xleft0 && x < xright0)
+ mask |= MASK_TOP_LEFT;
+ if (x+1 >= xleft0 && x+1 < xright0)
+ mask |= MASK_TOP_RIGHT;
+ emit_quad( setup, x, setup->span.y, mask );
+ }
break;
case 0x2:
/* only odd line written (quad bottom row) */
- minleft = setup->span.left[1];
- maxright = setup->span.right[1];
+ minleft = block(xleft1);
+ maxright = block(xright1);
+ for (x = minleft; x <= maxright; x += 2) {
+ uint mask = 0x0;
+ if (x >= xleft1 && x < xright1)
+ mask |= MASK_BOTTOM_LEFT;
+ if (x+1 >= xleft1 && x+1 < xright1)
+ mask |= MASK_BOTTOM_RIGHT;
+ emit_quad( setup, x, setup->span.y, mask );
+ }
break;
default:
return;
}
- /* XXX this loop could be moved into the above switch cases and
- * calculate_mask() could be simplified a bit...
- */
- for (x = block(minleft); x <= block(maxright); x += 2) {
- emit_quad( setup, x, setup->span.y,
- calculate_mask( setup, x ) );
- }
-
setup->span.y = 0;
setup->span.y_flags = 0;
setup->span.right[0] = 0;
setup->span.right[1] = 0;
}
+
#if DEBUG_VERTS
static void print_vertex(const struct setup_context *setup,
const float (*v)[4])
@@ -717,7 +716,7 @@ void setup_tri( struct setup_context *setup,
const float (*v1)[4],
const float (*v2)[4] )
{
- float det = calc_det(v0, v1, v2);
+ float det;
#if DEBUG_VERTS
debug_printf("Setup triangle:\n");
@@ -728,7 +727,8 @@ void setup_tri( struct setup_context *setup,
if (setup->softpipe->no_rast)
return;
-
+
+ det = calc_det(v0, v1, v2);
/*
debug_printf("%s\n", __FUNCTION__ );
*/
diff --git a/src/gallium/winsys/xlib/fakeglx.c b/src/gallium/winsys/xlib/fakeglx.c
index ec77e81fed..2c0075e934 100644
--- a/src/gallium/winsys/xlib/fakeglx.c
+++ b/src/gallium/winsys/xlib/fakeglx.c
@@ -1689,6 +1689,15 @@ static void
Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
{
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
+ static boolean firsttime = 1, no_rast = 0;
+
+ if (firsttime) {
+ no_rast = getenv("SP_NO_RAST") != NULL;
+ firsttime = 0;
+ }
+
+ if (no_rast)
+ return;
if (buffer) {
XMesaSwapBuffers(buffer);
diff --git a/src/gallium/winsys/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index 0c248344b1..26b722f343 100644
--- a/src/gallium/winsys/xlib/xm_api.c
+++ b/src/gallium/winsys/xlib/xm_api.c
@@ -110,6 +110,9 @@ int xmesa_check_for_xshm( XMesaDisplay *display )
int major, minor, ignore;
Bool pixmaps;
+ if (getenv("SP_NO_RAST"))
+ return 0;
+
if (getenv("MESA_NOSHM")) {
return 0;
}