@@ -90,6 +90,14 @@ static const char *get_tiling_flag(struct drm_i915_gem_object *obj)
}
}
+static const char *get_context_flag(struct drm_i915_gem_object *obj)
+{
+ if (obj->ctx)
+ return "c";
+ else
+ return " ";
+}
+
static const char *cache_level_str(int type)
{
switch (type) {
@@ -103,10 +111,11 @@ static const char *cache_level_str(int type)
static void
describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
{
- seq_printf(m, "%p: %s%s %8zdKiB %02x %02x %d %d %d%s%s%s",
+ seq_printf(m, "%p: %s%s%s %8zdKiB %02x %02x %d %d %d%s%s%s",
&obj->base,
get_pin_flag(obj),
get_tiling_flag(obj),
+ get_context_flag(obj),
obj->base.size / 1024,
obj->base.read_domains,
obj->base.write_domain,
@@ -1214,6 +1214,8 @@ struct drm_i915_gem_object {
/** for phy allocated objects */
struct drm_i915_gem_phys_object *phys_obj;
+
+ struct i915_hw_context *ctx;
};
#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)
@@ -150,6 +150,8 @@ create_hw_context(struct drm_device *dev,
return ERR_PTR(-ENOMEM);
}
+ ctx->obj->ctx = ctx;
+
/* The ring associated with the context object is handled by the normal
* object tracking code. We give an initial ring value simple to pass an
* assertion in the context switch code.
It's really simple to keep track of objects which back the context. Doing so allows will be really helpful in properly refcounting contexts Daniel: please see the last patch in the series before commenting on this patch. I'm open to other ideas, but this seems like the simplest way to do it, and storing the context info in the object has never been offensive to me. Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_debugfs.c | 11 ++++++++++- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_gem_context.c | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-)