[Spice-devel] [RFC] shared memory support in display channel

Alon Levy alevy at redhat.com
Tue Aug 13 11:33:05 PDT 2013


see spice protocol commit "add shared memory display channel support" for the
design.

This commit adds messages to support sharing the primary surface between the remote client for the display channel and the server.

This commit updates the spice-protocol submodule as well.
---
 common/client_marshallers.h |  1 +
 common/messages.h           | 22 ++++++++++++++++++++++
 spice-protocol              |  2 +-
 spice.proto                 | 26 +++++++++++++++++++++++++-
 4 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/common/client_marshallers.h b/common/client_marshallers.h
index 85051a0..01113d7 100644
--- a/common/client_marshallers.h
+++ b/common/client_marshallers.h
@@ -45,6 +45,7 @@ typedef struct {
     void (*msgc_main_migrate_dst_do_seamless)(SpiceMarshaller *m, SpiceMsgcMainMigrateDstDoSeamless *msg);
     void (*msgc_display_init)(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg);
     void (*msgc_display_stream_report)(SpiceMarshaller *m, SpiceMsgcDisplayStreamReport *msg);
+    void (*msgc_display_shm_reply)(SpiceMarshaller *m, SpiceMsgcDisplayShmReply *msg);
     void (*msgc_inputs_key_down)(SpiceMarshaller *m, SpiceMsgcKeyDown *msg);
     void (*msgc_inputs_key_up)(SpiceMarshaller *m, SpiceMsgcKeyUp *msg);
     void (*msgc_inputs_key_modifiers)(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg);
diff --git a/common/messages.h b/common/messages.h
index a8a0eee..aa31e26 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -233,6 +233,15 @@ typedef struct SpiceMsgSurfaceCreate {
     uint32_t flags;
 } SpiceMsgSurfaceCreate;
 
+typedef struct SpiceMsgSurfaceCreateShm {
+    uint64_t shm_offset;
+    uint32_t surface_id;
+    uint32_t width;
+    uint32_t height;
+    uint32_t format;
+    uint32_t flags;
+} SpiceMsgSurfaceCreateShm;
+
 typedef struct SpiceMsgSurfaceDestroy {
     uint32_t surface_id;
 } SpiceMsgSurfaceDestroy;
@@ -630,6 +639,19 @@ typedef struct SpiceMsgcPortEvent {
     uint8_t event;
 } SpiceMsgcPortEvent;
 
+typedef struct SpiceMsgcDisplayShmReply {
+    uint8_t accepted;
+} SpiceMsgcDisplayShmReply;
+
+typedef struct SpiceMsgDisplayShmOffer {
+    uint8_t name[128];
+} SpiceMsgDisplayShmOffer;
+
+typedef struct SpiceMsgDisplayShmDamage {
+    SpiceRect box;
+    SpiceClip clip;
+} SpiceMsgDisplayShmDamage;
+
 SPICE_END_DECLS
 
 #endif /* _H_SPICE_PROTOCOL */
diff --git a/spice-protocol b/spice-protocol
index 7be0e88..8c370b6 160000
--- a/spice-protocol
+++ b/spice-protocol
@@ -1 +1 @@
-Subproject commit 7be0e88e7e03a956b364cc847aad11b96ed47273
+Subproject commit 8c370b6a012993d1228302e6ce30a5ef5c57761d
diff --git a/spice.proto b/spice.proto
index 5eede6b..0e94a12 100644
--- a/spice.proto
+++ b/spice.proto
@@ -425,7 +425,8 @@ flags8 string_flags {
 };
 
 flags32 surface_flags {
-    PRIMARY
+    PRIMARY,
+    TOP_DOWN,
 };
 
 enum32 surface_fmt {
@@ -897,6 +898,25 @@ channel DisplayChannel : BaseChannel {
         uint32 timeout_ms;
     } stream_activate_report;
 
+    message {
+        uint8 name[128];
+    } shm_offer;
+
+    message {
+        /* TODO: does it make sense to care about surface_id != 0? */
+        Rect box;
+        Clip clip;
+    } shm_damage;
+
+    message {
+    uint64 shm_offset;
+	uint32 surface_id;
+	uint32 width;
+	uint32 height;
+	surface_fmt format;
+	surface_flags flags;
+    } @ctype(SpiceMsgSurfaceCreateShm) surface_create_shm;
+
  client:
     message {
 	uint8 pixmap_cache_id;
@@ -915,6 +935,10 @@ channel DisplayChannel : BaseChannel {
         int32 last_frame_delay;
         uint32 audio_delay;
     } stream_report;
+
+    message {
+        uint8 accepted; // 0 not accepted, 1 accepted
+    } shm_reply;
 };
 
 flags16 keyboard_modifier_flags {
-- 
1.8.3.1



More information about the Spice-devel mailing list