aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2021-02-04 14:52:23 +0400
committerGerd Hoffmann <kraxel@redhat.com>2021-02-04 15:58:54 +0100
commita7dfbe289ede8adb253d735daef88a39709053dc (patch)
tree5b4b4cf2783f8a85ae45d05ca12d04a1b2e05d21 /hw
parentff64d44fb8f6636ece3064f86babe48e3807533d (diff)
downloadqemu-a7dfbe289ede8adb253d735daef88a39709053dc.zip
qemu-a7dfbe289ede8adb253d735daef88a39709053dc.tar.gz
qemu-a7dfbe289ede8adb253d735daef88a39709053dc.tar.bz2
ui: add an optional get_flags callback to GraphicHwOps
Those flags can be used to express different requirements for the display or other needs. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210204105232.834642-12-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/virtio-gpu-base.c18
-rw-r--r--hw/display/virtio-vga.c9
-rw-r--r--hw/vfio/display.c6
3 files changed, 33 insertions, 0 deletions
diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index 40ccd00..f27a6fb 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -114,7 +114,25 @@ virtio_gpu_gl_block(void *opaque, bool block)
}
}
+static int
+virtio_gpu_get_flags(void *opaque)
+{
+ VirtIOGPUBase *g = opaque;
+ int flags = GRAPHIC_FLAGS_NONE;
+
+ if (virtio_gpu_virgl_enabled(g->conf)) {
+ flags |= GRAPHIC_FLAGS_GL;
+ }
+
+ if (virtio_gpu_dmabuf_enabled(g->conf)) {
+ flags |= GRAPHIC_FLAGS_DMABUF;
+ }
+
+ return flags;
+}
+
static const GraphicHwOps virtio_gpu_ops = {
+ .get_flags = virtio_gpu_get_flags,
.invalidate = virtio_gpu_invalidate_display,
.gfx_update = virtio_gpu_update_display,
.text_update = virtio_gpu_text_update,
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 81f776e..b071909 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -68,7 +68,16 @@ static void virtio_vga_base_gl_block(void *opaque, bool block)
}
}
+static int virtio_vga_base_get_flags(void *opaque)
+{
+ VirtIOVGABase *vvga = opaque;
+ VirtIOGPUBase *g = vvga->vgpu;
+
+ return g->hw_ops->get_flags(g);
+}
+
static const GraphicHwOps virtio_vga_base_ops = {
+ .get_flags = virtio_vga_base_get_flags,
.invalidate = virtio_vga_base_invalidate_display,
.gfx_update = virtio_vga_base_update_display,
.text_update = virtio_vga_base_text_update,
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index 42d67e8..f04473e 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -335,7 +335,13 @@ static void vfio_display_dmabuf_update(void *opaque)
}
}
+static int vfio_display_get_flags(void *opaque)
+{
+ return GRAPHIC_FLAGS_GL | GRAPHIC_FLAGS_DMABUF;
+}
+
static const GraphicHwOps vfio_display_dmabuf_ops = {
+ .get_flags = vfio_display_get_flags,
.gfx_update = vfio_display_dmabuf_update,
.ui_info = vfio_display_edid_ui_info,
};