Commit e28e404c authored by Dave Gordon's avatar Dave Gordon Committed by Daniel Vetter

drm/i915: tidy up a few leftovers

There are a few bits of code which the transformations implemented by
the previous patch reveal to be suboptimal, once the notion of a per-
ring default context has gone away. So this tidies up the leftovers.

It could have been squashed into the previous patch, but that would have
made that patch less clearly a simple transformation. In particular, any
change which alters the code block structure or indentation has been
deferred into this separate patch, because such things tend to make
diffs more difficult to read.

v4:	Rebased
Signed-off-by: default avatarDave Gordon <david.s.gordon@intel.com>
Reviewed-by: default avatarNick Hoath <nicholas.hoath@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453230175-19330-4-git-send-email-david.s.gordon@intel.comSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent ed54c1a1
...@@ -1960,11 +1960,8 @@ static int i915_context_status(struct seq_file *m, void *unused) ...@@ -1960,11 +1960,8 @@ static int i915_context_status(struct seq_file *m, void *unused)
seq_puts(m, "HW context "); seq_puts(m, "HW context ");
describe_ctx(m, ctx); describe_ctx(m, ctx);
for_each_ring(ring, dev_priv, i) { if (ctx == dev_priv->kernel_context)
if (dev_priv->kernel_context == ctx) seq_printf(m, "(kernel context) ");
seq_printf(m, "(default context %s) ",
ring->name);
}
if (i915.enable_execlists) { if (i915.enable_execlists) {
seq_putc(m, '\n'); seq_putc(m, '\n');
...@@ -2056,12 +2053,10 @@ static int i915_dump_lrc(struct seq_file *m, void *unused) ...@@ -2056,12 +2053,10 @@ static int i915_dump_lrc(struct seq_file *m, void *unused)
if (ret) if (ret)
return ret; return ret;
list_for_each_entry(ctx, &dev_priv->context_list, link) { list_for_each_entry(ctx, &dev_priv->context_list, link)
for_each_ring(ring, dev_priv, i) { if (ctx != dev_priv->kernel_context)
if (dev_priv->kernel_context != ctx) for_each_ring(ring, dev_priv, i)
i915_dump_lrc_obj(m, ctx, ring); i915_dump_lrc_obj(m, ctx, ring);
}
}
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
......
...@@ -2679,10 +2679,8 @@ void i915_gem_request_free(struct kref *req_ref) ...@@ -2679,10 +2679,8 @@ void i915_gem_request_free(struct kref *req_ref)
i915_gem_request_remove_from_client(req); i915_gem_request_remove_from_client(req);
if (ctx) { if (ctx) {
if (i915.enable_execlists) { if (i915.enable_execlists && ctx != req->i915->kernel_context)
if (ctx != req->i915->kernel_context) intel_lr_context_unpin(req);
intel_lr_context_unpin(req);
}
i915_gem_context_unreference(ctx); i915_gem_context_unreference(ctx);
} }
......
...@@ -686,16 +686,10 @@ static int execlists_move_to_gpu(struct drm_i915_gem_request *req, ...@@ -686,16 +686,10 @@ static int execlists_move_to_gpu(struct drm_i915_gem_request *req,
int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request) int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request)
{ {
int ret; int ret = 0;
request->ringbuf = request->ctx->engine[request->ring->id].ringbuf; request->ringbuf = request->ctx->engine[request->ring->id].ringbuf;
if (request->ctx != request->i915->kernel_context) {
ret = intel_lr_context_pin(request);
if (ret)
return ret;
}
if (i915.enable_guc_submission) { if (i915.enable_guc_submission) {
/* /*
* Check that the GuC has space for the request before * Check that the GuC has space for the request before
...@@ -709,7 +703,10 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request ...@@ -709,7 +703,10 @@ int intel_logical_ring_alloc_request_extras(struct drm_i915_gem_request *request
return ret; return ret;
} }
return 0; if (request->ctx != request->i915->kernel_context)
ret = intel_lr_context_pin(request);
return ret;
} }
static int logical_ring_wait_for_space(struct drm_i915_gem_request *req, static int logical_ring_wait_for_space(struct drm_i915_gem_request *req,
...@@ -2391,22 +2388,21 @@ void intel_lr_context_free(struct intel_context *ctx) ...@@ -2391,22 +2388,21 @@ void intel_lr_context_free(struct intel_context *ctx)
{ {
int i; int i;
for (i = 0; i < I915_NUM_RINGS; i++) { for (i = I915_NUM_RINGS; --i >= 0; ) {
struct intel_ringbuffer *ringbuf = ctx->engine[i].ringbuf;
struct drm_i915_gem_object *ctx_obj = ctx->engine[i].state; struct drm_i915_gem_object *ctx_obj = ctx->engine[i].state;
if (ctx_obj) { if (!ctx_obj)
struct intel_ringbuffer *ringbuf = continue;
ctx->engine[i].ringbuf;
struct intel_engine_cs *ring = ringbuf->ring;
if (ctx == ctx->i915->kernel_context) { if (ctx == ctx->i915->kernel_context) {
intel_unpin_ringbuffer_obj(ringbuf); intel_unpin_ringbuffer_obj(ringbuf);
i915_gem_object_ggtt_unpin(ctx_obj); i915_gem_object_ggtt_unpin(ctx_obj);
}
WARN_ON(ctx->engine[ring->id].pin_count);
intel_ringbuffer_free(ringbuf);
drm_gem_object_unreference(&ctx_obj->base);
} }
WARN_ON(ctx->engine[i].pin_count);
intel_ringbuffer_free(ringbuf);
drm_gem_object_unreference(&ctx_obj->base);
} }
} }
...@@ -2481,7 +2477,7 @@ static void lrc_setup_hardware_status_page(struct intel_engine_cs *ring, ...@@ -2481,7 +2477,7 @@ static void lrc_setup_hardware_status_page(struct intel_engine_cs *ring,
*/ */
int intel_lr_context_deferred_alloc(struct intel_context *ctx, int intel_lr_context_deferred_alloc(struct intel_context *ctx,
struct intel_engine_cs *ring) struct intel_engine_cs *ring)
{ {
struct drm_device *dev = ring->dev; struct drm_device *dev = ring->dev;
struct drm_i915_gem_object *ctx_obj; struct drm_i915_gem_object *ctx_obj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment