From f5216b25e0c2aa16653c5951089ca5f8dfb9b00c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 3 Apr 2017 17:32:19 -0700 Subject: i965: Just use a uint32_t context handle rather than a malloc'd wrapper. drm_bacon_context is a malloc'd struct containing a uint32_t context ID and a pointer back to the bufmgr. The bufmgr pointer is pretty useless, as everybody already has brw->bufmgr. At that point...we may as well just use the ctx_id handle directly. A number of places already had to call drm_bacon_gem_context_get_id() to extract the ID anyway. Now they just have it. Reviewed-by: Chris Wilson Acked-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/mesa/drivers/dri/i965/intel_batchbuffer.c') diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 56811278cee..020c04bbdeb 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -384,7 +384,7 @@ brw_new_batch(struct brw_context *brw) * would otherwise be stored in the context (which for all intents and * purposes means everything). */ - if (brw->hw_ctx == NULL) + if (brw->hw_ctx == 0) brw->ctx.NewDriverState |= BRW_NEW_CONTEXT; brw->ctx.NewDriverState |= BRW_NEW_BATCH; @@ -538,15 +538,12 @@ add_exec_bo(struct intel_batchbuffer *batch, drm_bacon_bo *bo) static int execbuffer(int fd, struct intel_batchbuffer *batch, - drm_bacon_context *ctx, + uint32_t ctx_id, int used, int in_fence, int *out_fence, int flags) { - uint32_t ctx_id = 0; - drm_bacon_gem_context_get_id(ctx, &ctx_id); - struct drm_i915_gem_execbuffer2 execbuf = { .buffers_ptr = (uintptr_t) batch->exec_objects, .buffer_count = batch->exec_count, @@ -623,7 +620,7 @@ do_flush_locked(struct brw_context *brw, int in_fence_fd, int *out_fence_fd) flags |= I915_EXEC_GEN7_SOL_RESET; if (ret == 0) { - void *hw_ctx = batch->ring != RENDER_RING ? NULL : brw->hw_ctx; + uint32_t hw_ctx = batch->ring == RENDER_RING ? brw->hw_ctx : 0; /* Add the batch itself to the end of the validation list */ add_exec_bo(batch, batch->bo); -- cgit v1.2.3