[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210914062352.6102-2-maobibo@loongson.cn>
Date: Tue, 14 Sep 2021 02:23:52 -0400
From: bibo mao <maobibo@...ngson.cn>
To: Dave Airlie <airlied@...hat.com>, Gerd Hoffmann <kraxel@...hat.com>
Cc: virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: [PATCH 2/2] drm/qxl: Add qxl dma fence release function
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@...ngson.cn>
---
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
Powered by blists - more mailing lists