i915g: Check relocs as well
authorJakob Bornecrantz <wallbraker@gmail.com>
Sat, 8 Aug 2009 15:19:43 +0000 (17:19 +0200)
committerJakob Bornecrantz <wallbraker@gmail.com>
Wed, 12 Aug 2009 01:58:37 +0000 (03:58 +0200)
src/gallium/drivers/i915simple/i915_batch.h

index a433cf054de7331102a69a1fe8b77f3f1406d528..c6e68ea38a27a14882b044001f7fcc0fb35b54cd 100644 (file)
@@ -50,8 +50,8 @@ i915_batchbuffer_check( struct i915_batchbuffer *batch,
                        size_t dwords,
                        size_t relocs )
 {
-   /** TODO JB: Check relocs */
-   return dwords * 4 <= batch->size - (batch->ptr - batch->map);
+   return dwords * 4 <= batch->size - (batch->ptr - batch->map) &&
+          relocs <= (batch->max_relocs - batch->relocs);
 }
 
 static INLINE size_t