Module: Mesa
Branch: mesa_7_7_branch
Commit: af2023e31cde5ad2cf8ce740e20a98c4cbab37ce
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af2023e31cde5ad2cf8ce740e20a98c4cbab37ce

Author: José Fonseca <jfons...@vmware.com>
Date:   Tue Feb 16 12:21:55 2010 +0000

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.

---

 src/mesa/main/context.h          |    8 ++++----
 src/mesa/state_tracker/st_draw.c |    2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index c3be106..5a4f860 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 d3b22db..823c72d 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);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to