From 551fd61380347af023f405071d7a7b3acc24274c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 3 Dec 2010 02:05:05 +0000 Subject: Wait on the current buffer to complete when running synchronously. And remove the vestigal wait upon changing crtc as this is more properly done in the kernel. Signed-off-by: Chris Wilson (cherry picked from commit 55c5f1876e2329a938955967f5d45c814e50beb5) Conflicts: src/intel_batchbuffer.c src/intel_display.c (OGA: had to modify intel-sync to keep this working right) --- src/intel.h | 1 - src/intel_batchbuffer.c | 37 ++++++++++--------------------------- src/intel_batchbuffer.h | 1 - 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/intel.h b/src/intel.h index 91b63845..39e973c4 100644 --- a/src/intel.h +++ b/src/intel.h @@ -511,7 +511,6 @@ typedef struct intel_screen_private { /** Number of bytes to be emitted in the current BEGIN_BATCH. */ uint32_t batch_emitting; dri_bo *batch_bo; - dri_bo *last_batch_bo; /** Whether we're in a section of code that can't tolerate flushing */ Bool in_batch_atomic; /** Ending batch_used that was verified by intel_start_batch_atomic() */ diff --git a/src/intel_batchbuffer.c b/src/intel_batchbuffer.c index 3f8053b0..b529322e 100644 --- a/src/intel_batchbuffer.c +++ b/src/intel_batchbuffer.c @@ -102,11 +102,6 @@ void intel_batch_teardown(ScrnInfoPtr scrn) intel->batch_bo = NULL; } - if (intel->last_batch_bo != NULL) { - dri_bo_unreference(intel->last_batch_bo); - intel->last_batch_bo = NULL; - } - if (intel->vertex_bo) { dri_bo_unreference(intel->vertex_bo); intel->vertex_bo = NULL; @@ -267,36 +262,18 @@ void intel_batch_submit(ScrnInfoPtr scrn, int flush) free(entry); } - /* Save a ref to the last batch emitted, which we use for syncing - * in debug code. - */ - dri_bo_unreference(intel->last_batch_bo); - intel->last_batch_bo = intel->batch_bo; - intel->batch_bo = NULL; + if (intel->debug_flush & DEBUG_FLUSH_WAIT) + drm_intel_bo_wait_rendering(intel->batch_bo); + dri_bo_unreference(intel->batch_bo); intel_next_batch(scrn); - if (intel->debug_flush & DEBUG_FLUSH_WAIT) - intel_batch_wait_last(scrn); - if (intel->batch_commit_notify) intel->batch_commit_notify(intel); intel->current_batch = 0; } -/** Waits on the last emitted batchbuffer to be completed. */ -void intel_batch_wait_last(ScrnInfoPtr scrn) -{ - intel_screen_private *intel = intel_get_screen_private(scrn); - - /* Map it CPU write, which guarantees it's done. This is a completely - * non performance path, so we don't need anything better. - */ - drm_intel_gem_bo_map_gtt(intel->last_batch_bo); - drm_intel_gem_bo_unmap_gtt(intel->last_batch_bo); -} - void intel_debug_flush(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); @@ -311,10 +288,16 @@ void intel_debug_flush(ScrnInfoPtr scrn) void intel_sync(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); + int had; if (!scrn->vtSema || !intel->batch_bo || !intel->batch_ptr) return; + + /* XXX hack while we still need this for ums */ + had = intel->debug_flush & DEBUG_FLUSH_WAIT; + intel->debug_flush |= DEBUG_FLUSH_WAIT; intel_batch_submit(scrn, TRUE); - intel_batch_wait_last(scrn); + if (!had) + intel->debug_flush &= ~DEBUG_FLUSH_WAIT; } diff --git a/src/intel_batchbuffer.h b/src/intel_batchbuffer.h index cd6d8e8d..a88d7ba3 100644 --- a/src/intel_batchbuffer.h +++ b/src/intel_batchbuffer.h @@ -38,7 +38,6 @@ void intel_batch_teardown(ScrnInfoPtr scrn); void intel_batch_emit_flush(ScrnInfoPtr scrn); void intel_batch_do_flush(ScrnInfoPtr scrn); void intel_batch_submit(ScrnInfoPtr scrn, int flush); -void intel_batch_wait_last(ScrnInfoPtr scrn); static inline int intel_batch_space(intel_screen_private *intel) { -- cgit v1.2.3