qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 19/27] vhost-user-gpu: add vg_send_scanout()


From: marcandre . lureau
Subject: [PATCH 19/27] vhost-user-gpu: add vg_send_scanout()
Date: Fri, 12 Mar 2021 14:01:00 +0400

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 contrib/vhost-user-gpu/vugpu.h          |  1 +
 contrib/vhost-user-gpu/vhost-user-gpu.c | 27 ++++++++++++++++---------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h
index f2e80d255d..bf513e9295 100644
--- a/contrib/vhost-user-gpu/vugpu.h
+++ b/contrib/vhost-user-gpu/vugpu.h
@@ -194,5 +194,6 @@ void    vg_send_dmabuf_update(VuGpu *g,
                               uint32_t y,
                               uint32_t width,
                               uint32_t height);
+void    vg_send_scanout(VuGpu *g, uint32_t scanout_id);
 
 #endif
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c 
b/contrib/vhost-user-gpu/vhost-user-gpu.c
index fc8e62f20e..a11f406350 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -638,6 +638,22 @@ vg_send_dmabuf_update(VuGpu *g,
     vg_send_msg(g, &msg, -1);
 }
 
+void
+vg_send_scanout(VuGpu *g, uint32_t scanout_id)
+{
+    struct virtio_gpu_scanout *scanout = &g->scanout[scanout_id];
+    VhostUserGpuMsg msg = {
+        .request = VHOST_USER_GPU_SCANOUT,
+        .size = sizeof(VhostUserGpuScanout),
+        .payload.scanout = (VhostUserGpuScanout) {
+            .scanout_id = scanout_id,
+            .width = scanout->width,
+            .height = scanout->height
+        }
+    };
+    vg_send_msg(g, &msg, -1);
+}
+
 static void
 vg_set_scanout(VuGpu *g,
                struct virtio_gpu_ctrl_command *cmd)
@@ -714,16 +730,7 @@ vg_set_scanout(VuGpu *g,
             close(fd);
         }
     } else {
-        VhostUserGpuMsg msg = {
-            .request = VHOST_USER_GPU_SCANOUT,
-            .size = sizeof(VhostUserGpuScanout),
-            .payload.scanout = (VhostUserGpuScanout) {
-                .scanout_id = ss.scanout_id,
-                .width = scanout->width,
-                .height = scanout->height
-            }
-        };
-        vg_send_msg(g, &msg, -1);
+        vg_send_scanout(g, ss.scanout_id);
     }
 }
 
-- 
2.29.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]