[PATCH 13/18] drm/i915/gem: Inline __assign_ppgtt into its one caller

Jason Ekstrand jason at jlekstrand.net
Thu Apr 15 16:41:05 UTC 2021


We can also ignore some of the clean-up because we always do it on a
freshly created context and there's no way that it already has a VM set.
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 6c69bf90dc80b..28d304f64def4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -787,21 +787,11 @@ __set_ppgtt(struct i915_gem_context *ctx, struct i915_address_space *vm)
 	return old;
 }
 
-static void __assign_ppgtt(struct i915_gem_context *ctx,
-			   struct i915_address_space *vm)
-{
-	if (vm == rcu_access_pointer(ctx->vm))
-		return;
-
-	vm = __set_ppgtt(ctx, vm);
-	if (vm)
-		i915_vm_close(vm);
-}
-
 static struct i915_gem_context *
 i915_gem_create_context(struct drm_i915_private *i915, unsigned int flags)
 {
 	struct i915_gem_context *ctx;
+	struct i915_address_space *vm;
 	int ret;
 
 	if (flags & I915_CONTEXT_CREATE_FLAGS_SINGLE_TIMELINE &&
@@ -824,7 +814,8 @@ i915_gem_create_context(struct drm_i915_private *i915, unsigned int flags)
 		}
 
 		mutex_lock(&ctx->mutex);
-		__assign_ppgtt(ctx, &ppgtt->vm);
+		vm = __set_ppgtt(ctx, &ppgtt->vm);
+		GEM_BUG_ON(vm);
 		mutex_unlock(&ctx->mutex);
 
 		i915_vm_put(&ppgtt->vm);
-- 
2.31.1



More information about the Intel-gfx-trybot mailing list