]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dma-buf/dma-fence: remove unnecessary callbacks
authorChristian König <christian.koenig@amd.com>
Wed, 18 Sep 2024 06:16:57 +0000 (08:16 +0200)
committerChristian König <christian.koenig@amd.com>
Thu, 6 Mar 2025 14:20:53 +0000 (15:20 +0100)
The fence_value_str and timeline_value_str callbacks were just an
unnecessary abstraction in the SW sync implementation.

The only caller of those callbacks already knew that the fence in
questions is a timeline_fence. So print the values directly instead
of using a redirection.

Additional to that remove the implementations from virtgpu and vgem.
As far as I can see those were never used in the first place.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20250211163109.12200-3-christian.koenig@amd.com
drivers/dma-buf/sw_sync.c
drivers/dma-buf/sync_debug.c
drivers/gpu/drm/vgem/vgem_fence.c
drivers/gpu/drm/virtio/virtgpu_fence.c
include/linux/dma-fence.h

index f5905d67dedbbbf55a7c6c516ac2c9ff20bd544a..849280ae79a9e3bea15743cff9a9520fde70b182 100644 (file)
@@ -173,20 +173,6 @@ static bool timeline_fence_signaled(struct dma_fence *fence)
        return !__dma_fence_is_later(fence->seqno, parent->value, fence->ops);
 }
 
-static void timeline_fence_value_str(struct dma_fence *fence,
-                                   char *str, int size)
-{
-       snprintf(str, size, "%lld", fence->seqno);
-}
-
-static void timeline_fence_timeline_value_str(struct dma_fence *fence,
-                                            char *str, int size)
-{
-       struct sync_timeline *parent = dma_fence_parent(fence);
-
-       snprintf(str, size, "%d", parent->value);
-}
-
 static void timeline_fence_set_deadline(struct dma_fence *fence, ktime_t deadline)
 {
        struct sync_pt *pt = dma_fence_to_sync_pt(fence);
@@ -208,8 +194,6 @@ static const struct dma_fence_ops timeline_fence_ops = {
        .get_timeline_name = timeline_fence_get_timeline_name,
        .signaled = timeline_fence_signaled,
        .release = timeline_fence_release,
-       .fence_value_str = timeline_fence_value_str,
-       .timeline_value_str = timeline_fence_timeline_value_str,
        .set_deadline = timeline_fence_set_deadline,
 };
 
index 237bce21d1e724632f56646c914cc31bb9efe876..270daae7d89a2925c056aecbc7e7669d9199c970 100644 (file)
@@ -82,25 +82,8 @@ static void sync_print_fence(struct seq_file *s,
                seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec);
        }
 
-       if (fence->ops->timeline_value_str &&
-               fence->ops->fence_value_str) {
-               char value[64];
-               bool success;
-
-               fence->ops->fence_value_str(fence, value, sizeof(value));
-               success = strlen(value);
-
-               if (success) {
-                       seq_printf(s, ": %s", value);
-
-                       fence->ops->timeline_value_str(fence, value,
-                                                      sizeof(value));
-
-                       if (strlen(value))
-                               seq_printf(s, " / %s", value);
-               }
-       }
-
+       seq_printf(s, ": %lld", fence->seqno);
+       seq_printf(s, " / %d", parent->value);
        seq_putc(s, '\n');
 }
 
index e1575417839599f1cc7ea64848c56eec71d4e045..5298d995faa7ba8d72847bb0040768464c5ac24b 100644 (file)
@@ -53,25 +53,10 @@ static void vgem_fence_release(struct dma_fence *base)
        dma_fence_free(&fence->base);
 }
 
-static void vgem_fence_value_str(struct dma_fence *fence, char *str, int size)
-{
-       snprintf(str, size, "%llu", fence->seqno);
-}
-
-static void vgem_fence_timeline_value_str(struct dma_fence *fence, char *str,
-                                         int size)
-{
-       snprintf(str, size, "%llu",
-                dma_fence_is_signaled(fence) ? fence->seqno : 0);
-}
-
 static const struct dma_fence_ops vgem_fence_ops = {
        .get_driver_name = vgem_fence_get_driver_name,
        .get_timeline_name = vgem_fence_get_timeline_name,
        .release = vgem_fence_release,
-
-       .fence_value_str = vgem_fence_value_str,
-       .timeline_value_str = vgem_fence_timeline_value_str,
 };
 
 static void vgem_fence_timeout(struct timer_list *t)
index f28357dbde3522f55382723084206618794e1d32..44c1d8ef3c4d07881e2c4c92cc67f6aba7a5df4f 100644 (file)
@@ -49,26 +49,10 @@ static bool virtio_gpu_fence_signaled(struct dma_fence *f)
        return false;
 }
 
-static void virtio_gpu_fence_value_str(struct dma_fence *f, char *str, int size)
-{
-       snprintf(str, size, "[%llu, %llu]", f->context, f->seqno);
-}
-
-static void virtio_gpu_timeline_value_str(struct dma_fence *f, char *str,
-                                         int size)
-{
-       struct virtio_gpu_fence *fence = to_virtio_gpu_fence(f);
-
-       snprintf(str, size, "%llu",
-                (u64)atomic64_read(&fence->drv->last_fence_id));
-}
-
 static const struct dma_fence_ops virtio_gpu_fence_ops = {
        .get_driver_name     = virtio_gpu_get_driver_name,
        .get_timeline_name   = virtio_gpu_get_timeline_name,
        .signaled            = virtio_gpu_fence_signaled,
-       .fence_value_str     = virtio_gpu_fence_value_str,
-       .timeline_value_str  = virtio_gpu_timeline_value_str,
 };
 
 struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev,
index 52587d390acab45e552fd5eb33e6c2ae5e39652c..b12776883d1430b0b7c6bf564fa56be34855020d 100644 (file)
@@ -238,27 +238,6 @@ struct dma_fence_ops {
         */
        void (*release)(struct dma_fence *fence);
 
-       /**
-        * @fence_value_str:
-        *
-        * Callback to fill in free-form debug info specific to this fence, like
-        * the sequence number.
-        *
-        * This callback is optional.
-        */
-       void (*fence_value_str)(struct dma_fence *fence, char *str, int size);
-
-       /**
-        * @timeline_value_str:
-        *
-        * Fills in the current value of the timeline as a string, like the
-        * sequence number. Note that the specific fence passed to this function
-        * should not matter, drivers should only use it to look up the
-        * corresponding timeline structures.
-        */
-       void (*timeline_value_str)(struct dma_fence *fence,
-                                  char *str, int size);
-
        /**
         * @set_deadline:
         *