drm/i915: Move over to intel_context_lookup()

In preparation for an ever growing number of engines and so ever
increasing static array of HW contexts within the GEM context, move the
array over to an rbtree, allocated upon first use.

Unfortunately, this imposes an rbtree lookup at a few frequent callsites,
but we should be able to mitigate those by moving over to using the HW
context as our primary type and so only incur the lookup on the boundary
with the user GEM context and engines.

v2: Check for no HW context in guc_stage_desc_init

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190308132522.21573-4-chris@chris-wilson.co.uk
此提交包含在:
Chris Wilson
2019-03-08 13:25:19 +00:00
父節點 4dc84b77b0
當前提交 c4d52feb2c
共有 21 個檔案被更改,包括 310 行新增96 行删除

查看文件

@@ -4655,15 +4655,20 @@ static int __intel_engines_record_defaults(struct drm_i915_private *i915)
}
for_each_engine(engine, i915, id) {
struct intel_context *ce;
struct i915_vma *state;
void *vaddr;
GEM_BUG_ON(to_intel_context(ctx, engine)->pin_count);
ce = intel_context_lookup(ctx, engine);
if (!ce)
continue;
state = to_intel_context(ctx, engine)->state;
state = ce->state;
if (!state)
continue;
GEM_BUG_ON(ce->pin_count);
/*
* As we will hold a reference to the logical state, it will
* not be torn down with the context, and importantly the