Do something sensible when failed to reserve space in the batch buffer.

This commit is contained in:
José Fonseca
2007-11-03 01:31:47 +00:00
parent 5c1606a2b3
commit 5fa6ea6858
5 changed files with 17 additions and 18 deletions
+8 -2
View File
@@ -69,7 +69,10 @@ i915_fill_blit(struct i915_context *i915,
// __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h);
BEGIN_BATCH(6, 1);
if (!BEGIN_BATCH(6, 1)) {
FLUSH_BATCH();
assert(BEGIN_BATCH(6, 1));
}
OUT_BATCH(CMD);
OUT_BATCH(BR13);
OUT_BATCH((y << 16) | x);
@@ -140,7 +143,10 @@ i915_copy_blit( struct i915_context *i915,
assert (dst_pitch > 0 && src_pitch > 0);
BEGIN_BATCH(8, 2);
if (!BEGIN_BATCH(8, 2)) {
FLUSH_BATCH();
assert(BEGIN_BATCH(8, 2));
}
OUT_BATCH(CMD);
OUT_BATCH(BR13);
OUT_BATCH((dst_y << 16) | dst_x);
+4 -1
View File
@@ -56,7 +56,10 @@ static void i915_flush( struct pipe_context *pipe,
if (flags & PIPE_FLUSH_TEXTURE_CACHE)
flush |= FLUSH_MAP_CACHE;
BEGIN_BATCH( 1, 0 );
if (!BEGIN_BATCH(1, 0)) {
FLUSH_BATCH();
assert(BEGIN_BATCH(1, 0));
}
OUT_BATCH( flush );
ADVANCE_BATCH();
}
+2 -5
View File
@@ -123,7 +123,6 @@ emit_prim( struct draw_stage *stage,
{
struct i915_context *i915 = setup_stage(stage)->i915;
unsigned vertex_size = i915->current.vertex_info.size * 4; /* in bytes */
unsigned *ptr;
unsigned i;
assert(vertex_size >= 12); /* never smaller than 12 bytes */
@@ -134,8 +133,7 @@ emit_prim( struct draw_stage *stage,
if (i915->hardware_dirty)
i915_emit_hardware_state( i915 );
ptr = BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 );
if (ptr == 0) {
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
FLUSH_BATCH();
/* Make sure state is re-emitted after a flush:
@@ -143,8 +141,7 @@ emit_prim( struct draw_stage *stage,
i915_update_derived( i915 );
i915_emit_hardware_state( i915 );
ptr = BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 );
if (ptr == 0) {
if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) {
assert(0);
return;
}
+2 -9
View File
@@ -303,12 +303,7 @@ static void vbuf_draw( struct draw_stage *stage )
if (i915->hardware_dirty)
i915_emit_hardware_state( i915 );
ptr = BEGIN_BATCH( 4 + (nr + 1)/2, 1 );
#if 1
assert(ptr);
#else
/* XXX: below is bogus as ptr always nonzero except in fatal errors */
if (ptr == 0) {
if (!BEGIN_BATCH( 4 + (nr + 1)/2, 1 )) {
FLUSH_BATCH();
/* Make sure state is re-emitted after a flush:
@@ -316,13 +311,11 @@ static void vbuf_draw( struct draw_stage *stage )
i915_update_derived( i915 );
i915_emit_hardware_state( i915 );
ptr = BEGIN_BATCH( 2, 1 );
if (ptr == 0) {
if (!BEGIN_BATCH( 4 + (nr + 1)/2, 1 )) {
assert(0);
return;
}
}
#endif
/* FIXME: don't do this every time */
OUT_BATCH( _3DSTATE_LOAD_STATE_IMMEDIATE_1 |
+1 -1
View File
@@ -81,7 +81,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
if(!BEGIN_BATCH(dwords, relocs)) {
FLUSH_BATCH();
BEGIN_BATCH(dwords, relocs);
assert(BEGIN_BATCH(dwords, relocs));
}
/* 14 dwords, 0 relocs */