Commit ad5c99e0 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Remove unused bits of i915_vma/active api

When reworking the code to move the eviction fence to the object,
the best code is removed code.

Remove some functions that are unused, and change the function definition
if it's only used in 1 place.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
[mlankhorst: Remove new use of i915_active_has_exclusive]
Link: https://patchwork.freedesktop.org/patch/msgid/20211216142749.1966107-2-maarten.lankhorst@linux.intel.com
parent f54ffa12
...@@ -426,8 +426,9 @@ replace_barrier(struct i915_active *ref, struct i915_active_fence *active) ...@@ -426,8 +426,9 @@ replace_barrier(struct i915_active *ref, struct i915_active_fence *active)
return true; return true;
} }
int i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence) int i915_active_add_request(struct i915_active *ref, struct i915_request *rq)
{ {
struct dma_fence *fence = &rq->fence;
struct i915_active_fence *active; struct i915_active_fence *active;
int err; int err;
...@@ -436,7 +437,7 @@ int i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence) ...@@ -436,7 +437,7 @@ int i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence)
if (err) if (err)
return err; return err;
active = active_instance(ref, idx); active = active_instance(ref, i915_request_timeline(rq)->fence_context);
if (!active) { if (!active) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -477,29 +478,6 @@ __i915_active_set_fence(struct i915_active *ref, ...@@ -477,29 +478,6 @@ __i915_active_set_fence(struct i915_active *ref,
return prev; return prev;
} }
static struct i915_active_fence *
__active_fence(struct i915_active *ref, u64 idx)
{
struct active_node *it;
it = __active_lookup(ref, idx);
if (unlikely(!it)) { /* Contention with parallel tree builders! */
spin_lock_irq(&ref->tree_lock);
it = __active_lookup(ref, idx);
spin_unlock_irq(&ref->tree_lock);
}
GEM_BUG_ON(!it); /* slot must be preallocated */
return &it->base;
}
struct dma_fence *
__i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence)
{
/* Only valid while active, see i915_active_acquire_for_context() */
return __i915_active_set_fence(ref, __active_fence(ref, idx), fence);
}
struct dma_fence * struct dma_fence *
i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f) i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f)
{ {
......
...@@ -164,26 +164,11 @@ void __i915_active_init(struct i915_active *ref, ...@@ -164,26 +164,11 @@ void __i915_active_init(struct i915_active *ref,
__i915_active_init(ref, active, retire, flags, &__mkey, &__wkey); \ __i915_active_init(ref, active, retire, flags, &__mkey, &__wkey); \
} while (0) } while (0)
struct dma_fence * int i915_active_add_request(struct i915_active *ref, struct i915_request *rq);
__i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence);
int i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence);
static inline int
i915_active_add_request(struct i915_active *ref, struct i915_request *rq)
{
return i915_active_ref(ref,
i915_request_timeline(rq)->fence_context,
&rq->fence);
}
struct dma_fence * struct dma_fence *
i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f); i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f);
static inline bool i915_active_has_exclusive(struct i915_active *ref)
{
return rcu_access_pointer(ref->excl.fence);
}
int __i915_active_wait(struct i915_active *ref, int state); int __i915_active_wait(struct i915_active *ref, int state);
static inline int i915_active_wait(struct i915_active *ref) static inline int i915_active_wait(struct i915_active *ref)
{ {
......
...@@ -356,22 +356,18 @@ int i915_vma_wait_for_bind(struct i915_vma *vma) ...@@ -356,22 +356,18 @@ int i915_vma_wait_for_bind(struct i915_vma *vma)
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM) #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
static int i915_vma_verify_bind_complete(struct i915_vma *vma) static int i915_vma_verify_bind_complete(struct i915_vma *vma)
{ {
int err = 0; struct dma_fence *fence = i915_active_fence_get(&vma->active.excl);
int err;
if (i915_active_has_exclusive(&vma->active)) {
struct dma_fence *fence =
i915_active_fence_get(&vma->active.excl);
if (!fence) if (!fence)
return 0; return 0;
if (dma_fence_is_signaled(fence)) if (dma_fence_is_signaled(fence))
err = fence->error; err = fence->error;
else else
err = -EBUSY; err = -EBUSY;
dma_fence_put(fence); dma_fence_put(fence);
}
return err; return err;
} }
...@@ -1249,7 +1245,7 @@ __i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma) ...@@ -1249,7 +1245,7 @@ __i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma)
return __i915_request_await_exclusive(rq, &vma->active); return __i915_request_await_exclusive(rq, &vma->active);
} }
int __i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq) static int __i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq)
{ {
int err; int err;
......
...@@ -55,8 +55,6 @@ static inline bool i915_vma_is_active(const struct i915_vma *vma) ...@@ -55,8 +55,6 @@ static inline bool i915_vma_is_active(const struct i915_vma *vma)
/* do not reserve memory to prevent deadlocks */ /* do not reserve memory to prevent deadlocks */
#define __EXEC_OBJECT_NO_RESERVE BIT(31) #define __EXEC_OBJECT_NO_RESERVE BIT(31)
int __must_check __i915_vma_move_to_active(struct i915_vma *vma,
struct i915_request *rq);
int __must_check _i915_vma_move_to_active(struct i915_vma *vma, int __must_check _i915_vma_move_to_active(struct i915_vma *vma,
struct i915_request *rq, struct i915_request *rq,
struct dma_fence *fence, struct dma_fence *fence,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment