From: Weishi Li <liwei...@kylinos.cn> When VIRGL_VERSION_MAJOR<1, virtio_gpu_context_init_enabled will always return false, causing virgl_cmd_context_create to always return error. Therefore, it is necessary to also include the virtio_gpu_context_init_enabled segment in the VIRGL_VERSION_MAJOR judgment to ensure that context create can also succeed when VIRGL_VERSION-MAJOR<1
Signed-off-by: Weishi Li <liwei...@kylinos.cn> --- hw/display/virtio-gpu-virgl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 145a0b3879..48f6121e16 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -338,6 +338,7 @@ static void virgl_cmd_context_create(VirtIOGPU *g, cc.debug_name); if (cc.context_init) { +#if VIRGL_VERSION_MAJOR >= 1 if (!virtio_gpu_context_init_enabled(g->parent_obj.conf)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: context_init disabled", __func__); @@ -345,7 +346,6 @@ static void virgl_cmd_context_create(VirtIOGPU *g, return; } -#if VIRGL_VERSION_MAJOR >= 1 virgl_renderer_context_create_with_flags(cc.hdr.ctx_id, cc.context_init, cc.nlen, -- 2.25.1