diff options
author | Chris Wilson <[email protected]> | 2011-02-09 10:00:09 +0000 |
---|---|---|
committer | Chris Wilson <[email protected]> | 2011-02-21 12:59:34 +0000 |
commit | 40ee15407ab626f466a12c239fc39cb872bec804 (patch) | |
tree | a769cb4fa2132c0c8b13f0033f4c3954dd1ebd86 /src/mesa/drivers/dri | |
parent | abb37861d9f3310fe2d16194d893682092f41087 (diff) |
intel: Replace the bo for a complete update
Rather than performing a blit to completely overwrite a busy bo, simply
discard it and create a new one with the fresh data.
Signed-off-by: Chris Wilson <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 79d9075daa4..d80d99bca57 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -223,10 +223,17 @@ intel_bufferobj_subdata(struct gl_context * ctx, } memcpy((char *)intel_obj->sys_buffer + offset, data, size); } else { - /* Flush any existing batchbuffer that might reference this data. */ - if (intel->gen < 6) { - if (drm_intel_bo_busy(intel_obj->buffer) || - drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { + bool busy = + drm_intel_bo_busy(intel_obj->buffer) || + drm_intel_bo_references(intel->batch->buf, intel_obj->buffer); + + /* replace the current busy bo with fresh data */ + if (busy && size == intel_obj->Base.Size) { + drm_intel_bo_unreference(intel_obj->buffer); + intel_bufferobj_alloc_buffer(intel, intel_obj); + drm_intel_bo_subdata(intel_obj->buffer, 0, size, data); + } else if (intel->gen < 6) { + if (busy) { drm_intel_bo *temp_bo; temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64); @@ -243,6 +250,7 @@ intel_bufferobj_subdata(struct gl_context * ctx, drm_intel_bo_subdata(intel_obj->buffer, offset, size, data); } } else { + /* Can't use the blit to modify the buffer in the middle of batch. */ if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { intel_batchbuffer_flush(intel->batch); } @@ -393,8 +401,7 @@ intel_bufferobj_map_range(struct gl_context * ctx, (access & GL_MAP_INVALIDATE_BUFFER_BIT) && drm_intel_bo_busy(intel_obj->buffer)) { drm_intel_bo_unreference(intel_obj->buffer); - intel_obj->buffer = drm_intel_bo_alloc(intel->bufmgr, "bufferobj", - intel_obj->Base.Size, 64); + intel_bufferobj_alloc_buffer(intel, intel_obj); } /* If the user is mapping a range of an active buffer object but |