Mesa (master): intel: Initialize batch->reserved_space on allocation

Chris Wilson ickle at kemper.freedesktop.org
Mon May 31 09:01:58 UTC 2010


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

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon May 31 09:58:25 2010 +0100

intel: Initialize batch->reserved_space on allocation

Fixes the assert (and buffer overrun):

  glknots: intel_batchbuffer.c:164: _intel_batchbuffer_flush: Assertion
  'used >= batch->buf->size' failed.

Reported in bug:

  Bug 28274 - xscreensaver's glknots hangs GPU (945GME/Pineview)
  https://bugs.freedesktop.org/show_bug.cgi?id=28274

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

---

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

diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 446ce29..27bd4fe 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -55,6 +55,7 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
    }
    batch->size = intel->maxBatchSize;
    batch->ptr = batch->map;
+   batch->reserved_space = BATCH_RESERVED;
    batch->dirty_state = ~0;
 }
 
@@ -180,8 +181,6 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
    /* Check that we didn't just wrap our batchbuffer at a bad time. */
    assert(!intel->no_batch_wrap);
 
-   batch->reserved_space = BATCH_RESERVED;
-
    /* TODO: Just pass the relocation list and dma buffer up to the
     * kernel.
     */




More information about the mesa-commit mailing list