diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-08-09 19:25:16 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-08-09 20:18:30 +0100 |
commit | 4c60b1aaa255207eea2892d2d55b718db90d1ad8 (patch) | |
tree | 8d080b17064d7de4d686ecb01f44d6c62a555f7d /drivers/gpu/drm/i915/gt/intel_ringbuffer.c | |
parent | 72e277759340dacdf3d68b0b2b4eae267e601d55 (diff) | |
download | linux-4c60b1aaa255207eea2892d2d55b718db90d1ad8.tar.gz linux-4c60b1aaa255207eea2892d2d55b718db90d1ad8.tar.bz2 linux-4c60b1aaa255207eea2892d2d55b718db90d1ad8.zip |
drm/i915/gt: Make deferred context allocation explicit
Refactor the backends to handle the deferred context allocation in a
consistent manner, and allow calling it as an explicit first step in
pinning a context for the first time. This should make it easier for
backends to keep track of partially constructed contexts from
initialisation.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190809182518.20486-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gt/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/gt/intel_ringbuffer.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c index 78b4235f9c0f..6a2892033457 100644 --- a/drivers/gpu/drm/i915/gt/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/gt/intel_ringbuffer.c @@ -1480,16 +1480,16 @@ err_obj: return ERR_PTR(err); } -static int ring_context_pin(struct intel_context *ce) +static int ring_context_alloc(struct intel_context *ce) { struct intel_engine_cs *engine = ce->engine; - int err; /* One ringbuffer to rule them all */ GEM_BUG_ON(!engine->buffer); ce->ring = engine->buffer; - if (!ce->state && engine->context_size) { + GEM_BUG_ON(ce->state); + if (engine->context_size) { struct i915_vma *vma; vma = alloc_context_vma(engine); @@ -1499,6 +1499,13 @@ static int ring_context_pin(struct intel_context *ce) ce->state = vma; } + return 0; +} + +static int ring_context_pin(struct intel_context *ce) +{ + int err; + err = intel_context_active_acquire(ce); if (err) return err; @@ -1520,6 +1527,8 @@ static void ring_context_reset(struct intel_context *ce) } static const struct intel_context_ops ring_context_ops = { + .alloc = ring_context_alloc, + .pin = ring_context_pin, .unpin = ring_context_unpin, |