diff options
author | Kenneth Graunke <[email protected]> | 2018-01-07 22:40:13 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-01-17 13:13:26 -0800 |
commit | d139b5e4ccf0da19f37428434bf0ef7c76c85049 (patch) | |
tree | a3010673e48c96d1f379a2e857040a6c0a12f8ef /src/mesa/drivers/dri | |
parent | 81ca8e69e327f07f57d597fa6ce23ff67b932de8 (diff) |
i965: Pass brw_growing_bo to grow_buffer().
Cleaner.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 877f68ee7cf..b4fcd92b6bd 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -288,16 +288,16 @@ replace_bo_in_reloc_list(struct brw_reloc_list *rlist, */ static void grow_buffer(struct brw_context *brw, - struct brw_bo **bo_ptr, - uint32_t **map_ptr, + struct brw_growing_bo *grow, unsigned existing_bytes, unsigned new_size) { struct intel_batchbuffer *batch = &brw->batch; struct brw_bufmgr *bufmgr = brw->bufmgr; + struct brw_bo *bo = grow->bo; - uint32_t *old_map = *map_ptr; - struct brw_bo *old_bo = *bo_ptr; + uint32_t *old_map = grow->map; + struct brw_bo *old_bo = grow->bo; struct brw_bo *new_bo = brw_bo_alloc(bufmgr, old_bo->name, new_size, old_bo->align); @@ -307,7 +307,7 @@ grow_buffer(struct brw_context *brw, /* Copy existing data to the new larger buffer */ if (batch->use_shadow_copy) { - new_map = realloc(*map_ptr, new_size); + new_map = realloc(old_map, new_size); } else { new_map = brw_bo_map(brw, new_bo, MAP_READ | MAP_WRITE); memcpy(new_map, old_map, existing_bytes); @@ -353,8 +353,8 @@ grow_buffer(struct brw_context *brw, /* Drop the *bo_ptr reference. This should free the old BO. */ brw_bo_unreference(old_bo); - *bo_ptr = new_bo; - *map_ptr = new_map; + grow->bo = new_bo; + grow->map = new_map; } void @@ -377,8 +377,7 @@ intel_batchbuffer_require_space(struct brw_context *brw, GLuint sz, const unsigned new_size = MIN2(batch->batch.bo->size + batch->batch.bo->size / 2, MAX_BATCH_SIZE); - grow_buffer(brw, &batch->batch.bo, &batch->batch.map, - batch_used, new_size); + grow_buffer(brw, &batch->batch, batch_used, new_size); batch->map_next = (void *) batch->batch.map + batch_used; assert(batch_used + sz < batch->batch.bo->size); } @@ -1079,8 +1078,7 @@ brw_state_batch(struct brw_context *brw, const unsigned new_size = MIN2(batch->state.bo->size + batch->state.bo->size / 2, MAX_STATE_SIZE); - grow_buffer(brw, &batch->state.bo, &batch->state.map, - batch->state_used, new_size); + grow_buffer(brw, &batch->state, batch->state_used, new_size); assert(offset + size < batch->state.bo->size); } |