summary refs log tree commit diff stats
path: root/include/hw/virtio/virtio-gpu.h
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2024-11-11 23:00:39 +0000
committerAlex Bennée <alex.bennee@linaro.org>2024-11-18 15:54:43 +0000
commitc873a6569ff08317578c9810ca049f2c70e3ad99 (patch)
treef0e56d807dee2479bebd3f1e73b5790ed387c80f /include/hw/virtio/virtio-gpu.h
parentcca4fc6743d84db4383a64548ada1edc3d80c537 (diff)
downloadfocaccia-qemu-c873a6569ff08317578c9810ca049f2c70e3ad99.tar.gz
focaccia-qemu-c873a6569ff08317578c9810ca049f2c70e3ad99.zip
hw/display: factor out the scanout blob to fb conversion
There are two identical sequences of a code doing the same thing that
raise warnings with Coverity. Before fixing those issues lets factor
out the common code into a helper function we can share.

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20241111230040.68470-2-alex.bennee@linaro.org>
Diffstat (limited to '')
-rw-r--r--include/hw/virtio/virtio-gpu.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 553799b8cc..924eb8737e 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -333,6 +333,21 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g,
                                    struct virtio_gpu_scanout *s,
                                    uint32_t resource_id);
 
+/**
+ * virtio_gpu_scanout_blob_to_fb() - fill out fb based on scanout data
+ * fb: the frame-buffer descriptor to fill out
+ * ss: the scanout blob data
+ * blob_size: size of scanout blob data
+ *
+ * This will check we have enough space for the frame taking into
+ * account that stride for all but the last line.
+ *
+ * Returns true on success, otherwise logs guest error and returns false
+ */
+bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb,
+                                   struct virtio_gpu_set_scanout_blob *ss,
+                                   uint64_t blob_size);
+
 /* virtio-gpu-udmabuf.c */
 bool virtio_gpu_have_udmabuf(void);
 void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res);