From 402565f222f3c94cda322ed61beedc3fe81e8bcf Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Wed, 27 Apr 2022 14:53:44 +0800 Subject: [PATCH] ACRN:VGPU: Fix the incorrect logic of fetching EDID The virtio_gpu in guest_vm will try to fetch the EDID to query the supported resolution. Guest vm will send the cmd of VIRTIO_GPU_CMD_GET_EDID and receive the response of VIRTIO_GPU_RESP_OK_EDID. Now acrn-dm has some issues in course of handlding EDID request: Incorrect resp type, the incorrect response. This will cause that the guest_vm fails to fetch the EDID. Tracked-On: #7376 Acked-by: Wang Yu Signed-off-by: Zhao Yakui --- devicemodel/hw/pci/virtio/virtio_gpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devicemodel/hw/pci/virtio/virtio_gpu.c b/devicemodel/hw/pci/virtio/virtio_gpu.c index fde11fe1c..9d2ed5601 100644 --- a/devicemodel/hw/pci/virtio/virtio_gpu.c +++ b/devicemodel/hw/pci/virtio/virtio_gpu.c @@ -554,6 +554,7 @@ virtio_gpu_cmd_get_edid(struct virtio_gpu_command *cmd) memset(&resp, 0, sizeof(resp)); /* Only one EDID block is enough */ resp.size = 128; + resp.hdr.type = VIRTIO_GPU_RESP_OK_EDID; virtio_gpu_update_resp_fence(&cmd->hdr, &resp.hdr); vdpy_get_edid(gpu->vdpy_handle, resp.edid, resp.size); memcpy(cmd->iov[1].iov_base, &resp, sizeof(resp)); @@ -1228,6 +1229,7 @@ virtio_gpu_ctrl_bh(void *data) switch (cmd.hdr.type) { case VIRTIO_GPU_CMD_GET_EDID: virtio_gpu_cmd_get_edid(&cmd); + break; case VIRTIO_GPU_CMD_GET_DISPLAY_INFO: virtio_gpu_cmd_get_display_info(&cmd); break;