public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 2/4] drm/i915: initialize the context idr unconditionally
Date: Tue, 19 Jun 2012 16:52:30 +0200	[thread overview]
Message-ID: <1340117552-3605-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1340117552-3605-1-git-send-email-daniel.vetter@ffwll.ch>

It doesn't hurt and it at least prevents us from OOPSing left and
right at quite a few places. This also allows us to simplify the code
a bit by folding the only line of context_open into the callsite.

We obviuosly also need to run the cleanup code unconditionally, too.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c         |    2 +-
 drivers/gpu/drm/i915/i915_drv.h         |    1 -
 drivers/gpu/drm/i915/i915_gem_context.c |   15 ---------------
 3 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a47ed44..e36f6ce 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1766,7 +1766,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file)
 	spin_lock_init(&file_priv->mm.lock);
 	INIT_LIST_HEAD(&file_priv->mm.request_list);
 
-	i915_gem_context_open(dev, file);
+	idr_init(&file_priv->context_idr);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b65d156..d1b4950 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1392,7 +1392,6 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
 /* i915_gem_context.c */
 void i915_gem_context_init(struct drm_device *dev);
 void i915_gem_context_fini(struct drm_device *dev);
-void i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
 int i915_switch_context(struct intel_ring_buffer *ring,
 			struct drm_file *file, int to_id);
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 693718b..671927a 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -282,17 +282,6 @@ void i915_gem_context_fini(struct drm_device *dev)
 	do_destroy(dev_priv->ring[RCS].default_context);
 }
 
-void i915_gem_context_open(struct drm_device *dev, struct drm_file *file)
-{
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_i915_file_private *file_priv = file->driver_priv;
-
-	if (dev_priv->hw_contexts_disabled)
-		return;
-
-	idr_init(&file_priv->context_idr);
-}
-
 static int context_idr_cleanup(int id, void *p, void *data)
 {
 	struct drm_file *file = (struct drm_file *)data;
@@ -311,12 +300,8 @@ static int context_idr_cleanup(int id, void *p, void *data)
 
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_file_private *file_priv = file->driver_priv;
 
-	if (dev_priv->hw_contexts_disabled)
-		return;
-
 	mutex_lock(&dev->struct_mutex);
 	idr_for_each(&file_priv->context_idr, context_idr_cleanup, file);
 	idr_destroy(&file_priv->context_idr);
-- 
1.7.10

  reply	other threads:[~2012-06-19 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-19 14:52 [PATCH 1/4] drm/i915: fix module unload after context merge Daniel Vetter
2012-06-19 14:52 ` Daniel Vetter [this message]
2012-06-19 17:43   ` [PATCH 2/4] drm/i915: initialize the context idr unconditionally Ben Widawsky
2012-06-19 14:52 ` [PATCH 3/4] drm/i915: return -ENOENT if the context doesn't exist Daniel Vetter
2012-06-19 16:19   ` Ben Widawsky
2012-06-19 16:27     ` Daniel Vetter
2012-06-19 14:52 ` [PATCH 4/4] drm/i915/context: shut up compiler Daniel Vetter
2012-06-19 16:16   ` Ben Widawsky
2012-06-19 17:32 ` [PATCH 1/4] drm/i915: fix module unload after context merge Ben Widawsky
2012-06-19 19:55   ` [PATCH] " Daniel Vetter
2012-06-19 21:19     ` 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=1340117552-3605-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=ben@bwidawsk.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox