Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: miku@iki.fi
Subject: [PATCH 2/2] drm/i915: Return -ENOENT for unknown contexts
Date: Fri, 14 Mar 2014 16:22:11 +0200	[thread overview]
Message-ID: <1394806931-7399-2-git-send-email-mika.kuoppala@intel.com> (raw)
In-Reply-To: <1394806931-7399-1-git-send-email-mika.kuoppala@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.

Signed-off-by: Mika Kuoppala <mika.kuoppala@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 b5a5837..a8e625d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -573,8 +573,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

  reply	other threads:[~2014-03-14 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 14:22 [PATCH 1/2] drm/i915: Switch to fake context on older gens Mika Kuoppala
2014-03-14 14:22 ` Mika Kuoppala [this message]
2014-03-14 15:38   ` [PATCH 2/2] drm/i915: Return -ENOENT for unknown contexts Daniel Vetter
2014-03-17 17:09     ` [PATCH] tests/gem_reset_stats: run non hw context tests also on older gens Mika Kuoppala
2014-03-24 17:13       ` Daniel Vetter
2014-03-14 14:43 ` [PATCH 1/2] drm/i915: Switch to fake context " Jani Nikula
2014-03-14 15:42   ` Daniel Vetter
2014-03-14 15:46     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394806931-7399-2-git-send-email-mika.kuoppala@intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=miku@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox