summary refs log tree commit diff stats
path: root/include/ui/surface.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2024-10-08 16:50:21 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2024-10-14 17:34:09 +0400
commitec818df0005d1598d249f0cfea557226b6ad89a6 (patch)
tree897d6527cc04984e29ab102f48a2d9aaf9e43425 /include/ui/surface.h
parent28a3ca04782c5b72b85e197ccfab287a66ce76cb (diff)
downloadfocaccia-qemu-ec818df0005d1598d249f0cfea557226b6ad89a6.tar.gz
focaccia-qemu-ec818df0005d1598d249f0cfea557226b6ad89a6.zip
ui/surface: allocate shared memory on !win32
Use qemu_memfd_alloc() to allocate the display surface memory, which
will fallback on tmpfile/mmap() on systems without memfd, and allow to
share the display with other processes.

This is similar to how display memory is allocated on win32 since commit
09b4c198 ("console/win32: allocate shareable display surface").

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-13-marcandre.lureau@redhat.com>
Diffstat (limited to 'include/ui/surface.h')
-rw-r--r--include/ui/surface.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/ui/surface.h b/include/ui/surface.h
index 345b19169d..37d03be4af 100644
--- a/include/ui/surface.h
+++ b/include/ui/surface.h
@@ -26,6 +26,9 @@ typedef struct DisplaySurface {
 #ifdef WIN32
     HANDLE handle;
     uint32_t handle_offset;
+#else
+    int shmfd;
+    uint32_t shmfd_offset;
 #endif
 } DisplaySurface;
 
@@ -40,6 +43,9 @@ DisplaySurface *qemu_create_placeholder_surface(int w, int h,
 #ifdef WIN32
 void qemu_displaysurface_win32_set_handle(DisplaySurface *surface,
                                           HANDLE h, uint32_t offset);
+#else
+void qemu_displaysurface_set_shmfd(DisplaySurface *surface,
+                                   int shmfd, uint32_t offset);
 #endif
 
 DisplaySurface *qemu_create_displaysurface(int width, int height);