From 99354e82da8172eebb5f682481b7b4fdefe3c6c9 Mon Sep 17 00:00:00 2001 From: Dave Gordon Date: Fri, 4 Sep 2015 14:03:56 +0100 Subject: drm/i915/guc: Tidy up GuC proc/ctx descriptor setup For: VIZ-2021 Signed-off-by: Dave Gordon --- drivers/gpu/drm/i915/i915_debugfs.c | 3 ++- drivers/gpu/drm/i915/i915_guc_submission.c | 29 ++++++++++++----------------- drivers/gpu/drm/i915/intel_guc.h | 16 +++++++++------- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index b4a9e4b8e83a..606d555489ac 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2675,7 +2675,8 @@ static void i915_guc_client_info(struct seq_file *m, seq_printf(m, "\tPriority %d, GuC ctx index: %u, PD offset 0x%x\n", client->priority, client->ctx_index, client->proc_desc_offset); seq_printf(m, "\tDoorbell id %d, offset: 0x%x, cookie 0x%x\n", - client->doorbell_id, client->doorbell_offset, client->cookie); + client->doorbell_id, client->doorbell_offset, + client->doorbell_cookie); seq_printf(m, "\tWQ size %d, offset: 0x%x, tail %d\n", client->wq_size, client->wq_offset, client->wq_tail); diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c b/drivers/gpu/drm/i915/i915_guc_submission.c index ae1f58d073f2..67e6e88fa8df 100644 --- a/drivers/gpu/drm/i915/i915_guc_submission.c +++ b/drivers/gpu/drm/i915/i915_guc_submission.c @@ -206,11 +206,11 @@ static int guc_ring_doorbell(struct i915_guc_client *gc) /* current cookie */ db_cmp.db_status = GUC_DOORBELL_ENABLED; - db_cmp.cookie = gc->cookie; + db_cmp.cookie = gc->doorbell_cookie; /* cookie to be updated */ db_exc.db_status = GUC_DOORBELL_ENABLED; - db_exc.cookie = gc->cookie + 1; + db_exc.cookie = gc->doorbell_cookie + 1; if (db_exc.cookie == 0) db_exc.cookie = 1; @@ -225,7 +225,7 @@ static int guc_ring_doorbell(struct i915_guc_client *gc) /* if the exchange was successfully executed */ if (db_ret.value_qw == db_cmp.value_qw) { /* db was successfully rung */ - gc->cookie = db_exc.cookie; + gc->doorbell_cookie = db_exc.cookie; ret = 0; break; } @@ -404,7 +404,7 @@ static void guc_init_ctx_desc(struct intel_guc *guc, */ obj = ctx->engine[i].state; if (!obj) - break; /* XXX: continue? */ + continue; ctx_desc = intel_lr_context_descriptor(ctx, engine); lrc->context_desc = (u32)ctx_desc; @@ -428,22 +428,16 @@ static void guc_init_ctx_desc(struct intel_guc *guc, WARN_ON(desc.engines_used == 0); /* - * The CPU address is only needed at certain points, so kmap_atomic on - * demand instead of storing it in the ctx descriptor. + * The CPU address is only needed at certain points, so kmap_atomic + * on demand instead of storing it in the ctx descriptor. * XXX: May make debug easier to have it mapped */ desc.db_trigger_cpu = 0; - desc.db_trigger_uk = client->doorbell_offset + - i915_gem_obj_ggtt_offset(client->client_obj); - desc.db_trigger_phy = client->doorbell_offset + - sg_dma_address(client->client_obj->pages->sgl); - - desc.process_desc = client->proc_desc_offset + - i915_gem_obj_ggtt_offset(client->client_obj); - - desc.wq_addr = client->wq_offset + - i915_gem_obj_ggtt_offset(client->client_obj); - + desc.db_trigger_phy = sg_dma_address(client->client_obj->pages->sgl) + + client->doorbell_offset; + desc.db_trigger_uk = client->client_gtt + client->doorbell_offset; + desc.process_desc = client->client_gtt + client->proc_desc_offset; + desc.wq_addr = client->client_gtt + client->wq_offset; desc.wq_size = client->wq_size; /* @@ -729,6 +723,7 @@ static struct i915_guc_client *guc_client_alloc(struct drm_device *dev, goto err; client->client_obj = obj; + client->client_gtt = i915_gem_obj_ggtt_offset(obj); client->wq_offset = GUC_DB_SIZE; client->wq_size = GUC_WQ_SIZE; diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h index 73002e901ff2..024907fec1a7 100644 --- a/drivers/gpu/drm/i915/intel_guc.h +++ b/drivers/gpu/drm/i915/intel_guc.h @@ -28,20 +28,22 @@ #include "i915_guc_reg.h" struct i915_guc_client { - struct drm_i915_gem_object *client_obj; - struct intel_context *owner; struct intel_guc *guc; + struct intel_context *owner; + struct drm_i915_gem_object *client_obj; + uint64_t client_gtt; /* GTT offset of client_obj */ uint32_t priority; uint32_t ctx_index; - uint32_t proc_desc_offset; - uint32_t doorbell_offset; - uint32_t cookie; + uint32_t doorbell_offset; /* offset within client obj */ + uint32_t proc_desc_offset; /* offset within client_obj */ + uint32_t wq_offset; /* offset within client_obj */ + uint32_t wq_size; + uint32_t doorbell_cookie; uint16_t doorbell_id; uint16_t padding; /* Maintain alignment */ - uint32_t wq_offset; - uint32_t wq_size; + spinlock_t wq_lock; /* Protects all data below */ uint32_t wq_tail; uint32_t wq_head; -- cgit v1.2.3