diff options
author | Eric Anholt <[email protected]> | 2012-02-24 15:05:02 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-03-21 12:45:06 -0700 |
commit | f97da4ed71f723bc895ca38b81ac13afe3b7175a (patch) | |
tree | 3c9b4f5c855682747ec836257dc765434486ce1c /src/mesa | |
parent | 2222aa06e16dbfe4c29e05a1189bce80680aba19 (diff) |
i965: Avoid flushing the batch for busy BOs for ARB_mbr with INVALIDATE_BUFFER.
Unigine Tropics uses INVALIDATE_BUFFER and not UNSYNCHRONIZED to reset
the buffer object when its streaming wraps. Don't penalize it by
flushing the batch at the wrap point, just allocate a new BO and get
to using it.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 600f01ca6f0..e55a8fe937b 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -314,27 +314,32 @@ intel_bufferobj_map_range(struct gl_context * ctx, intel_obj->sys_buffer = NULL; } - /* If the mapping is synchronized with other GL operations, flush - * the batchbuffer so that GEM knows about the buffer access for later - * syncing. - */ - if (!(access & GL_MAP_UNSYNCHRONIZED_BIT) && - drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) - intel_flush(ctx); - if (intel_obj->buffer == NULL) { obj->Pointer = NULL; return NULL; } - /* If the user doesn't care about existing buffer contents and mapping - * would cause us to block, then throw out the old buffer. + /* If the access is synchronized (like a normal buffer mapping), then get + * things flushed out so the later mapping syncs appropriately through GEM. + * If the user doesn't care about existing buffer contents and mapping would + * cause us to block, then throw out the old buffer. + * + * If they set INVALIDATE_BUFFER, we can pitch the current contents to + * achieve the required synchronization. */ - if (!(access & GL_MAP_UNSYNCHRONIZED_BIT) && - (access & GL_MAP_INVALIDATE_BUFFER_BIT) && - drm_intel_bo_busy(intel_obj->buffer)) { - drm_intel_bo_unreference(intel_obj->buffer); - intel_bufferobj_alloc_buffer(intel, intel_obj); + if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) { + if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) { + if (access & GL_MAP_INVALIDATE_BUFFER_BIT) { + drm_intel_bo_unreference(intel_obj->buffer); + intel_bufferobj_alloc_buffer(intel, intel_obj); + } else { + intel_flush(ctx); + } + } else if (drm_intel_bo_busy(intel_obj->buffer) && + (access & GL_MAP_INVALIDATE_BUFFER_BIT)) { + drm_intel_bo_unreference(intel_obj->buffer); + intel_bufferobj_alloc_buffer(intel, intel_obj); + } } /* If the user is mapping a range of an active buffer object but |