@@ -1703,6 +1703,8 @@ static void gem_context_register(struct i915_gem_context *ctx,
u32 id)
{
struct drm_i915_private *i915 = ctx->i915;
+ struct i915_gem_engines_iter it;
+ struct intel_context *ce;
void *old;
ctx->file_priv = fpriv;
@@ -1721,6 +1723,10 @@ static void gem_context_register(struct i915_gem_context *ctx,
list_add_tail(&ctx->link, &i915->gem.contexts.list);
spin_unlock(&i915->gem.contexts.lock);
+ for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it)
+ i915_drm_client_add_context(fpriv->client, ce);
+ i915_gem_context_unlock_engines(ctx);
+
/* And finally expose ourselves to userspace via the idr */
old = xa_store(&fpriv->context_xa, id, ctx, GFP_KERNEL);
WARN_ON(old);
@@ -145,4 +145,14 @@ void i915_drm_client_remove_object(struct drm_i915_gem_object *obj)
i915_drm_client_put(client);
}
+
+void i915_drm_client_add_context(struct i915_drm_client *client,
+ struct intel_context *ce)
+{
+ if (ce->state)
+ i915_drm_client_add_object(client, ce->state->obj);
+
+ if (ce->ring != ce->engine->legacy.ring && ce->ring->vma)
+ i915_drm_client_add_object(client, ce->ring->vma->obj);
+}
#endif
@@ -14,6 +14,7 @@
#include "i915_file_private.h"
#include "gem/i915_gem_object_types.h"
+#include "gt/intel_context_types.h"
#define I915_LAST_UABI_ENGINE_CLASS I915_ENGINE_CLASS_COMPUTE
@@ -72,6 +73,8 @@ void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
void i915_drm_client_add_object(struct i915_drm_client *client,
struct drm_i915_gem_object *obj);
void i915_drm_client_remove_object(struct drm_i915_gem_object *obj);
+void i915_drm_client_add_context(struct i915_drm_client *client,
+ struct intel_context *ce);
#else
static inline void i915_drm_client_add_object(struct i915_drm_client *client,
struct drm_i915_gem_object *obj)
@@ -82,6 +85,12 @@ static inline void i915_drm_client_add_object(struct i915_drm_client *client,
static inline void i915_drm_client_remove_object(struct drm_i915_gem_object *obj)
{
+}
+
+static inline void i915_drm_client_add_context(struct i915_drm_client *client,
+ struct intel_context *ce)
+{
+
}
#endif