All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <bwidawsk@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [RFC] [PATCH 4/8] drm/i915/context: logical context free
Date: Sat, 26 Feb 2011 10:30:14 -0800	[thread overview]
Message-ID: <1298745018-5937-5-git-send-email-bwidawsk@gmail.com> (raw)
In-Reply-To: <1298745018-5937-1-git-send-email-bwidawsk@gmail.com>

Another review only commit. The opposite of context alloc is context
free. Context free needs to employ context_fini (the opposite of context
init) which will switch back to the default context if needed. This
function is not currently implemented.
---
 drivers/gpu/drm/i915/i915_context.c |   37 +++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_context.c b/drivers/gpu/drm/i915/i915_context.c
index 490aa5a..babceca 100644
--- a/drivers/gpu/drm/i915/i915_context.c
+++ b/drivers/gpu/drm/i915/i915_context.c
@@ -180,6 +180,43 @@ id_out:
 	return ret;
 }
 
+static void logical_context_fini(struct drm_i915_gem_context *ctx)
+{
+
+}
+
+static int logical_context_free(struct drm_file *file, uint32_t id)
+{
+	struct drm_i915_gem_context *ctx;
+
+	if (WARN_ON(id == DEFAULT_CONTEXT_ID))
+		return 0;
+
+	/*  ref and pin the object */
+	ctx = i915_get_context(file, id);
+	if (!ctx) {
+		DRM_ERROR("Couldn't find context %d", id);
+		return -EINVAL;
+	}
+
+	i915_release_context(ctx);
+
+	mutex_lock(&ctx->dev->struct_mutex);
+
+	logical_context_fini(ctx);
+	drm_gem_object_unreference(&ctx->obj->base);
+
+	mutex_unlock(&ctx->dev->struct_mutex);
+
+	context_destroy_id(ctx);
+
+	ctx->file = NULL;
+	ctx->dev = NULL;
+	kfree(ctx);
+
+	return 0;
+}
+
 /**
  * i915_context_create_ioctl() - not yet supported
  */
-- 
1.7.3.4

  parent reply	other threads:[~2011-02-26 18:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26 18:30 [RFC] [PATCH 0/8] drm/i915/context Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 1/8] drm/i915/context: CXT_SIZE register offset added Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 2/8] drm/i915/context: Preliminary context support Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 3/8] drm/i915/context: implement load and unload Ben Widawsky
2011-02-26 18:30 ` Ben Widawsky [this message]
2011-02-26 18:30 ` [RFC] [PATCH 5/8] drm/i915/context: implement context switch wait Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 6/8] drm/i915/context: context init implementation Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 7/8] drm/i915/context: context switch implementation Ben Widawsky
2011-02-26 18:30 ` [RFC] [PATCH 8/8] drm/i915/context: create and destroy ioctls Ben Widawsky

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=1298745018-5937-5-git-send-email-bwidawsk@gmail.com \
    --to=bwidawsk@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.