diff mbox series

[5/5] drm/virtio: rename sync_seq and last_seq

Message ID 20201119010809.528-5-gurchetansingh@chromium.org (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/virtio: suffix create blob call with _ioctl like any ioctl | expand

Commit Message

Gurchetan Singh Nov. 19, 2020, 1:08 a.m. UTC
To be clearer about our intentions to associate sequence numbers
and fence IDs, let's rename these variables.

Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>
---
 drivers/gpu/drm/virtio/virtgpu_debugfs.c | 4 ++--
 drivers/gpu/drm/virtio/virtgpu_drv.h     | 4 ++--
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 9 +++++----
 3 files changed, 9 insertions(+), 8 deletions(-)

Comments

Anthoine Bourgeois Nov. 20, 2020, 9:24 a.m. UTC | #1
On Wed, Nov 18, 2020 at 05:08:09PM -0800, Gurchetan Singh wrote:
>To be clearer about our intentions to associate sequence numbers
>and fence IDs, let's rename these variables.
>
>Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>

>---
> drivers/gpu/drm/virtio/virtgpu_debugfs.c | 4 ++--
> drivers/gpu/drm/virtio/virtgpu_drv.h     | 4 ++--
> drivers/gpu/drm/virtio/virtgpu_fence.c   | 9 +++++----
> 3 files changed, 9 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
>index f336a8fa6666..5fefc88d47e4 100644
>--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
>+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
>@@ -67,8 +67,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
> 	struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
>
> 	seq_printf(m, "fence %llu %lld\n",
>-		   (u64)atomic64_read(&vgdev->fence_drv.last_seq),
>-		   vgdev->fence_drv.sync_seq);
>+		   (u64)atomic64_read(&vgdev->fence_drv.last_fence_id),
>+		   vgdev->fence_drv.current_fence_id);
> 	return 0;
> }
>
>diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
>index 7c7967a2eb84..6a232553c99b 100644
>--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
>+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
>@@ -127,8 +127,8 @@ typedef void (*virtio_gpu_resp_cb)(struct virtio_gpu_device *vgdev,
> 				   struct virtio_gpu_vbuffer *vbuf);
>
> struct virtio_gpu_fence_driver {
>-	atomic64_t       last_seq;
>-	uint64_t         sync_seq;
>+	atomic64_t       last_fence_id;
>+	uint64_t         current_fence_id;
> 	uint64_t         context;
> 	struct list_head fences;
> 	spinlock_t       lock;
>diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c
>index 2fe9c7ebcbd4..728ca36f6327 100644
>--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
>+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
>@@ -48,7 +48,7 @@ static bool virtio_fence_signaled(struct dma_fence *f)
> 		/* leaked fence outside driver before completing
> 		 * initialization with virtio_gpu_fence_emit */
> 		return false;
>-	if (atomic64_read(&fence->drv->last_seq) >= fence->f.seqno)
>+	if (atomic64_read(&fence->drv->last_fence_id) >= fence->f.seqno)
> 		return true;
> 	return false;
> }
>@@ -62,7 +62,8 @@ static void virtio_timeline_value_str(struct dma_fence *f, char *str, int size)
> {
> 	struct virtio_gpu_fence *fence = to_virtio_fence(f);
>
>-	snprintf(str, size, "%llu", (u64)atomic64_read(&fence->drv->last_seq));
>+	snprintf(str, size, "%llu",
>+		 (u64)atomic64_read(&fence->drv->last_fence_id));
> }
>
> static const struct dma_fence_ops virtio_fence_ops = {
>@@ -100,7 +101,7 @@ void virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
> 	unsigned long irq_flags;
>
> 	spin_lock_irqsave(&drv->lock, irq_flags);
>-	fence->f.seqno = ++drv->sync_seq;
>+	fence->f.seqno = ++drv->current_fence_id;
> 	dma_fence_get(&fence->f);
> 	list_add_tail(&fence->node, &drv->fences);
> 	spin_unlock_irqrestore(&drv->lock, irq_flags);
>@@ -119,7 +120,7 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vgdev,
> 	unsigned long irq_flags;
>
> 	spin_lock_irqsave(&drv->lock, irq_flags);
>-	atomic64_set(&vgdev->fence_drv.last_seq, fence_id);
>+	atomic64_set(&vgdev->fence_drv.last_fence_id, fence_id);
> 	list_for_each_entry_safe(fence, tmp, &drv->fences, node) {
> 		if (fence_id < fence->f.seqno)
> 			continue;
>-- 
>2.29.2.299.gdc1121823c-goog
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index f336a8fa6666..5fefc88d47e4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -67,8 +67,8 @@  virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
 	struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
 
 	seq_printf(m, "fence %llu %lld\n",
-		   (u64)atomic64_read(&vgdev->fence_drv.last_seq),
-		   vgdev->fence_drv.sync_seq);
+		   (u64)atomic64_read(&vgdev->fence_drv.last_fence_id),
+		   vgdev->fence_drv.current_fence_id);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 7c7967a2eb84..6a232553c99b 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -127,8 +127,8 @@  typedef void (*virtio_gpu_resp_cb)(struct virtio_gpu_device *vgdev,
 				   struct virtio_gpu_vbuffer *vbuf);
 
 struct virtio_gpu_fence_driver {
-	atomic64_t       last_seq;
-	uint64_t         sync_seq;
+	atomic64_t       last_fence_id;
+	uint64_t         current_fence_id;
 	uint64_t         context;
 	struct list_head fences;
 	spinlock_t       lock;
diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c b/drivers/gpu/drm/virtio/virtgpu_fence.c
index 2fe9c7ebcbd4..728ca36f6327 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
@@ -48,7 +48,7 @@  static bool virtio_fence_signaled(struct dma_fence *f)
 		/* leaked fence outside driver before completing
 		 * initialization with virtio_gpu_fence_emit */
 		return false;
-	if (atomic64_read(&fence->drv->last_seq) >= fence->f.seqno)
+	if (atomic64_read(&fence->drv->last_fence_id) >= fence->f.seqno)
 		return true;
 	return false;
 }
@@ -62,7 +62,8 @@  static void virtio_timeline_value_str(struct dma_fence *f, char *str, int size)
 {
 	struct virtio_gpu_fence *fence = to_virtio_fence(f);
 
-	snprintf(str, size, "%llu", (u64)atomic64_read(&fence->drv->last_seq));
+	snprintf(str, size, "%llu",
+		 (u64)atomic64_read(&fence->drv->last_fence_id));
 }
 
 static const struct dma_fence_ops virtio_fence_ops = {
@@ -100,7 +101,7 @@  void virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
 	unsigned long irq_flags;
 
 	spin_lock_irqsave(&drv->lock, irq_flags);
-	fence->f.seqno = ++drv->sync_seq;
+	fence->f.seqno = ++drv->current_fence_id;
 	dma_fence_get(&fence->f);
 	list_add_tail(&fence->node, &drv->fences);
 	spin_unlock_irqrestore(&drv->lock, irq_flags);
@@ -119,7 +120,7 @@  void virtio_gpu_fence_event_process(struct virtio_gpu_device *vgdev,
 	unsigned long irq_flags;
 
 	spin_lock_irqsave(&drv->lock, irq_flags);
-	atomic64_set(&vgdev->fence_drv.last_seq, fence_id);
+	atomic64_set(&vgdev->fence_drv.last_fence_id, fence_id);
 	list_for_each_entry_safe(fence, tmp, &drv->fences, node) {
 		if (fence_id < fence->f.seqno)
 			continue;