aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-01-06 20:34:35 -0800
committerKenneth Graunke <[email protected]>2018-01-17 13:13:26 -0800
commit81ca8e69e327f07f57d597fa6ce23ff67b932de8 (patch)
tree26ade56a38bb6cd91df4b8c73bd94bee50172d37 /src/mesa
parent02c1c25b1a620a336f2e18d39bba188635363f24 (diff)
i965: Make a helper for recreating growing buffers.
Now that we have two of these, we're duplicating a bunch of this logic. The next commit will add more logic, which would make the duplication seem worse. This ends up setting EXEC_OBJECT_CAPTURE on the batch, which isn't necessary (it's already captured), but it should be harmless. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index bfb50053e73..877f68ee7cf 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -161,32 +161,36 @@ add_exec_bo(struct intel_batchbuffer *batch, struct brw_bo *bo)
}
static void
-intel_batchbuffer_reset(struct brw_context *brw)
+recreate_growing_buffer(struct brw_context *brw,
+ struct brw_growing_bo *grow,
+ const char *name, unsigned size)
{
struct intel_screen *screen = brw->screen;
struct intel_batchbuffer *batch = &brw->batch;
struct brw_bufmgr *bufmgr = screen->bufmgr;
+ grow->bo = brw_bo_alloc(bufmgr, name, size, 4096);
+ grow->bo->kflags = can_do_exec_capture(screen) ? EXEC_OBJECT_CAPTURE : 0;
+
+ if (!batch->use_shadow_copy)
+ grow->map = brw_bo_map(brw, grow->bo, MAP_READ | MAP_WRITE);
+}
+
+static void
+intel_batchbuffer_reset(struct brw_context *brw)
+{
+ struct intel_batchbuffer *batch = &brw->batch;
+
if (batch->last_bo != NULL) {
brw_bo_unreference(batch->last_bo);
batch->last_bo = NULL;
}
batch->last_bo = batch->batch.bo;
- batch->batch.bo = brw_bo_alloc(bufmgr, "batchbuffer", BATCH_SZ, 4096);
- if (!batch->use_shadow_copy) {
- batch->batch.map =
- brw_bo_map(brw, batch->batch.bo, MAP_READ | MAP_WRITE);
- }
+ recreate_growing_buffer(brw, &batch->batch, "batchbuffer", BATCH_SZ);
batch->map_next = batch->batch.map;
- batch->state.bo = brw_bo_alloc(bufmgr, "statebuffer", STATE_SZ, 4096);
- batch->state.bo->kflags =
- can_do_exec_capture(screen) ? EXEC_OBJECT_CAPTURE : 0;
- if (!batch->use_shadow_copy) {
- batch->state.map =
- brw_bo_map(brw, batch->state.bo, MAP_READ | MAP_WRITE);
- }
+ recreate_growing_buffer(brw, &batch->state, "statebuffer", STATE_SZ);
/* Avoid making 0 a valid state offset - otherwise the decoder will try
* and decode data when we use offset 0 as a null pointer.