aboutsummaryrefslogtreecommitdiff
path: root/hw/display/virtio-vga.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-05-24 15:09:44 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-29 06:30:45 +0200
commit50d8e25ea66db01f4214234803506dc1b28cb8d2 (patch)
tree13630c1f78523b9bb9ccde4673c6c25884a38798 /hw/display/virtio-vga.c
parentcb0efb7125fade8faa9a1fed4d46e63d35b31863 (diff)
virtio-gpu: split virtio-gpu, introduce virtio-gpu-base
Add a base class that is common to virtio-gpu and vhost-user-gpu devices. The VirtIOGPUBase base class provides common functionalities necessary for both virtio-gpu and vhost-user-gpu: - common configuration (max-outputs, initial resolution, flags) - virtio device initialization, including queue setup - device pre-conditions checks (iommu) - migration blocker - virtio device callbacks - hooking up to qemu display subsystem - a few common helper functions to reset the device, retrieve display informations - a class callback to unblock the rendering (for GL updates) What is left to the virtio-gpu subdevice to take care of, in short, are all the virtio queues handling, command processing and migration. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20190524130946.31736-8-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/display/virtio-vga.c')
-rw-r--r--hw/display/virtio-vga.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 5d57bf5b0c..a8138c0432 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -32,8 +32,9 @@ typedef struct VirtIOVGAClass {
static void virtio_vga_invalidate_display(void *opaque)
{
VirtIOVGA *vvga = opaque;
+ VirtIOGPUBase *g = VIRTIO_GPU_BASE(&vvga->vdev);
- if (vvga->vdev.enable) {
+ if (g->enable) {
virtio_gpu_ops.invalidate(&vvga->vdev);
} else {
vvga->vga.hw_ops->invalidate(&vvga->vga);
@@ -43,8 +44,9 @@ static void virtio_vga_invalidate_display(void *opaque)
static void virtio_vga_update_display(void *opaque)
{
VirtIOVGA *vvga = opaque;
+ VirtIOGPUBase *g = VIRTIO_GPU_BASE(&vvga->vdev);
- if (vvga->vdev.enable) {
+ if (g->enable) {
virtio_gpu_ops.gfx_update(&vvga->vdev);
} else {
vvga->vga.hw_ops->gfx_update(&vvga->vga);
@@ -54,8 +56,9 @@ static void virtio_vga_update_display(void *opaque)
static void virtio_vga_text_update(void *opaque, console_ch_t *chardata)
{
VirtIOVGA *vvga = opaque;
+ VirtIOGPUBase *g = VIRTIO_GPU_BASE(&vvga->vdev);
- if (vvga->vdev.enable) {
+ if (g->enable) {
if (virtio_gpu_ops.text_update) {
virtio_gpu_ops.text_update(&vvga->vdev, chardata);
}
@@ -108,7 +111,7 @@ static const VMStateDescription vmstate_virtio_vga = {
static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
{
VirtIOVGA *vvga = VIRTIO_VGA(vpci_dev);
- VirtIOGPU *g = &vvga->vdev;
+ VirtIOGPUBase *g = VIRTIO_GPU_BASE(&vvga->vdev);
VGACommonState *vga = &vvga->vga;
Error *err = NULL;
uint32_t offset;