All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Jacques Hiblot <jjhiblot@ti.com>
To: tomi.valkeinen@ti.com, airlied@linux.ie, daniel@ffwll.ch
Cc: jsarha@ti.com, dri-devel@lists.freedesktop.org
Subject: [PATCH v3 2/8] drm/omap: add omap_gem_unpin_locked()
Date: Mon, 7 Oct 2019 13:25:49 +0200	[thread overview]
Message-ID: <20191007112555.25278-3-jjhiblot@ti.com> (raw)
In-Reply-To: <20191007112555.25278-1-jjhiblot@ti.com>

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

Add omap_gem_unpin_locked() which is a version of omap_gem_unpin() that
expects the caller to hold the omap_obj lock.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/omap_gem.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 51ede7777083..9201c21e206f 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -834,20 +834,16 @@ int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr)
 }
 
 /**
- * omap_gem_unpin() - Unpin a GEM object from memory
+ * omap_gem_unpin_locked() - Unpin a GEM object from memory
  * @obj: the GEM object
  *
- * Unpin the given GEM object previously pinned with omap_gem_pin(). Pins are
- * reference-counted, the actualy unpin will only be performed when the number
- * of calls to this function matches the number of calls to omap_gem_pin().
+ * omap_gem_unpin() without locking.
  */
-void omap_gem_unpin(struct drm_gem_object *obj)
+static void omap_gem_unpin_locked(struct drm_gem_object *obj)
 {
 	struct omap_gem_object *omap_obj = to_omap_bo(obj);
 	int ret;
 
-	mutex_lock(&omap_obj->lock);
-
 	if (refcount_dec_and_test(&omap_obj->dma_addr_cnt)) {
 		ret = tiler_unpin(omap_obj->block);
 		if (ret) {
@@ -864,6 +860,20 @@ void omap_gem_unpin(struct drm_gem_object *obj)
 	}
 }
 
+/**
+ * omap_gem_unpin() - Unpin a GEM object from memory
+ * @obj: the GEM object
+ *
+ * Unpin the given GEM object previously pinned with omap_gem_pin(). Pins are
+ * reference-counted, the actual unpin will only be performed when the number
+ * of calls to this function matches the number of calls to omap_gem_pin().
+ */
+void omap_gem_unpin(struct drm_gem_object *obj)
+{
+	struct omap_gem_object *omap_obj = to_omap_bo(obj);
+
+	mutex_lock(&omap_obj->lock);
+	omap_gem_unpin_locked(obj);
 	mutex_unlock(&omap_obj->lock);
 }
 
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-10-07 11:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 11:25 [PATCH v3 0/8] drm/omap: OMAP_BO flags Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 1/8] drm/omap: use refcount API to track the number of users of dma_addr Jean-Jacques Hiblot
2019-10-09 10:38   ` Tomi Valkeinen
2019-10-07 11:25 ` Jean-Jacques Hiblot [this message]
2019-10-08 15:54   ` [v3,2/8] drm/omap: add omap_gem_unpin_locked() Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 3/8] drm/omap: accept NULL for dma_addr in omap_gem_pin Jean-Jacques Hiblot
2019-10-08 15:55   ` [v3,3/8] " Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 4/8] drm/omap: cleanup OMAP_BO flags Jean-Jacques Hiblot
2019-10-08 15:56   ` [v3,4/8] " Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 5/8] drm/omap: remove OMAP_BO_TILED define Jean-Jacques Hiblot
2019-10-08 15:56   ` [v3,5/8] " Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 6/8] drm/omap: cleanup OMAP_BO_SCANOUT use Jean-Jacques Hiblot
2019-10-08 15:57   ` [v3,6/8] " Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 7/8] drm/omap: add omap_gem_validate_flags() Jean-Jacques Hiblot
2019-10-08 15:58   ` [v3,7/8] " Jean-Jacques Hiblot
2019-10-07 11:25 ` [PATCH v3 8/8] drm/omap: add OMAP_BO flags to affect buffer allocation Jean-Jacques Hiblot
2019-10-08 16:01   ` [v3,8/8] " Jean-Jacques Hiblot
2019-10-07 12:16 ` [PATCH v3 0/8] drm/omap: OMAP_BO flags Tomi Valkeinen
2019-10-08 16:08   ` Jean-Jacques Hiblot
2019-10-09  7:05     ` Tomi Valkeinen

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=20191007112555.25278-3-jjhiblot@ti.com \
    --to=jjhiblot@ti.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=tomi.valkeinen@ti.com \
    /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.