From 770ecb399b6b296d2a188384be844fa1432c1527 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Mon, 15 Aug 2022 10:46:00 +0800 Subject: [PATCH] ACRN:DM:VGPU: Return the parsed scanout_num to virtio_gpu in Guest_VM Return the parsed scanout_num to guest_vm so that the guest_vm can configure multi-display. Tracked-On: #7988 Signed-off-by: Zhao Yakui Reviewed-by: Peng Sun --- devicemodel/hw/pci/virtio/virtio_gpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devicemodel/hw/pci/virtio/virtio_gpu.c b/devicemodel/hw/pci/virtio/virtio_gpu.c index 24d865a72..0b79d2ddb 100644 --- a/devicemodel/hw/pci/virtio/virtio_gpu.c +++ b/devicemodel/hw/pci/virtio/virtio_gpu.c @@ -1625,11 +1625,11 @@ virtio_gpu_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) BACKEND_VBSU); gpu->scanout_num = 1; - gpu->vdpy_handle = vdpy_init(NULL); + gpu->vdpy_handle = vdpy_init(&gpu->scanout_num); gpu->base.mtx = &gpu->mtx; gpu->base.device_caps = VIRTIO_GPU_S_HOSTCAPS; - if (gpu->scanout_num < 0) { + if ((gpu->scanout_num < 0) || (gpu->scanout_num > 2)) { pr_err("%s: return incorrect scanout num %d\n", gpu->scanout_num); return -1; } @@ -1691,7 +1691,7 @@ virtio_gpu_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) /* prepare the config space */ gpu->cfg.events_read = 0; gpu->cfg.events_clear = 0; - gpu->cfg.num_scanouts = 1; + gpu->cfg.num_scanouts = gpu->scanout_num; gpu->cfg.num_capsets = 0; /* config the device id and vendor id according to spec */