virtio_gpu_virgl_async_fence_bh() decrements g->inflight for each
asynchronous fence, but it is incremented for each fenced command though
an asynchronous fence may complete several or no fenced commands.
Change it to decrement g->inflight for each fenced command to balance
the increment and the decrement.
Fixes: 6698eae8a1f6 ("virtio-gpu: Support asynchronous fencing")
Signed-off-by: Akihiko Odaki <[email protected]>
---
hw/display/virtio-gpu-virgl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index c37df91e3ed1..20a5d06d9a3a 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -1266,14 +1266,14 @@ static void virtio_gpu_virgl_async_fence_bh(void
*opaque)
virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA);
QTAILQ_REMOVE(&g->fenceq, cmd, next);
g_free(cmd);
+ g->inflight--;
+ if (virtio_gpu_stats_enabled(g->parent_obj.conf)) {
+ trace_virtio_gpu_dec_inflight_fences(g->inflight);
+ }
}
trace_virtio_gpu_fence_resp(f->fence_id);
g_free(f);
- g->inflight--;
- if (virtio_gpu_stats_enabled(g->parent_obj.conf)) {
- trace_virtio_gpu_dec_inflight_fences(g->inflight);
- }
}
}
--
2.55.0