[PATCH 2/2] drm/qxl: Add qxl dma fence release function
From: bibo mao
Date: Tue Sep 14 2021 - 02:24:00 EST
Add qxl dma fence release function, previously default dma fence
release function is used, and fence pointer is used to free
the memory. With this patch, actual qxl release pointer is used
to free memory, so that dma fence can put at any place of
struct qxl_release.
Signed-off-by: bibo mao <maobibo@xxxxxxxxxxx>
---
drivers/gpu/drm/qxl/qxl_release.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index 469979cd0341..a9724857c526 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -74,10 +74,25 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr,
return end - cur;
}
+static void qxl_fence_release_rcu(struct rcu_head *rcu)
+{
+ struct dma_fence *fence = container_of(rcu, struct dma_fence, rcu);
+ struct qxl_release *release;
+
+ release = container_of(fence, struct qxl_release, base);
+ kfree(release);
+}
+
+static void qxl_fence_release(struct dma_fence *fence)
+{
+ call_rcu(&fence->rcu, qxl_fence_release_rcu);
+}
+
static const struct dma_fence_ops qxl_fence_ops = {
.get_driver_name = qxl_get_driver_name,
.get_timeline_name = qxl_get_timeline_name,
.wait = qxl_fence_wait,
+ .release = qxl_fence_release,
};
static int
--
2.27.0