virtio-gpu: Move fence_poll timer to VirtIOGPUGL

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>
Message-Id: <20241024210311.118220-3-dmitry.osipenko@collabora.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Dmitry Osipenko 2024-10-25 00:03:00 +03:00 committed by Alex Bennée
parent cd7ebf6bf2
commit a723d2eaf0
2 changed files with 7 additions and 4 deletions

View File

@ -594,11 +594,12 @@ static void virtio_gpu_print_stats(void *opaque)
static void virtio_gpu_fence_poll(void *opaque) static void virtio_gpu_fence_poll(void *opaque)
{ {
VirtIOGPU *g = opaque; VirtIOGPU *g = opaque;
VirtIOGPUGL *gl = VIRTIO_GPU_GL(g);
virgl_renderer_poll(); virgl_renderer_poll();
virtio_gpu_process_cmdq(g); virtio_gpu_process_cmdq(g);
if (!QTAILQ_EMPTY(&g->cmdq) || !QTAILQ_EMPTY(&g->fenceq)) { 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);
} }
} }
@ -626,6 +627,7 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
{ {
int ret; int ret;
uint32_t flags = 0; uint32_t flags = 0;
VirtIOGPUGL *gl = VIRTIO_GPU_GL(g);
#if VIRGL_RENDERER_CALLBACKS_VERSION >= 4 #if VIRGL_RENDERER_CALLBACKS_VERSION >= 4
if (qemu_egl_display) { if (qemu_egl_display) {
@ -645,7 +647,7 @@ int virtio_gpu_virgl_init(VirtIOGPU *g)
return ret; return ret;
} }
g->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL, gl->fence_poll = timer_new_ms(QEMU_CLOCK_VIRTUAL,
virtio_gpu_fence_poll, g); virtio_gpu_fence_poll, g);
if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { if (virtio_gpu_stats_enabled(g->parent_obj.conf)) {

View File

@ -194,7 +194,6 @@ struct VirtIOGPU {
uint64_t hostmem; uint64_t hostmem;
bool processing_cmdq; bool processing_cmdq;
QEMUTimer *fence_poll;
QEMUTimer *print_stats; QEMUTimer *print_stats;
uint32_t inflight; uint32_t inflight;
@ -229,6 +228,8 @@ struct VirtIOGPUGL {
bool renderer_inited; bool renderer_inited;
bool renderer_reset; bool renderer_reset;
QEMUTimer *fence_poll;
}; };
struct VhostUserGPU { struct VhostUserGPU {