[RFC 15/17] drm/i915: Migrate client to new owner on context create
From: Tvrtko Ursulin
Date: Wed Oct 19 2022 - 13:35:35 EST
From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Some usage models pass a drm file descriptor from a creating process to
the client which will actually use it.
Use the core drm helper on GEM context create to account for this and
ensure client's resource usage is tracked in the correct cgroup.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index 1e29b1e6d186..5f6af306e147 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -69,6 +69,7 @@
#include <linux/nospec.h>
#include <drm/drm_cache.h>
+#include <drm/drm_clients.h>
#include <drm/drm_syncobj.h>
#include "gt/gen6_ppgtt.h"
@@ -2300,6 +2301,8 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
args->ctx_id = id;
drm_dbg(&i915->drm, "HW context %d created\n", args->ctx_id);
+ drm_clients_migrate(file);
+
return 0;
err_pc:
--
2.34.1