Commit cc1557ca authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915/gem: Peek at the inflight context



If supported by the backend, we can quickly look at the context's
inflight engine rather than search along the active list to confirm.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarAndi Shyti <andi.shyti@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201229144114.31686-1-chris@chris-wilson.co.uk
parent 70960ab2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -423,6 +423,9 @@ static struct intel_engine_cs *active_engine(struct intel_context *ce)
	struct intel_engine_cs *engine = NULL;
	struct i915_request *rq;

	if (intel_context_has_inflight(ce))
		return intel_context_inflight(ce);

	if (!ce->timeline)
		return NULL;

+5 −0
Original line number Diff line number Diff line
@@ -191,6 +191,11 @@ static inline bool intel_context_is_closed(const struct intel_context *ce)
	return test_bit(CONTEXT_CLOSED_BIT, &ce->flags);
}

static inline bool intel_context_has_inflight(const struct intel_context *ce)
{
	return test_bit(COPS_HAS_INFLIGHT_BIT, &ce->ops->flags);
}

static inline bool intel_context_use_semaphores(const struct intel_context *ce)
{
	return test_bit(CONTEXT_USE_SEMAPHORES, &ce->flags);
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,10 @@ struct intel_context;
struct intel_ring;

struct intel_context_ops {
	unsigned long flags;
#define COPS_HAS_INFLIGHT_BIT 0
#define COPS_HAS_INFLIGHT BIT(COPS_HAS_INFLIGHT_BIT)

	int (*alloc)(struct intel_context *ce);

	int (*pre_pin)(struct intel_context *ce, struct i915_gem_ww_ctx *ww, void **vaddr);
+4 −0
Original line number Diff line number Diff line
@@ -2531,6 +2531,8 @@ static int execlists_context_alloc(struct intel_context *ce)
}

static const struct intel_context_ops execlists_context_ops = {
	.flags = COPS_HAS_INFLIGHT,

	.alloc = execlists_context_alloc,

	.pre_pin = execlists_context_pre_pin,
@@ -3441,6 +3443,8 @@ static void virtual_context_exit(struct intel_context *ce)
}

static const struct intel_context_ops virtual_context_ops = {
	.flags = COPS_HAS_INFLIGHT,

	.alloc = virtual_context_alloc,

	.pre_pin = virtual_context_pre_pin,