All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 8/8] drm: clean up syncobj->fence and cb
Date: Fri, 24 Aug 2018 20:12:10 +0800	[thread overview]
Message-ID: <20180824121210.19101-8-david1.zhou@amd.com> (raw)
In-Reply-To: <20180824121210.19101-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>

syncobj fence and cb aren't need any more.
wait pt already contains sumission wait.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/drm_syncobj.c | 69 -----------------------------------
 include/drm/drm_syncobj.h     | 56 +---------------------------
 2 files changed, 1 insertion(+), 124 deletions(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 0be7dd0a0e7d..cd358cf3cbeb 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -123,61 +123,6 @@ struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private,
 }
 EXPORT_SYMBOL(drm_syncobj_find);
 
-static void drm_syncobj_add_callback_locked(struct drm_syncobj *syncobj,
-					    struct drm_syncobj_cb *cb,
-					    drm_syncobj_func_t func)
-{
-	cb->func = func;
-	list_add_tail(&cb->node, &syncobj->cb_list);
-}
-
-static int drm_syncobj_fence_get_or_add_callback(struct drm_syncobj *syncobj,
-						 struct dma_fence **fence,
-						 struct drm_syncobj_cb *cb,
-						 drm_syncobj_func_t func)
-{
-	int ret;
-
-	*fence = drm_syncobj_fence_get(syncobj);
-	if (*fence)
-		return 1;
-
-	spin_lock(&syncobj->lock);
-	/* We've already tried once to get a fence and failed.  Now that we
-	 * have the lock, try one more time just to be sure we don't add a
-	 * callback when a fence has already been set.
-	 */
-	if (syncobj->fence) {
-		*fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
-								 lockdep_is_held(&syncobj->lock)));
-		ret = 1;
-	} else {
-		*fence = NULL;
-		drm_syncobj_add_callback_locked(syncobj, cb, func);
-		ret = 0;
-	}
-	spin_unlock(&syncobj->lock);
-
-	return ret;
-}
-
-void drm_syncobj_add_callback(struct drm_syncobj *syncobj,
-			      struct drm_syncobj_cb *cb,
-			      drm_syncobj_func_t func)
-{
-	spin_lock(&syncobj->lock);
-	drm_syncobj_add_callback_locked(syncobj, cb, func);
-	spin_unlock(&syncobj->lock);
-}
-
-void drm_syncobj_remove_callback(struct drm_syncobj *syncobj,
-				 struct drm_syncobj_cb *cb)
-{
-	spin_lock(&syncobj->lock);
-	list_del_init(&cb->node);
-	spin_unlock(&syncobj->lock);
-}
-
 static void drm_syncobj_timeline_signal_wait_pts(struct drm_syncobj *syncobj)
 {
 	struct rb_node *node = NULL;
@@ -621,7 +566,6 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags,
 		return -ENOMEM;
 
 	kref_init(&syncobj->refcount);
-	INIT_LIST_HEAD(&syncobj->cb_list);
 	spin_lock_init(&syncobj->lock);
 	if (flags & DRM_SYNCOBJ_CREATE_TYPE_TIMELINE) {
 		syncobj->type = DRM_SYNCOBJ_TYPE_TIMELINE;
@@ -986,7 +930,6 @@ struct syncobj_wait_entry {
 	struct task_struct *task;
 	struct dma_fence *fence;
 	struct dma_fence_cb fence_cb;
-	struct drm_syncobj_cb syncobj_cb;
 };
 
 static void syncobj_wait_fence_func(struct dma_fence *fence,
@@ -998,18 +941,6 @@ static void syncobj_wait_fence_func(struct dma_fence *fence,
 	wake_up_process(wait->task);
 }
 
-static void syncobj_wait_syncobj_func(struct drm_syncobj *syncobj,
-				      struct drm_syncobj_cb *cb)
-{
-	struct syncobj_wait_entry *wait =
-		container_of(cb, struct syncobj_wait_entry, syncobj_cb);
-
-	/* This happens inside the syncobj lock */
-	wait->fence = dma_fence_get(rcu_dereference_protected(syncobj->fence,
-							      lockdep_is_held(&syncobj->lock)));
-	wake_up_process(wait->task);
-}
-
 static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
 						  uint32_t count,
 						  uint32_t flags,
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
index ec098d4798b8..657c97dc25ec 100644
--- a/include/drm/drm_syncobj.h
+++ b/include/drm/drm_syncobj.h
@@ -69,19 +69,7 @@ struct drm_syncobj {
 	struct drm_syncobj_timeline syncobj_timeline;
 
 	/**
-	 * @fence:
-	 * NULL or a pointer to the fence bound to this object.
-	 *
-	 * This field should not be used directly. Use drm_syncobj_fence_get()
-	 * and drm_syncobj_replace_fence() instead.
-	 */
-	struct dma_fence __rcu *fence;
-	/**
-	 * @cb_list: List of callbacks to call when the &fence gets replaced.
-	 */
-	struct list_head cb_list;
-	/**
-	 * @lock: Protects &cb_list and write-locks &fence.
+	 * @lock: Protects timeline list and write-locks &fence.
 	 */
 	spinlock_t lock;
 	/**
@@ -90,25 +78,6 @@ struct drm_syncobj {
 	struct file *file;
 };
 
-typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj,
-				   struct drm_syncobj_cb *cb);
-
-/**
- * struct drm_syncobj_cb - callback for drm_syncobj_add_callback
- * @node: used by drm_syncob_add_callback to append this struct to
- *	  &drm_syncobj.cb_list
- * @func: drm_syncobj_func_t to call
- *
- * This struct will be initialized by drm_syncobj_add_callback, additional
- * data can be passed along by embedding drm_syncobj_cb in another struct.
- * The callback will get called the next time drm_syncobj_replace_fence is
- * called.
- */
-struct drm_syncobj_cb {
-	struct list_head node;
-	drm_syncobj_func_t func;
-};
-
 void drm_syncobj_free(struct kref *kref);
 
 /**
@@ -134,29 +103,6 @@ drm_syncobj_put(struct drm_syncobj *obj)
 	kref_put(&obj->refcount, drm_syncobj_free);
 }
 
-/**
- * drm_syncobj_fence_get - get a reference to a fence in a sync object
- * @syncobj: sync object.
- *
- * This acquires additional reference to &drm_syncobj.fence contained in @obj,
- * if not NULL. It is illegal to call this without already holding a reference.
- * No locks required.
- *
- * Returns:
- * Either the fence of @obj or NULL if there's none.
- */
-static inline struct dma_fence *
-drm_syncobj_fence_get(struct drm_syncobj *syncobj)
-{
-	struct dma_fence *fence;
-
-	rcu_read_lock();
-	fence = dma_fence_get_rcu_safe(&syncobj->fence);
-	rcu_read_unlock();
-
-	return fence;
-}
-
 struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private,
 				     u32 handle);
 void drm_syncobj_replace_fence(struct drm_syncobj *syncobj, u64 point,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-08-24 12:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 12:12 [PATCH 1/8] drm: fix syncobj null_fence_enable_signaling Chunming Zhou
     [not found] ` <20180824121210.19101-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-08-24 12:12   ` [PATCH 2/8] drm: rename null fence to stub fence in syncobj Chunming Zhou
2018-08-24 12:12   ` [PATCH 3/8] drm: expand drm_syncobj_find_fence to support timeline point v2 Chunming Zhou
2018-08-24 12:12   ` [PATCH 4/8] drm: expand replace_fence " Chunming Zhou
2018-08-24 12:12   ` [PATCH 5/8] [RFC]drm: add syncobj timeline support v2 Chunming Zhou
2018-08-24 12:12   ` [PATCH 6/8] drm: merge normal syncobj to timeline syncobj Chunming Zhou
2018-08-24 12:12   ` [PATCH 7/8] drm: export syncobj search fence to replace fence_get Chunming Zhou
2018-08-24 12:12   ` Chunming Zhou [this message]
2018-08-24 12:21 ` [PATCH 1/8] drm: fix syncobj null_fence_enable_signaling Christian König

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=20180824121210.19101-8-david1.zhou@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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.