From a7dfbe289ede8adb253d735daef88a39709053dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 4 Feb 2021 14:52:23 +0400 Subject: ui: add an optional get_flags callback to GraphicHwOps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those flags can be used to express different requirements for the display or other needs. Signed-off-by: Marc-André Lureau Message-Id: <20210204105232.834642-12-marcandre.lureau@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-base.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'hw/display/virtio-gpu-base.c') diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 40ccd00f94..f27a6fbe75 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, -- cgit v1.2.3