summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-02-16 12:21:55 +0000
committerJosé Fonseca <jfonseca@vmware.com>2010-02-16 13:24:01 +0000
commitaf2023e31cde5ad2cf8ce740e20a98c4cbab37ce (patch)
tree5814b32dd266f4a59d44a851763f77f7f1872425
parent2eedbc94c22bc13575e7639620f0d1957f205b34 (diff)
vbo: Ensure vertices are always unmapped before the context is flushed.
Purpose is two fold: - when doing user-space memory management mapping a buffer stored in the graphics aperture effectively pins it there, increasing the likelyhood of failure of validating other buffers when flushing - certain hardware/platform combinations do not allow a buffer to be simultaneously mapped and validated This fixes assertion failures in HL Uplink with the svga driver, where vbo was holding a map to a buffer which was also referred in the command stream. Note: this a non-invasive fix and shouldn't be just cherry-picked into master as-is -- a cleaner fix for this problem should be searched.
-rw-r--r--src/mesa/main/context.h8
-rw-r--r--src/mesa/state_tracker/st_draw.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index c3be1063f86..5a4f860ff0e 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -207,8 +207,8 @@ _mesa_Flush( void );
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
- if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
- ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ if (ctx->Driver.NeedFlush) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
@@ -226,8 +226,8 @@ do { \
do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
- if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
- ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
+ if (ctx->Driver.NeedFlush) \
+ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES | FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index d3b22db121c..823c72d3762 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -404,6 +404,7 @@ setup_interleaved_attribs(GLcontext *ctx,
vbuffer->buffer_offset = 0;
}
else {
+ assert(!bufobj->Pointer);
vbuffer->buffer = NULL;
pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
vbuffer->buffer_offset = pointer_to_offset(low);
@@ -460,6 +461,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
assert(stobj->buffer);
/*printf("stobj %u = %p\n", attr, (void*) stobj);*/
+ assert(!bufobj->Pointer);
vbuffer[attr].buffer = NULL;
pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
vbuffer[attr].buffer_offset = pointer_to_offset(arrays[mesaAttr]->Ptr);