Remove flush parameter from intel_batch_flush()

There is only a single caller that wishes to forcibly append a flush
into the batch: intel_sync(). So move the logic there.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2009-12-02 20:48:37 +00:00
parent 57336c26f1
commit 98e1121036
8 changed files with 36 additions and 37 deletions

View File

@ -51,20 +51,6 @@ unsigned long intel_get_pixmap_pitch(PixmapPtr pixmap)
return (unsigned long)pixmap->devKind; return (unsigned long)pixmap->devKind;
} }
void intel_sync(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
ErrorF("I830Sync\n");
if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr)
return;
intel_batch_flush(scrn, TRUE);
intel_batch_wait_last(scrn);
}
void i830_debug_flush(ScrnInfoPtr scrn) void i830_debug_flush(ScrnInfoPtr scrn)
{ {
intel_screen_private *intel = intel_get_screen_private(scrn); intel_screen_private *intel = intel_get_screen_private(scrn);
@ -73,7 +59,7 @@ void i830_debug_flush(ScrnInfoPtr scrn)
intel_batch_pipelined_flush(scrn); intel_batch_pipelined_flush(scrn);
if (intel->debug_flush & DEBUG_FLUSH_BATCHES) if (intel->debug_flush & DEBUG_FLUSH_BATCHES)
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
} }
/* The following function sets up the supported acceleration. Call it /* The following function sets up the supported acceleration. Call it

View File

@ -124,24 +124,13 @@ void intel_batch_pipelined_flush(ScrnInfoPtr scrn)
} }
} }
void intel_batch_flush(ScrnInfoPtr scrn, Bool flush) void intel_batch_flush(ScrnInfoPtr scrn)
{ {
intel_screen_private *intel = intel_get_screen_private(scrn); intel_screen_private *intel = intel_get_screen_private(scrn);
int ret; int ret;
assert (!intel->in_batch_atomic); assert (!intel->in_batch_atomic);
if (flush) {
int flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
if (IS_I965G(intel))
flags = 0;
*(uint32_t *) (intel->batch_ptr + intel->batch_used) =
MI_FLUSH | flags;
intel->batch_used += 4;
}
if (intel->batch_used == 0) if (intel->batch_used == 0)
return; return;
@ -228,3 +217,26 @@ void intel_batch_wait_last(ScrnInfoPtr scrn)
drm_intel_bo_map(intel->last_batch_bo, TRUE); drm_intel_bo_map(intel->last_batch_bo, TRUE);
drm_intel_bo_unmap(intel->last_batch_bo); drm_intel_bo_unmap(intel->last_batch_bo);
} }
void intel_sync(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
int flags;
if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
ErrorF("I830Sync\n");
if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr)
return;
flags = MI_WRITE_DIRTY_STATE | MI_INVALIDATE_MAP_CACHE;
if (IS_I965G(intel))
flags = 0;
BEGIN_BATCH(1);
OUT_BATCH(flags);
ADVANCE_BATCH();
intel_batch_flush(scrn);
intel_batch_wait_last(scrn);
}

View File

@ -36,7 +36,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
void intel_batch_init(ScrnInfoPtr scrn); void intel_batch_init(ScrnInfoPtr scrn);
void intel_batch_teardown(ScrnInfoPtr scrn); void intel_batch_teardown(ScrnInfoPtr scrn);
void intel_batch_pipelined_flush(ScrnInfoPtr scrn); void intel_batch_pipelined_flush(ScrnInfoPtr scrn);
void intel_batch_flush(ScrnInfoPtr scrn, Bool flush); void intel_batch_flush(ScrnInfoPtr scrn);
void intel_batch_wait_last(ScrnInfoPtr scrn); void intel_batch_wait_last(ScrnInfoPtr scrn);
static inline int intel_batch_space(intel_screen_private *intel) static inline int intel_batch_space(intel_screen_private *intel)
@ -49,7 +49,7 @@ intel_batch_require_space(ScrnInfoPtr scrn, intel_screen_private *intel, GLuint
{ {
assert(sz < intel->batch_bo->size - 8); assert(sz < intel->batch_bo->size - 8);
if (intel_batch_space(intel) < sz) if (intel_batch_space(intel) < sz)
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
} }
static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, unsigned int sz) static inline void intel_batch_start_atomic(ScrnInfoPtr scrn, unsigned int sz)
@ -193,7 +193,7 @@ do { \
if ((intel->batch_emitting > 8) && \ if ((intel->batch_emitting > 8) && \
(I810_DEBUG & DEBUG_ALWAYS_SYNC)) { \ (I810_DEBUG & DEBUG_ALWAYS_SYNC)) { \
/* Note: not actually syncing, just flushing each batch. */ \ /* Note: not actually syncing, just flushing each batch. */ \
intel_batch_flush(scrn, FALSE); \ intel_batch_flush(scrn); \
} \ } \
intel->batch_emitting = 0; \ intel->batch_emitting = 0; \
} while (0) } while (0)

View File

@ -352,7 +352,7 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
* We can't rely on getting into the block handler before the DRI * We can't rely on getting into the block handler before the DRI
* client gets to run again so flush now. */ * client gets to run again so flush now. */
intel->need_mi_flush = FALSE; intel->need_mi_flush = FALSE;
intel_batch_flush(scrn, TRUE); intel_batch_flush(scrn);
#if ALWAYS_SYNC #if ALWAYS_SYNC
intel_sync(scrn); intel_sync(scrn);
#endif #endif

View File

@ -997,7 +997,8 @@ I830BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
/* Flush the batch, so that any rendering is executed in a timely /* Flush the batch, so that any rendering is executed in a timely
* fashion. * fashion.
*/ */
intel_batch_flush(scrn, flush); if (flush)
intel_batch_pipelined_flush(scrn);
drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE); drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE);
intel->need_mi_flush = FALSE; intel->need_mi_flush = FALSE;

View File

@ -93,7 +93,7 @@ i830_get_aperture_space(ScrnInfoPtr scrn, drm_intel_bo ** bo_table,
bo_table[0] = intel->batch_bo; bo_table[0] = intel->batch_bo;
if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) { if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) {
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
bo_table[0] = intel->batch_bo; bo_table[0] = intel->batch_bo;
if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) !=
0) { 0) {
@ -573,7 +573,7 @@ static Bool i830_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
if (!list_is_empty(&priv->batch) && if (!list_is_empty(&priv->batch) &&
(access == UXA_ACCESS_RW || priv->batch_write_domain)) (access == UXA_ACCESS_RW || priv->batch_write_domain))
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
/* No VT sema or GEM? No GTT mapping. */ /* No VT sema or GEM? No GTT mapping. */
if (!scrn->vtSema || bo->size > intel->max_gtt_map_size) { if (!scrn->vtSema || bo->size > intel->max_gtt_map_size) {

View File

@ -1627,7 +1627,7 @@ i965_prepare_composite(int op, PicturePtr source_picture,
} }
if (!i965_composite_check_aperture(scrn)) { if (!i965_composite_check_aperture(scrn)) {
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
if (!i965_composite_check_aperture(scrn)) { if (!i965_composite_check_aperture(scrn)) {
intel_debug_fallback(scrn, intel_debug_fallback(scrn,
"Couldn't fit render operation " "Couldn't fit render operation "
@ -1805,7 +1805,7 @@ i965_composite(PixmapPtr dest, int srcX, int srcY, int maskX, int maskY,
drm_intel_bo_subdata(vb_bo, render_state->vb_offset * 4, i * 4, vb); drm_intel_bo_subdata(vb_bo, render_state->vb_offset * 4, i * 4, vb);
if (!i965_composite_check_aperture(scrn)) if (!i965_composite_check_aperture(scrn))
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
intel_batch_start_atomic(scrn, 200); intel_batch_start_atomic(scrn, 200);
if (intel->needs_render_state_emit) if (intel->needs_render_state_emit)

View File

@ -1213,7 +1213,7 @@ I965DisplayVideoTextured(ScrnInfoPtr scrn,
if (drm_intel_bufmgr_check_aperture_space(bo_table, if (drm_intel_bufmgr_check_aperture_space(bo_table,
ARRAY_SIZE(bo_table)) ARRAY_SIZE(bo_table))
< 0) { < 0) {
intel_batch_flush(scrn, FALSE); intel_batch_flush(scrn);
} }
intel_batch_start_atomic(scrn, 100); intel_batch_start_atomic(scrn, 100);