Mesa (master): intel: assert that we do not overflow the batch buffer.

Chris Wilson ickle at kemper.freedesktop.org
Mon Feb 22 10:12:50 UTC 2010


Module: Mesa
Branch: master
Commit: 15904c057beec3029a8ed2035d7ba50f9414943d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=15904c057beec3029a8ed2035d7ba50f9414943d

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Feb 22 09:53:36 2010 +0000

intel: assert that we do not overflow the batch buffer.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/intel/intel_batchbuffer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 9261f2f..4c99dcd 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -158,9 +158,10 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
    }
 
    /* Mark the end of the buffer. */
-   *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END; /* noop */
+   *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END;
    batch->ptr += 4;
    used = batch->ptr - batch->map;
+   assert (used <= batch->buf->size);
 
    /* Workaround for recursive batchbuffer flushing: If the window is
     * moved, we can get into a case where we try to flush during a




More information about the mesa-commit mailing list