qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 16/27] vhost-user-gpu: add vg_send_disable_scanout()


From: marcandre . lureau
Subject: [PATCH 16/27] vhost-user-gpu: add vg_send_disable_scanout()
Date: Fri, 12 Mar 2021 14:00:57 +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 | 24 ++++++++++++++++--------
 contrib/vhost-user-gpu/virgl.c          |  8 +-------
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/contrib/vhost-user-gpu/vugpu.h b/contrib/vhost-user-gpu/vugpu.h
index 04d5615812..e19abb670d 100644
--- a/contrib/vhost-user-gpu/vugpu.h
+++ b/contrib/vhost-user-gpu/vugpu.h
@@ -179,5 +179,6 @@ void    vg_send_msg(VuGpu *g, const VhostUserGpuMsg *msg, 
int fd);
 bool    vg_recv_msg(VuGpu *g, uint32_t expect_req, uint32_t expect_size,
                     gpointer payload);
 
+void    vg_send_disable_scanout(VuGpu *g, int scanout_id);
 
 #endif
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c 
b/contrib/vhost-user-gpu/vhost-user-gpu.c
index f73f292c9f..69fedd376b 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -356,6 +356,21 @@ vg_resource_create_2d(VuGpu *g,
     QTAILQ_INSERT_HEAD(&g->reslist, res, next);
 }
 
+void
+vg_send_disable_scanout(VuGpu *g, int scanout_id)
+{
+    g_debug("send disable scanout %d", scanout_id);
+
+    if (g->sock_fd >= 0) {
+        VhostUserGpuMsg msg = {
+            .request = VHOST_USER_GPU_SCANOUT,
+            .size = sizeof(VhostUserGpuScanout),
+            .payload.scanout.scanout_id = scanout_id,
+        };
+        vg_send_msg(g, &msg, -1);
+    }
+}
+
 static void
 vg_disable_scanout(VuGpu *g, int scanout_id)
 {
@@ -374,14 +389,7 @@ vg_disable_scanout(VuGpu *g, int scanout_id)
     scanout->width = 0;
     scanout->height = 0;
 
-    if (g->sock_fd >= 0) {
-        VhostUserGpuMsg msg = {
-            .request = VHOST_USER_GPU_SCANOUT,
-            .size = sizeof(VhostUserGpuScanout),
-            .payload.scanout.scanout_id = scanout_id,
-        };
-        vg_send_msg(g, &msg, -1);
-    }
+    vg_send_disable_scanout(g, scanout_id);
 }
 
 static void
diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
index 9e6660c7ab..fe153425f5 100644
--- a/contrib/vhost-user-gpu/virgl.c
+++ b/contrib/vhost-user-gpu/virgl.c
@@ -354,13 +354,7 @@ virgl_cmd_set_scanout(VuGpu *g,
         vg_send_msg(g, &msg, fd);
         close(fd);
     } else {
-        VhostUserGpuMsg msg = {
-            .request = VHOST_USER_GPU_DMABUF_SCANOUT,
-            .size = sizeof(VhostUserGpuDMABUFScanout),
-            .payload.dmabuf_scanout.scanout_id = ss.scanout_id,
-        };
-        g_debug("disable scanout");
-        vg_send_msg(g, &msg, -1);
+        vg_send_disable_scanout(g, ss.scanout_id);
     }
     g->scanout[ss.scanout_id].resource_id = ss.resource_id;
 }
-- 
2.29.0




reply via email to

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