[Intel-gfx] [PATCH] drm/i915: Return -ENOENT for unknown contexts
Mika Kuoppala
mika.kuoppala at linux.intel.com
Wed Apr 16 10:58:09 CEST 2014
From: Mika Kuoppala <mika.kuoppala at linux.intel.com>
If hw_contexts are disabled, we always return the per file
descriptor default context stats. Make sure that the context
is correctly given and fail accordingly if not.
Testcase: igt/gem_reset_stats/params
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
drivers/gpu/drm/i915/i915_gem_context.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 30b355a..85c890c 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -582,8 +582,12 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
{
struct i915_hw_context *ctx;
- if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev))
+ if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev)) {
+ if (id != DEFAULT_CONTEXT_ID)
+ return ERR_PTR(-ENOENT);
+
return file_priv->private_default_ctx;
+ }
ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
if (!ctx)
--
1.7.9.5
More information about the Intel-gfx
mailing list