Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01278cb1 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915: Move fiddling with engine->last_retired_context



Move the knowledge about resetting the current context tracking on the
engine from inside i915_gem_context.c into intel_engine_cs.c

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180517212633.24934-2-chris@chris-wilson.co.uk
parent 4e0d64db
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -514,16 +514,8 @@ void i915_gem_contexts_lost(struct drm_i915_private *dev_priv)

	lockdep_assert_held(&dev_priv->drm.struct_mutex);

	for_each_engine(engine, dev_priv, id) {
		engine->legacy_active_context = NULL;
		engine->legacy_active_ppgtt = NULL;

		if (!engine->last_retired_context)
			continue;

		intel_context_unpin(engine->last_retired_context, engine);
		engine->last_retired_context = NULL;
	}
	for_each_engine(engine, dev_priv, id)
		intel_engine_lost_context(engine);
}

void i915_gem_contexts_fini(struct drm_i915_private *i915)
+23 −0
Original line number Diff line number Diff line
@@ -1096,6 +1096,29 @@ void intel_engines_unpark(struct drm_i915_private *i915)
	}
}

/**
 * intel_engine_lost_context: called when the GPU is reset into unknown state
 * @engine: the engine
 *
 * We have either reset the GPU or otherwise about to lose state tracking of
 * the current GPU logical state (e.g. suspend). On next use, it is therefore
 * imperative that we make no presumptions about the current state and load
 * from scratch.
 */
void intel_engine_lost_context(struct intel_engine_cs *engine)
{
	struct i915_gem_context *ctx;

	lockdep_assert_held(&engine->i915->drm.struct_mutex);

	engine->legacy_active_context = NULL;
	engine->legacy_active_ppgtt = NULL;

	ctx = fetch_and_zero(&engine->last_retired_context);
	if (ctx)
		intel_context_unpin(ctx, engine);
}

bool intel_engine_can_store_dword(struct intel_engine_cs *engine)
{
	switch (INTEL_GEN(engine->i915)) {
+1 −0
Original line number Diff line number Diff line
@@ -1053,6 +1053,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine);
bool intel_engines_are_idle(struct drm_i915_private *dev_priv);

bool intel_engine_has_kernel_context(const struct intel_engine_cs *engine);
void intel_engine_lost_context(struct intel_engine_cs *engine);

void intel_engines_park(struct drm_i915_private *i915);
void intel_engines_unpark(struct drm_i915_private *i915);