[PATCH 6/6] protocol: add unix GL scanout messages

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

 



From: Marc-Andre Lureau <marcandre.lureau@xxxxxxxxx>

Add 2 new messages to the display channel to stream pre-rendered GL
images of the display. This is only possible when the client supports
SPICE_DISPLAY_CAP_GL_SCANOUT capability.

The first message, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, sends a gl image
file handle via socket ancillary data, and can be imported in a GL
context with the help of eglCreateImageKHR() (as with the 2d canvas, the
SPICE_MSG_DISPLAY_MONITORS_CONFIG will give the monitors
coordinates (x/y/w/h) within the image). There can be only one scanount
per display channel.

A SPICE_MSG_DISPLAY_GL_DRAW message is sent with the coordinate of the
region within the scanount to (re)draw on the client display. For each
draw, once the client is done with the rendering, it must acknowldge it
by sending a SPICE_MSGC_DISPLAY_GL_DRAW_DONE message, in order to
release the context (it is expected to improve this in the future with a
cross-process GL fence).

The relation with the existing display channel messages is that all
other messages are unchanged: the last drawing command received must be
displayed. However the scanout display is all or nothing. Consequently,
if a 2d canvas draw is received, the display must be switched to the
drawn canvas. In other words, if the last message received is a GL draw
the display should switch to the GL display, if it's a 2d draw message
the display should be switched to the client 2d canvas.

(there will probably be a stipped-down "gl-only" channel in the future,
or support for other streaming methods, but this protocol change should
be enough for basic virgl or other gpu-accelerated support)

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

(cherry picked from spice-protocol commit 3fc2221e965623c5a7e50d95f1623269a067c2d3)

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 spice.proto | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/spice.proto b/spice.proto
index 3bca900..af970f2 100644
--- a/spice.proto
+++ b/spice.proto
@@ -678,6 +678,10 @@ struct Head {
     uint32 flags;
 };
 
+flags32 gl_scanout_flags {
+    Y0TOP
+};
+
 channel DisplayChannel : BaseChannel {
  server:
     message {
@@ -915,6 +919,23 @@ channel DisplayChannel : BaseChannel {
         uint32 timeout_ms;
     } stream_activate_report;
 
+    message {
+        unix_fd drm_dma_buf_fd;
+        uint32 width;
+        uint32 height;
+        uint32 stride;
+        /* specifies the format of drm_dma_buf_fd defined in drm_fourcc.h */
+        uint32 drm_fourcc_format;
+        gl_scanout_flags flags;
+    } gl_scanout_unix;
+
+    message {
+        uint32 x;
+        uint32 y;
+        uint32 w;
+        uint32 h;
+    } gl_draw;
+
  client:
     message {
 	uint8 pixmap_cache_id;
@@ -937,6 +958,9 @@ channel DisplayChannel : BaseChannel {
     message {
         image_compression image_compression;
     } preferred_compression;
+
+    message {
+    } gl_draw_done;
 };
 
 flags16 keyboard_modifier_flags {
-- 
2.5.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]