From da8f052560120010b7f37a300f03c0847cca3aa5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 22 Oct 2011 10:33:24 -0700 Subject: [PATCH] intel: Return error value from intel_batchbuffer_flush(). This will let the caller do something sensible on error, if it cares. Reviewed-by: Kenneth Graunke Acked-by: Paul Berry --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 14 ++++++++++---- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 2d99eeca5e0..6991db8d55f 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -120,7 +120,7 @@ intel_batchbuffer_free(struct intel_context *intel) /* TODO: Push this whole function into bufmgr. */ -static void +static int do_flush_locked(struct intel_context *intel) { struct intel_batchbuffer *batch = &intel->batch; @@ -163,12 +163,16 @@ do_flush_locked(struct intel_context *intel) exit(1); } intel->vtbl.new_batch(intel); + + return ret; } -void +int _intel_batchbuffer_flush(struct intel_context *intel, const char *file, int line) { + int ret; + /* No batch should be emitted that uses a mapped region, because that would * cause the map to be incoherent with GPU rendering done by the * batchbuffer. To ensure that condition, we assert a condition that is @@ -177,7 +181,7 @@ _intel_batchbuffer_flush(struct intel_context *intel, assert(intel->num_mapped_regions == 0); if (intel->batch.used == 0) - return; + return 0; if (intel->first_post_swapbuffers_batch == NULL) { intel->first_post_swapbuffers_batch = intel->batch.bo; @@ -205,7 +209,7 @@ _intel_batchbuffer_flush(struct intel_context *intel, /* Check that we didn't just wrap our batchbuffer at a bad time. */ assert(!intel->no_batch_wrap); - do_flush_locked(intel); + ret = do_flush_locked(intel); if (unlikely(INTEL_DEBUG & DEBUG_SYNC)) { fprintf(stderr, "waiting for idle\n"); @@ -215,6 +219,8 @@ _intel_batchbuffer_flush(struct intel_context *intel, /* Reset the buffer: */ intel_batchbuffer_reset(intel); + + return ret; } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 228c32df53c..e5e5bd44f4c 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -15,8 +15,8 @@ void intel_batchbuffer_free(struct intel_context *intel); void intel_batchbuffer_save_state(struct intel_context *intel); void intel_batchbuffer_reset_to_saved(struct intel_context *intel); -void _intel_batchbuffer_flush(struct intel_context *intel, - const char *file, int line); +int _intel_batchbuffer_flush(struct intel_context *intel, + const char *file, int line); #define intel_batchbuffer_flush(intel) \ _intel_batchbuffer_flush(intel, __FILE__, __LINE__) -- 2.30.2