[PATCH 13/14] active
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 3 17:27:17 UTC 2020
---
drivers/gpu/drm/i915/i915_active.c | 11 ++++++++++-
drivers/gpu/drm/i915/i915_active.h | 2 +-
drivers/gpu/drm/i915/i915_perf.c | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 10a865f3dc09..f51342f0b7c5 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -1126,6 +1126,9 @@ void i915_active_noop(struct dma_fence *fence, struct dma_fence_cb *cb)
struct auto_active {
struct i915_active base;
struct kref ref;
+
+ void (*release)(void *data);
+ void *data;
};
struct i915_active *i915_active_get(struct i915_active *ref)
@@ -1140,6 +1143,9 @@ static void auto_release(struct kref *ref)
{
struct auto_active *aa = container_of(ref, typeof(*aa), ref);
+ if (aa->release)
+ aa->release(aa->data);
+
i915_active_fini(&aa->base);
kfree(aa);
}
@@ -1162,7 +1168,7 @@ static void auto_retire(struct i915_active *ref)
i915_active_put(ref);
}
-struct i915_active *i915_active_create(void)
+struct i915_active *i915_active_create(void (*release)(void *data), void *data)
{
struct auto_active *aa;
@@ -1173,6 +1179,9 @@ struct i915_active *i915_active_create(void)
kref_init(&aa->ref);
i915_active_init(&aa->base, auto_active, auto_retire);
+ aa->release = release;
+ aa->data = data;
+
return &aa->base;
}
diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
index fb165d3f01cf..0d94b9103f5b 100644
--- a/drivers/gpu/drm/i915/i915_active.h
+++ b/drivers/gpu/drm/i915/i915_active.h
@@ -227,7 +227,7 @@ void i915_request_add_active_barriers(struct i915_request *rq);
void i915_active_print(struct i915_active *ref, struct drm_printer *m);
void i915_active_unlock_wait(struct i915_active *ref);
-struct i915_active *i915_active_create(void);
+struct i915_active *i915_active_create(void (*release)(void *data), void *data);
struct i915_active *i915_active_get(struct i915_active *ref);
void i915_active_put(struct i915_active *ref);
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index b86df70155fd..3b1369f0aff7 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2759,7 +2759,7 @@ static int i915_perf_stream_enable_sync(struct i915_perf_stream *stream)
struct i915_active *active;
int err;
- active = i915_active_create();
+ active = i915_active_create(NULL, NULL);
if (!active)
return -ENOMEM;
--
2.20.1
More information about the Intel-gfx-trybot
mailing list