829e8def7b
We need the rename of reservation_object to dma_resv. The solution on this merge came from linux-next: From: Stephen Rothwell <sfr@canb.auug.org.au> Date: Wed, 14 Aug 2019 12:48:39 +1000 Subject: [PATCH] drm: fix up fallout from "dma-buf: rename reservation_object to dma_resv" Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> --- drivers/gpu/drm/i915/gt/intel_engine_pool.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_engine_pool.c b/drivers/gpu/drm/i915/gt/intel_engine_pool.c index 03d90b49584a..4cd54c569911 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_pool.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_pool.c @@ -43,12 +43,12 @@ static int pool_active(struct i915_active *ref) { struct intel_engine_pool_node *node = container_of(ref, typeof(*node), active); - struct reservation_object *resv = node->obj->base.resv; + struct dma_resv *resv = node->obj->base.resv; int err; - if (reservation_object_trylock(resv)) { - reservation_object_add_excl_fence(resv, NULL); - reservation_object_unlock(resv); + if (dma_resv_trylock(resv)) { + dma_resv_add_excl_fence(resv, NULL); + dma_resv_unlock(resv); } err = i915_gem_object_pin_pages(node->obj); which is a simplified version from a previous one which had: Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
96 lines
1.9 KiB
C
96 lines
1.9 KiB
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2019 Intel Corporation
|
|
*/
|
|
|
|
#include "i915_drv.h"
|
|
#include "i915_gem_object.h"
|
|
|
|
struct stub_fence {
|
|
struct dma_fence dma;
|
|
struct i915_sw_fence chain;
|
|
};
|
|
|
|
static int __i915_sw_fence_call
|
|
stub_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)
|
|
{
|
|
struct stub_fence *stub = container_of(fence, typeof(*stub), chain);
|
|
|
|
switch (state) {
|
|
case FENCE_COMPLETE:
|
|
dma_fence_signal(&stub->dma);
|
|
break;
|
|
|
|
case FENCE_FREE:
|
|
dma_fence_put(&stub->dma);
|
|
break;
|
|
}
|
|
|
|
return NOTIFY_DONE;
|
|
}
|
|
|
|
static const char *stub_driver_name(struct dma_fence *fence)
|
|
{
|
|
return DRIVER_NAME;
|
|
}
|
|
|
|
static const char *stub_timeline_name(struct dma_fence *fence)
|
|
{
|
|
return "object";
|
|
}
|
|
|
|
static void stub_release(struct dma_fence *fence)
|
|
{
|
|
struct stub_fence *stub = container_of(fence, typeof(*stub), dma);
|
|
|
|
i915_sw_fence_fini(&stub->chain);
|
|
|
|
BUILD_BUG_ON(offsetof(typeof(*stub), dma));
|
|
dma_fence_free(&stub->dma);
|
|
}
|
|
|
|
static const struct dma_fence_ops stub_fence_ops = {
|
|
.get_driver_name = stub_driver_name,
|
|
.get_timeline_name = stub_timeline_name,
|
|
.release = stub_release,
|
|
};
|
|
|
|
struct dma_fence *
|
|
i915_gem_object_lock_fence(struct drm_i915_gem_object *obj)
|
|
{
|
|
struct stub_fence *stub;
|
|
|
|
assert_object_held(obj);
|
|
|
|
stub = kmalloc(sizeof(*stub), GFP_KERNEL);
|
|
if (!stub)
|
|
return NULL;
|
|
|
|
i915_sw_fence_init(&stub->chain, stub_notify);
|
|
dma_fence_init(&stub->dma, &stub_fence_ops, &stub->chain.wait.lock,
|
|
0, 0);
|
|
|
|
if (i915_sw_fence_await_reservation(&stub->chain,
|
|
obj->base.resv, NULL,
|
|
true, I915_FENCE_TIMEOUT,
|
|
I915_FENCE_GFP) < 0)
|
|
goto err;
|
|
|
|
dma_resv_add_excl_fence(obj->base.resv, &stub->dma);
|
|
|
|
return &stub->dma;
|
|
|
|
err:
|
|
stub_release(&stub->dma);
|
|
return NULL;
|
|
}
|
|
|
|
void i915_gem_object_unlock_fence(struct drm_i915_gem_object *obj,
|
|
struct dma_fence *fence)
|
|
{
|
|
struct stub_fence *stub = container_of(fence, typeof(*stub), dma);
|
|
|
|
i915_sw_fence_commit(&stub->chain);
|
|
}
|