Skip to content

Commit

Permalink
drm/i915: Remove unused bits of i915_vma/active api
Browse files Browse the repository at this point in the history
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: Maarten Lankhorst <[email protected]>
Reviewed-by: Niranjana Vishwanathapura <[email protected]>
[mlankhorst: Remove new use of i915_active_has_exclusive]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mlankhorst committed Dec 20, 2021
1 parent f54ffa1 commit ad5c99e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 57 deletions.
28 changes: 3 additions & 25 deletions drivers/gpu/drm/i915/i915_active.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ replace_barrier(struct i915_active *ref, struct i915_active_fence *active)
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;
int err;

Expand All @@ -436,7 +437,7 @@ int i915_active_ref(struct i915_active *ref, u64 idx, struct dma_fence *fence)
if (err)
return err;

active = active_instance(ref, idx);
active = active_instance(ref, i915_request_timeline(rq)->fence_context);
if (!active) {
err = -ENOMEM;
goto out;
Expand Down Expand Up @@ -477,29 +478,6 @@ __i915_active_set_fence(struct i915_active *ref,
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 *
i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f)
{
Expand Down
17 changes: 1 addition & 16 deletions drivers/gpu/drm/i915/i915_active.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,26 +164,11 @@ void __i915_active_init(struct i915_active *ref,
__i915_active_init(ref, active, retire, flags, &__mkey, &__wkey); \
} while (0)

struct dma_fence *
__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);
}
int i915_active_add_request(struct i915_active *ref, struct i915_request *rq);

struct dma_fence *
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);
static inline int i915_active_wait(struct i915_active *ref)
{
Expand Down
24 changes: 10 additions & 14 deletions drivers/gpu/drm/i915/i915_vma.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,22 +356,18 @@ int i915_vma_wait_for_bind(struct i915_vma *vma)
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
static int i915_vma_verify_bind_complete(struct i915_vma *vma)
{
int err = 0;

if (i915_active_has_exclusive(&vma->active)) {
struct dma_fence *fence =
i915_active_fence_get(&vma->active.excl);
struct dma_fence *fence = i915_active_fence_get(&vma->active.excl);
int err;

if (!fence)
return 0;
if (!fence)
return 0;

if (dma_fence_is_signaled(fence))
err = fence->error;
else
err = -EBUSY;
if (dma_fence_is_signaled(fence))
err = fence->error;
else
err = -EBUSY;

dma_fence_put(fence);
}
dma_fence_put(fence);

return err;
}
Expand Down Expand Up @@ -1249,7 +1245,7 @@ __i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma)
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;

Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/i915/i915_vma.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ static inline bool i915_vma_is_active(const struct i915_vma *vma)
/* do not reserve memory to prevent deadlocks */
#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,
struct i915_request *rq,
struct dma_fence *fence,
Expand Down

0 comments on commit ad5c99e

Please sign in to comment.