syncobj fence and cb aren't need any more. wait pt already contains sumission wait. Signed-off-by: Chunming Zhou <david1.zhou@xxxxxxx> --- 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 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel