Skip to contentSkip to conversation

drm: rename null fence to stub fence in syncobj

PATCH In review Chunming Zhou 6 participants 10 messages Aug 22, 2018 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: rename null fence to stub fence in syncobj

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>
---
 drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
 include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 }
 EXPORT_SYMBOL(drm_syncobj_replace_fence);
 
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
 static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
 {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
 	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
 	if (fence == NULL)
 		return -ENOMEM;
 
 	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
 		       &fence->lock, 0, 0);
 	dma_fence_signal(&fence->base);
 
include/drm/drm_syncobj.h +24 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
 
 struct drm_syncobj_cb;
 
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = NULL,
+};
+
 /**
  * struct drm_syncobj - sync object.
  *
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 67 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>
---
  drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
  include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
  }
  EXPORT_SYMBOL(drm_syncobj_replace_fence);
 
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
  static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
  {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
  	if (fence == NULL)
  		return -ENOMEM;
 
  	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
  		       &fence->lock, 0, 0);
  	dma_fence_signal(&fence->base);
 
include/drm/drm_syncobj.h +3 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
 
  struct drm_syncobj_cb;
 
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;

include/drm/drm_syncobj.h line 45

Quoted 10 lines
include/drm/drm_syncobj.h +10 -0
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

dma_fence_enable_sw_signaling() is the function who is calling this callback.

include/drm/drm_syncobj.h line 53

Quoted 8 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,

The .wait callback should be dropped.

Apart from that looks good to me.

Christian.

include/drm/drm_syncobj.h line 59

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+	.release = NULL,
+};
+
  /**
   * struct drm_syncobj - sync object.
   *

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
Quoted 91 lines · Christian König

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 62 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>
---
  drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
  include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
  }
  EXPORT_SYMBOL(drm_syncobj_replace_fence);
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
  static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
  {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
  	if (fence == NULL)
  		return -ENOMEM;
  	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
  		       &fence->lock, 0, 0);
  	dma_fence_signal(&fence->base);
include/drm/drm_syncobj.h +3 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
  struct drm_syncobj_cb;
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;

include/drm/drm_syncobj.h line 43

Quoted 10 lines
include/drm/drm_syncobj.h +10 -0
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

dma_fence_enable_sw_signaling() is the function who is calling this callback.

include/drm/drm_syncobj.h line 53

Quoted 8 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,

The .wait callback should be dropped.

Quoted 1 line

Apart from that looks good to me.

.enable_signaling should probably also be dropped. Same also for wherever you copied this from.
-Daniel

Quoted 14 lines

Christian.

include/drm/drm_syncobj.h line 59

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+	.release = NULL,
+};
+
  /**
   * struct drm_syncobj - sync object.
   *

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
In reply to Christian König
Quoted 79 lines · Christian König

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 65 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>

---
  drivers/gpu/drm/drm_syncobj.c | 28 ++-------------------------- include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++

  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -25
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct 
 drm_syncobj *syncobj,
   }
   EXPORT_SYMBOL(drm_syncobj_replace_fence);
   -struct drm_syncobj_null_fence {
-    struct dma_fence base;
-    spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence 
 *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence 
 *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-    .get_driver_name = drm_syncobj_null_fence_get_name,
-    .get_timeline_name = drm_syncobj_null_fence_get_name,
-    .enable_signaling = drm_syncobj_null_fence_enable_signaling,
-    .wait = dma_fence_default_wait,
-    .release = NULL,
-};
-
   static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
   {
-    struct drm_syncobj_null_fence *fence;
+    struct drm_syncobj_stub_fence *fence;
       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
       if (fence == NULL)
           return -ENOMEM;
         spin_lock_init(&fence->lock);
-    dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+    dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
                  &fence->lock, 0, 0);

      dma_fence_signal(&fence->base);
  diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 3980602472c0..b04c492ddbb5 100644

include/drm/drm_syncobj.h +2 -0
@@ -30,6 +30,30 @@
     struct drm_syncobj_cb;
   +struct drm_syncobj_stub_fence {
+    struct dma_fence base;
+    spinlock_t lock;

include/drm/drm_syncobj.h line 43

Quoted 10 lines
include/drm/drm_syncobj.h +10 -0
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

Quoted 1 line

dma_fence_enable_sw_signaling() is the function who is calling this callback.

indeed, will fix.

Quoted 11 lines

include/drm/drm_syncobj.h line 53

Quoted 9 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+    .get_driver_name = drm_syncobj_stub_fence_get_name,
+    .get_timeline_name = drm_syncobj_stub_fence_get_name,
+    .enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+    .wait = dma_fence_default_wait,

The .wait callback should be dropped.

why?

fence->ops->wait(fence, intr, timeout) is called by dma_fence_wait(). If dropped, how does dma_fence_wait() work?

Thanks,
David

Quoted 12 lines

Apart from that looks good to me.

Christian.

include/drm/drm_syncobj.h line 59

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+    .release = NULL,
+};
+
   /**
    * struct drm_syncobj - sync object.
    *

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1db43111-55fd-ba68-1d5c-6ecbd19ad65e-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Am 22.08.2018 um 11:02 schrieb zhoucm1:

Quoted 95 lines · Christian König
Quoted 79 lines

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 65 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>

---
  drivers/gpu/drm/drm_syncobj.c | 28 ++-------------------------- include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++

  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -25
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct 
 drm_syncobj *syncobj,
   }
   EXPORT_SYMBOL(drm_syncobj_replace_fence);
   -struct drm_syncobj_null_fence {
-    struct dma_fence base;
-    spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence 
 *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct 
 dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-    .get_driver_name = drm_syncobj_null_fence_get_name,
-    .get_timeline_name = drm_syncobj_null_fence_get_name,
-    .enable_signaling = drm_syncobj_null_fence_enable_signaling,
-    .wait = dma_fence_default_wait,
-    .release = NULL,
-};
-
   static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
   {
-    struct drm_syncobj_null_fence *fence;
+    struct drm_syncobj_stub_fence *fence;
       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
       if (fence == NULL)
           return -ENOMEM;
         spin_lock_init(&fence->lock);
-    dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+    dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
                  &fence->lock, 0, 0);

      dma_fence_signal(&fence->base);
  diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 3980602472c0..b04c492ddbb5 100644

include/drm/drm_syncobj.h +2 -0
@@ -30,6 +30,30 @@
     struct drm_syncobj_cb;
   +struct drm_syncobj_stub_fence {
+    struct dma_fence base;
+    spinlock_t lock;

include/drm/drm_syncobj.h line 43

Quoted 10 lines
include/drm/drm_syncobj.h +10 -0
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

Quoted 1 line

dma_fence_enable_sw_signaling() is the function who is calling this callback.

indeed, will fix.

Quoted 11 lines

include/drm/drm_syncobj.h line 53

Quoted 9 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+    .get_driver_name = drm_syncobj_stub_fence_get_name,
+    .get_timeline_name = drm_syncobj_stub_fence_get_name,
+    .enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+    .wait = dma_fence_default_wait,

The .wait callback should be dropped.

Quoted 3 lines

why?

fence->ops->wait(fence, intr, timeout) is called by dma_fence_wait(). If dropped, how does dma_fence_wait() work?

You are working on an older code base, fence->ops->wait is optional by now.

Christian.

Quoted 16 lines

Thanks,
David

Quoted 12 lines

Apart from that looks good to me.

Christian.

include/drm/drm_syncobj.h line 59

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+    .release = NULL,
+};
+
   /**
    * struct drm_syncobj - sync object.
    *
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a586e4f3-0fbb-e530-6a20-fe6d32302771-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#8 lore raw
Quoted 96 lines · Christian König

Am 22.08.2018 um 11:02 schrieb zhoucm1:

Quoted 95 lines · Christian König
Quoted 79 lines

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 65 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <jason-fQELhIk9awXprZlt/[email protected]>

---
  drivers/gpu/drm/drm_syncobj.c | 28 ++-------------------------- include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++

  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -25
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct 
 drm_syncobj *syncobj,
   }
   EXPORT_SYMBOL(drm_syncobj_replace_fence);
   -struct drm_syncobj_null_fence {
-    struct dma_fence base;
-    spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct 
 dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct 
 dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-    .get_driver_name = drm_syncobj_null_fence_get_name,
-    .get_timeline_name = drm_syncobj_null_fence_get_name,
-    .enable_signaling = drm_syncobj_null_fence_enable_signaling,
-    .wait = dma_fence_default_wait,
-    .release = NULL,
-};
-
   static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
   {
-    struct drm_syncobj_null_fence *fence;
+    struct drm_syncobj_stub_fence *fence;
       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
       if (fence == NULL)
           return -ENOMEM;
         spin_lock_init(&fence->lock);
-    dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+    dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
                  &fence->lock, 0, 0);

      dma_fence_signal(&fence->base);
  diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 3980602472c0..b04c492ddbb5 100644

include/drm/drm_syncobj.h +2 -0
@@ -30,6 +30,30 @@
     struct drm_syncobj_cb;
   +struct drm_syncobj_stub_fence {
+    struct dma_fence base;
+    spinlock_t lock;

include/drm/drm_syncobj.h line 43

Quoted 10 lines
include/drm/drm_syncobj.h +10 -0
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

Quoted 1 line

dma_fence_enable_sw_signaling() is the function who is calling this callback.

indeed, will fix.

Quoted 11 lines

include/drm/drm_syncobj.h line 51

Quoted 9 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+    .get_driver_name = drm_syncobj_stub_fence_get_name,
+    .get_timeline_name = drm_syncobj_stub_fence_get_name,
+    .enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+    .wait = dma_fence_default_wait,

The .wait callback should be dropped.

Quoted 5 lines
Quoted 3 lines

why?

fence->ops->wait(fence, intr, timeout) is called by dma_fence_wait(). If dropped, how does dma_fence_wait() work?

You are working on an older code base, fence->ops->wait is optional by now.

Sorry, I still don't get it. My code is synced today from amd-staging-drm-next, and it's 4.18-rc1. I still see the dma_fence_wait_timeout is :
signed long
dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout)
{
        signed long ret;

        if (WARN_ON(timeout < 0))
                return -EINVAL;

        trace_dma_fence_wait_start(fence); ret = fence->ops->wait(fence, intr, timeout); trace_dma_fence_wait_end(fence); return ret;
}

.wait callback seems still a must have?

Thanks,
David Zhou

Quoted 24 lines

Christian.

Quoted 20 lines

Thanks,
David

Quoted 12 lines

Apart from that looks good to me.

Christian.

include/drm/drm_syncobj.h line 57

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+    .release = NULL,
+};
+
   /**
    * struct drm_syncobj - sync object.
    *

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 4a4f9302-bf25-96c3-c870-32492ddc7134-5C7GfCeVMHo@public.gmane.org

#10 lore raw

Am 22.08.2018 um 11:10 schrieb zhoucm1:

Quoted 101 lines · Christian König
Quoted 97 lines

Am 22.08.2018 um 11:02 schrieb zhoucm1:

Quoted 96 lines · Christian König
Quoted 80 lines

Am 22.08.2018 um 10:38 schrieb Chunming Zhou:

Quoted 66 lines

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <jason-fQELhIk9awXprZlt/[email protected]>

---
  drivers/gpu/drm/drm_syncobj.c | 28 ++-------------------------- include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++

  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -25
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct 
 drm_syncobj *syncobj,
   }
   EXPORT_SYMBOL(drm_syncobj_replace_fence);
   -struct drm_syncobj_null_fence {
-    struct dma_fence base;
-    spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct 
 dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct 
 dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-    .get_driver_name = drm_syncobj_null_fence_get_name,
-    .get_timeline_name = drm_syncobj_null_fence_get_name,
-    .enable_signaling = drm_syncobj_null_fence_enable_signaling,
-    .wait = dma_fence_default_wait,
-    .release = NULL,
-};
-
   static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
   {
-    struct drm_syncobj_null_fence *fence;
+    struct drm_syncobj_stub_fence *fence;
       fence = kzalloc(sizeof(*fence), GFP_KERNEL);
       if (fence == NULL)
           return -ENOMEM;
         spin_lock_init(&fence->lock);
-    dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+    dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
                  &fence->lock, 0, 0);

      dma_fence_signal(&fence->base);
  diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 3980602472c0..b04c492ddbb5 100644

include/drm/drm_syncobj.h +3 -0
@@ -30,6 +30,30 @@
     struct drm_syncobj_cb;
   +struct drm_syncobj_stub_fence {
+    struct dma_fence base;
+    spinlock_t lock;
+};

include/drm/drm_syncobj.h line 44

Quoted 10 lines
include/drm/drm_syncobj.h +9 -0
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence 
 *fence)
+{
+    dma_fence_enable_sw_signaling(fence);

Copy&pasted from the old implementation, but that is certainly totally nonsense.

Quoted 1 line

dma_fence_enable_sw_signaling() is the function who is calling this callback.

indeed, will fix.

Quoted 11 lines

include/drm/drm_syncobj.h line 52

Quoted 9 lines
include/drm/drm_syncobj.h +8 -0
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+    .get_driver_name = drm_syncobj_stub_fence_get_name,
+    .get_timeline_name = drm_syncobj_stub_fence_get_name,
+    .enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+    .wait = dma_fence_default_wait,

The .wait callback should be dropped.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

why?

fence->ops->wait(fence, intr, timeout) is called by dma_fence_wait(). If dropped, how does dma_fence_wait() work?

You are working on an older code base, fence->ops->wait is optional by now.

Sorry, I still don't get it. My code is synced today from amd-staging-drm-next, and it's 4.18-rc1.

That is outdated, when working on common drm stuff you need to work on drm-next or drm-misc-next.

Quoted 9 lines

I still see the dma_fence_wait_timeout is :
signed long
dma_fence_wait_timeout(struct dma_fence *fence, bool intr, signed long timeout) {
        signed long ret;

        if (WARN_ON(timeout < 0))
                return -EINVAL;

Quoted 7 lines

        trace_dma_fence_wait_start(fence); ret = fence->ops->wait(fence, intr, timeout); trace_dma_fence_wait_end(fence); return ret;
}

.wait callback seems still a must have?

See drm-misc-next:

Quoted 6 lines

        trace_dma_fence_wait_start(fence);
        if (fence->ops->wait)
                ret = fence->ops->wait(fence, intr, timeout); else
                ret = dma_fence_default_wait(fence, intr, timeout); trace_dma_fence_wait_end(fence);

Regards,
Christian.

Quoted 32 lines

Thanks,
David Zhou

Quoted 24 lines

Christian.

Quoted 20 lines

Thanks,
David

Quoted 12 lines

Apart from that looks good to me.

Christian.

include/drm/drm_syncobj.h line 58

Quoted 6 lines
include/drm/drm_syncobj.h +3 -0
+    .release = NULL,
+};
+
   /**
    * struct drm_syncobj - sync object.
    *

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw
In reply to a message not in the archive
Quoted 5 lines · Chunming Zhou

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>

Please don't expose stuff only used by the drm_syncobj implementation to drivers. Gives us a very unclean driver interface. Imo this should all be left within drm_syncobj.h.

See also my comments for patch 2, you leak all the implemenation details to drivers. We need to fix that and have a clear interface. -Daniel

Quoted 93 lines
---
 drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
 include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
 }
 EXPORT_SYMBOL(drm_syncobj_replace_fence);
 
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
 static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
 {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
 	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
 	if (fence == NULL)
 		return -ENOMEM;
 
 	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
 		       &fence->lock, 0, 0);
 	dma_fence_signal(&fence->base);
 
include/drm/drm_syncobj.h +24 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
 
 struct drm_syncobj_cb;
 
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = NULL,
+};
+
 /**
  * struct drm_syncobj - sync object.
  *
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180822093428.GP21634-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org

#13 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 5 lines · Chunming Zhou

stub fence will be used by timeline syncobj as well.

Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>

Please don't expose stuff only used by the drm_syncobj implementation to drivers. Gives us a very unclean driver interface. Imo this should all be left within drm_syncobj.h.

.c? will fix that.

Quoted 3 lines

See also my comments for patch 2, you leak all the implemenation details to drivers. We need to fix that and have a clear interface.

Yes, I will address them when I do v2.

Thanks,
David Zhou

Quoted 91 lines

-Daniel

Quoted 89 lines
---
  drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
  include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
  }
  EXPORT_SYMBOL(drm_syncobj_replace_fence);
 
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
  static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
  {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
  	if (fence == NULL)
  		return -ENOMEM;
 
  	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
  		       &fence->lock, 0, 0);
  	dma_fence_signal(&fence->base);
 
include/drm/drm_syncobj.h +24 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
 
  struct drm_syncobj_cb;
 
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = NULL,
+};
+
  /**
   * struct drm_syncobj - sync object.
   *
Signature · 1 line
2.14.1
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 03051acf-de94-abd3-8ffb-83ad0ecdae5d-5C7GfCeVMHo@public.gmane.org

#15 lore raw
Quoted 6 lines · On Wed, Aug 22, 2018 at 05:56:10PM +0800, zhoucm1 wrote:
Quoted 3 lines · Daniel Vetter
Quoted 2 lines · Chunming Zhou

stub fence will be used by timeline syncobj as well.

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Change-Id Ia4252f03c07a8105491d2791dc7c8c6976682285
Cc Jason Ekstrand <[email protected]>

Please don't expose stuff only used by the drm_syncobj implementation to drivers. Gives us a very unclean driver interface. Imo this should all be left within drm_syncobj.h.

.c? will fix that.

Yup I meant to leave it all in drm_syncobj.c :-)
-Daniel

Quoted 98 lines
Quoted 3 lines

See also my comments for patch 2, you leak all the implemenation details to drivers. We need to fix that and have a clear interface.

Yes, I will address them when I do v2.

Thanks,
David Zhou

Quoted 90 lines

-Daniel

Quoted 88 lines
---
  drivers/gpu/drm/drm_syncobj.c | 28 ++--------------------------
  include/drm/drm_syncobj.h     | 24 ++++++++++++++++++++++++
  2 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -26
index d4f4ce484529..70af32d0def1 100644
@@ -187,39 +187,15 @@ void drm_syncobj_replace_fence(struct drm_syncobj *syncobj,
  }
  EXPORT_SYMBOL(drm_syncobj_replace_fence);
-struct drm_syncobj_null_fence {
-	struct dma_fence base;
-	spinlock_t lock;
-};
-
-static const char *drm_syncobj_null_fence_get_name(struct dma_fence *fence)
-{
-        return "syncobjnull";
-}
-
-static bool drm_syncobj_null_fence_enable_signaling(struct dma_fence *fence)
-{
-    dma_fence_enable_sw_signaling(fence);
-    return !dma_fence_is_signaled(fence);
-}
-
-static const struct dma_fence_ops drm_syncobj_null_fence_ops = {
-	.get_driver_name = drm_syncobj_null_fence_get_name,
-	.get_timeline_name = drm_syncobj_null_fence_get_name,
-	.enable_signaling = drm_syncobj_null_fence_enable_signaling,
-	.wait = dma_fence_default_wait,
-	.release = NULL,
-};
-
  static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)
  {
-	struct drm_syncobj_null_fence *fence;
+	struct drm_syncobj_stub_fence *fence;
  	fence = kzalloc(sizeof(*fence), GFP_KERNEL);
  	if (fence == NULL)
  		return -ENOMEM;
  	spin_lock_init(&fence->lock);
-	dma_fence_init(&fence->base, &drm_syncobj_null_fence_ops,
+	dma_fence_init(&fence->base, &drm_syncobj_stub_fence_ops,
  		       &fence->lock, 0, 0);
  	dma_fence_signal(&fence->base);
include/drm/drm_syncobj.h +24 -0
index 3980602472c0..b04c492ddbb5 100644
@@ -30,6 +30,30 @@
  struct drm_syncobj_cb;
+struct drm_syncobj_stub_fence {
+	struct dma_fence base;
+	spinlock_t lock;
+};
+
+const char *drm_syncobj_stub_fence_get_name(struct dma_fence *fence)
+{
+        return "syncobjstub";
+}
+
+bool drm_syncobj_stub_fence_enable_signaling(struct dma_fence *fence)
+{
+    dma_fence_enable_sw_signaling(fence);
+    return !dma_fence_is_signaled(fence);
+}
+
+const struct dma_fence_ops drm_syncobj_stub_fence_ops = {
+	.get_driver_name = drm_syncobj_stub_fence_get_name,
+	.get_timeline_name = drm_syncobj_stub_fence_get_name,
+	.enable_signaling = drm_syncobj_stub_fence_enable_signaling,
+	.wait = dma_fence_default_wait,
+	.release = NULL,
+};
+
  /**
   * struct drm_syncobj - sync object.
   *
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx