diff mbox series

[v12,10/13] virtio-gpu: Move fence_poll timer to VirtIOGPUGL

Message ID 20240519212712.2605419-11-dmitry.osipenko@collabora.com (mailing list archive)
State New, archived
Headers show
Series Support blob memory and venus on qemu | expand

Commit Message

Dmitry Osipenko May 19, 2024, 9:27 p.m. UTC
Move fence_poll timer to VirtIOGPUGL for consistency with cmdq_resume_bh
that are used only by GL device.

Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
---
 hw/display/virtio-gpu-virgl.c  | 9 +++++----
 include/hw/virtio/virtio-gpu.h | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Akihiko Odaki May 20, 2024, 3:51 a.m. UTC | #1
On 2024/05/20 6:27, Dmitry Osipenko wrote:
> Move fence_poll timer to VirtIOGPUGL for consistency with cmdq_resume_bh
> that are used only by GL device.
> 
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Thanks for refacotoring.

Please move this before "[PATCH v12 01/13] virtio-gpu: Unrealize GL 
device" so that you don't have to rewrite code introduced by that patch.
Dmitry Osipenko May 22, 2024, 12:03 a.m. UTC | #2
On 5/20/24 06:51, Akihiko Odaki wrote:
> On 2024/05/20 6:27, Dmitry Osipenko wrote:
>> Move fence_poll timer to VirtIOGPUGL for consistency with cmdq_resume_bh
>> that are used only by GL device.
>>
>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
> 
> Thanks for refacotoring.
> 
> Please move this before "[PATCH v12 01/13] virtio-gpu: Unrealize GL
> device" so that you don't have to rewrite code introduced by that patch.

I'll improve it all in v13, thank you for the review
diff mbox series

Patch

diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 63a5a983aad6..c8b25a0f5d7c 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -1089,11 +1089,12 @@  static void virtio_gpu_print_stats(void *opaque)
 static void virtio_gpu_fence_poll(void *opaque)
 {
     VirtIOGPU *g = opaque;
+    VirtIOGPUGL *gl = VIRTIO_GPU_GL(g);
 
     virgl_renderer_poll();
     virtio_gpu_process_cmdq(g);
     if (!QTAILQ_EMPTY(&g->cmdq) || !QTAILQ_EMPTY(&g->fenceq)) {
-        timer_mod(g->fence_poll, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 10);
+        timer_mod(gl->fence_poll, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 10);
     }
 }
 
@@ -1141,8 +1142,8 @@  int virtio_gpu_virgl_init(VirtIOGPU *g)
         return ret;
     }
 
-    g->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL,
-                                 virtio_gpu_fence_poll, g);
+    gl->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL,
+                                  virtio_gpu_fence_poll, g);
 
     if (virtio_gpu_stats_enabled(g->parent_obj.conf)) {
         g->print_stats = timer_new_ms(QEMU_CLOCK_VIRTUAL,
@@ -1176,6 +1177,6 @@  void virtio_gpu_virgl_deinit(VirtIOGPU *g)
     if (virtio_gpu_stats_enabled(g->parent_obj.conf)) {
         timer_free(g->print_stats);
     }
-    timer_free(g->fence_poll);
+    timer_free(gl->fence_poll);
     virgl_renderer_cleanup(NULL);
 }
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f3c8014acc80..529c34481158 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -195,7 +195,6 @@  struct VirtIOGPU {
     uint64_t hostmem;
 
     bool processing_cmdq;
-    QEMUTimer *fence_poll;
     QEMUTimer *print_stats;
 
     uint32_t inflight;
@@ -233,6 +232,7 @@  struct VirtIOGPUGL {
     bool renderer_init_failed;
 
     QEMUBH *cmdq_resume_bh;
+    QEMUTimer *fence_poll;
 };
 
 struct VhostUserGPU {