linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/qxl: User page size macro for qxl release bo
@ 2021-09-14  6:23 bibo mao
  2021-09-14  6:23 ` [PATCH 2/2] drm/qxl: Add qxl dma fence release function bibo mao
  2021-09-15  6:33 ` [PATCH 1/2] drm/qxl: User page size macro for qxl release bo Gerd Hoffmann
  0 siblings, 2 replies; 5+ messages in thread
From: bibo mao @ 2021-09-14  6:23 UTC (permalink / raw)
  To: Dave Airlie, Gerd Hoffmann; +Cc: virtualization, linux-kernel, dri-devel

Some architectures have different default page size, this patch
replaces hardcoded 4096 with PAGE_SIZE macro, since cmd bo size
is page aligned.

Signed-off-by: bibo mao <maobibo@loongson.cn>
---
 drivers/gpu/drm/qxl/qxl_release.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index b19f2f00b215..469979cd0341 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -36,10 +36,10 @@
 /* manage releaseables */
 /* stack them 16 high for now -drawable object is 191 */
 #define RELEASE_SIZE 256
-#define RELEASES_PER_BO (4096 / RELEASE_SIZE)
+#define RELEASES_PER_BO (PAGE_SIZE / RELEASE_SIZE)
 /* put an alloc/dealloc surface cmd into one bo and round up to 128 */
 #define SURFACE_RELEASE_SIZE 128
-#define SURFACE_RELEASES_PER_BO (4096 / SURFACE_RELEASE_SIZE)
+#define SURFACE_RELEASES_PER_BO (PAGE_SIZE / SURFACE_RELEASE_SIZE)
 
 static const int release_size_per_bo[] = { RELEASE_SIZE, SURFACE_RELEASE_SIZE, RELEASE_SIZE };
 static const int releases_per_bo[] = { RELEASES_PER_BO, SURFACE_RELEASES_PER_BO, RELEASES_PER_BO };
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/qxl: Add qxl dma fence release function
  2021-09-14  6:23 [PATCH 1/2] drm/qxl: User page size macro for qxl release bo bibo mao
@ 2021-09-14  6:23 ` bibo mao
  2021-09-15  6:38   ` Gerd Hoffmann
  2021-09-15  6:33 ` [PATCH 1/2] drm/qxl: User page size macro for qxl release bo Gerd Hoffmann
  1 sibling, 1 reply; 5+ messages in thread
From: bibo mao @ 2021-09-14  6:23 UTC (permalink / raw)
  To: Dave Airlie, Gerd Hoffmann; +Cc: virtualization, linux-kernel, dri-devel

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@loongson.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/qxl: User page size macro for qxl release bo
  2021-09-14  6:23 [PATCH 1/2] drm/qxl: User page size macro for qxl release bo bibo mao
  2021-09-14  6:23 ` [PATCH 2/2] drm/qxl: Add qxl dma fence release function bibo mao
@ 2021-09-15  6:33 ` Gerd Hoffmann
  1 sibling, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-09-15  6:33 UTC (permalink / raw)
  To: bibo mao; +Cc: Dave Airlie, virtualization, linux-kernel, dri-devel

On Tue, Sep 14, 2021 at 02:23:51AM -0400, bibo mao wrote:
> Some architectures have different default page size, this patch
> replaces hardcoded 4096 with PAGE_SIZE macro, since cmd bo size
> is page aligned.
> 
> Signed-off-by: bibo mao <maobibo@loongson.cn>

Pushed to drm-misc-next.

thanks,
  Gerd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/qxl: Add qxl dma fence release function
  2021-09-14  6:23 ` [PATCH 2/2] drm/qxl: Add qxl dma fence release function bibo mao
@ 2021-09-15  6:38   ` Gerd Hoffmann
  2021-09-17  1:36     ` maobibo
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2021-09-15  6:38 UTC (permalink / raw)
  To: bibo mao; +Cc: Dave Airlie, virtualization, linux-kernel, dri-devel

On Tue, Sep 14, 2021 at 02:23:52AM -0400, bibo mao wrote:
> 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.

Why?  Is there a problem with struct dma_fence being the first
element of struct qxl_release?

take care,
  Gerd


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/qxl: Add qxl dma fence release function
  2021-09-15  6:38   ` Gerd Hoffmann
@ 2021-09-17  1:36     ` maobibo
  0 siblings, 0 replies; 5+ messages in thread
From: maobibo @ 2021-09-17  1:36 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Dave Airlie, virtualization, linux-kernel, dri-devel



On 09/15/2021 02:38 PM, Gerd Hoffmann wrote:
> On Tue, Sep 14, 2021 at 02:23:52AM -0400, bibo mao wrote:
>> 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.
> 
> Why?  Is there a problem with struct dma_fence being the first
> element of struct qxl_release?
Yes, there is no problem put it in the first element of struct qxl_release. This patch has no actual use,it is only more flexible. And you can discard this patch if other graphics drivers do the same thing like this.

regards
bibo,mao
> 
> take care,
>   Gerd
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-17  1:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  6:23 [PATCH 1/2] drm/qxl: User page size macro for qxl release bo bibo mao
2021-09-14  6:23 ` [PATCH 2/2] drm/qxl: Add qxl dma fence release function bibo mao
2021-09-15  6:38   ` Gerd Hoffmann
2021-09-17  1:36     ` maobibo
2021-09-15  6:33 ` [PATCH 1/2] drm/qxl: User page size macro for qxl release bo Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).