mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
Append an MI_FLUSH to each batchbuffer for synchronization. Not really
ideal from a performance viewpoint and there are mechanisms to avoid this in future.
This commit is contained in:
parent
f74e06bf11
commit
54b7eca7a0
6 changed files with 24 additions and 25 deletions
|
|
@ -360,14 +360,9 @@ static void i915_lost_hardware( struct intel_context *intel )
|
|||
i915->state.emitted = 0;
|
||||
}
|
||||
|
||||
static void i915_emit_flush( struct intel_context *intel )
|
||||
static GLuint i915_flush_cmd( void )
|
||||
{
|
||||
BATCH_LOCALS;
|
||||
|
||||
BEGIN_BATCH(2, 0);
|
||||
OUT_BATCH( MI_FLUSH | FLUSH_MAP_CACHE | FLUSH_RENDER_CACHE );
|
||||
OUT_BATCH( 0 );
|
||||
ADVANCE_BATCH();
|
||||
return MI_FLUSH | FLUSH_MAP_CACHE | FLUSH_RENDER_CACHE;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -382,6 +377,6 @@ void i915InitVtbl( struct i915_context *i915 )
|
|||
i915->intel.vtbl.render_start = i915_render_start;
|
||||
i915->intel.vtbl.set_draw_region = i915_set_draw_region;
|
||||
i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
|
||||
i915->intel.vtbl.emit_flush = i915_emit_flush;
|
||||
i915->intel.vtbl.flush_cmd = i915_flush_cmd;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ static void do_flush_locked( struct intel_batchbuffer *batch,
|
|||
ptr[r->offset/4] = batch->offset[r->elem] + r->delta;
|
||||
}
|
||||
|
||||
if (0)
|
||||
if (INTEL_DEBUG & DEBUG_DMA)
|
||||
intel_dump_batchbuffer( 0, ptr, used );
|
||||
|
||||
|
||||
|
|
@ -189,14 +189,17 @@ GLuint intel_batchbuffer_flush( struct intel_batchbuffer *batch )
|
|||
if (used == 0)
|
||||
return batch->last_fence;
|
||||
|
||||
/* Add the MI_BATCH_BUFFER_END:
|
||||
/* Add the MI_BATCH_BUFFER_END. Always add an MI_FLUSH - this is a
|
||||
* performance drain that we would like to avoid.
|
||||
*/
|
||||
if (intel_batchbuffer_space(batch) & 4) {
|
||||
((int *)batch->ptr)[0] = MI_BATCH_BUFFER_END;
|
||||
used += 4;
|
||||
if (used & 4) {
|
||||
((int *)batch->ptr)[0] = intel->vtbl.flush_cmd();
|
||||
((int *)batch->ptr)[1] = 0;
|
||||
((int *)batch->ptr)[2] = MI_BATCH_BUFFER_END;
|
||||
used += 12;
|
||||
}
|
||||
else {
|
||||
((int *)batch->ptr)[0] = 0;
|
||||
((int *)batch->ptr)[0] = intel->vtbl.flush_cmd();
|
||||
((int *)batch->ptr)[1] = MI_BATCH_BUFFER_END;
|
||||
used += 8;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
struct intel_context;
|
||||
|
||||
#define BATCH_SZ 4096
|
||||
#define BATCH_RESERVED 16
|
||||
|
||||
#define MAX_RELOCS 100
|
||||
|
||||
#define INTEL_BATCH_NO_CLIPRECTS 0x1
|
||||
|
|
@ -72,7 +74,7 @@ GLboolean intel_batchbuffer_emit_reloc( struct intel_batchbuffer *batch,
|
|||
static inline GLuint
|
||||
intel_batchbuffer_space( struct intel_batchbuffer *batch )
|
||||
{
|
||||
return (BATCH_SZ - 8) - (batch->ptr - batch->map);
|
||||
return (BATCH_SZ - BATCH_RESERVED) - (batch->ptr - batch->map);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv )
|
|||
{
|
||||
struct intel_context *intel;
|
||||
|
||||
if (0)
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
DBG(stderr, "%s\n", __FUNCTION__);
|
||||
|
||||
assert(dPriv);
|
||||
assert(dPriv->driContextPriv);
|
||||
|
|
@ -188,12 +187,11 @@ void intelEmitCopyBlit( struct intel_context *intel,
|
|||
BATCH_LOCALS;
|
||||
|
||||
|
||||
if (1)
|
||||
_mesa_printf("%s src:buf(%d)/%d %d,%d dst:buf(%d)/%d %d,%d sz:%dx%d\n",
|
||||
__FUNCTION__,
|
||||
src_buffer, src_pitch, src_x, src_y,
|
||||
dst_buffer, dst_pitch, dst_x, dst_y,
|
||||
w,h);
|
||||
DBG("%s src:buf(%d)/%d %d,%d dst:buf(%d)/%d %d,%d sz:%dx%d\n",
|
||||
__FUNCTION__,
|
||||
src_buffer, src_pitch, src_x, src_y,
|
||||
dst_buffer, dst_pitch, dst_x, dst_y,
|
||||
w,h);
|
||||
|
||||
src_pitch *= cpp;
|
||||
dst_pitch *= cpp;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ struct intel_context
|
|||
void (*set_draw_region)( struct intel_context *intel,
|
||||
struct intel_region *draw_region,
|
||||
struct intel_region *depth_region );
|
||||
void (*emit_flush)( struct intel_context *intel );
|
||||
|
||||
GLuint (*flush_cmd)( void );
|
||||
|
||||
void (*reduced_primitive_state)( struct intel_context *intel, GLenum rprim );
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void intel_batch_ioctl( struct intel_context *intel,
|
|||
batch.DR4 = ((((GLuint)intel->drawX) & 0xffff) |
|
||||
(((GLuint)intel->drawY) << 16));
|
||||
|
||||
if (0)
|
||||
if (INTEL_DEBUG & DEBUG_DMA)
|
||||
fprintf(stderr, "%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
|
||||
__FUNCTION__,
|
||||
batch.start,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue