[Spice-commits] 4 commits - gtk/channel-base.c gtk/channel-cursor.c gtk/channel-display.c
Alon Levy
alon at kemper.freedesktop.org
Wed Aug 28 08:18:37 PDT 2013
gtk/channel-base.c | 15 +++++++++++++++
gtk/channel-cursor.c | 45 ++++++++++++++++++++++++++++++++++++++-------
gtk/channel-display.c | 2 +-
3 files changed, 54 insertions(+), 8 deletions(-)
New commits:
commit c4428fd886ca344fb77a684028e181236873b05e
Author: Alon Levy <alevy at redhat.com>
Date: Wed Aug 28 16:14:16 2013 +0300
gtk/channel-cursor: copy spicec hack, RHBZ #998529
flip -> unsupported by x11, since XCreatePixmapCursor has no invert
functionality, only a mask, shape, background and foreground colors. Use
this checkerboard hack to get some contrast for cursors in the guest
that relied on invert for the same contrast.
diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index 41ad696..e4a996b 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -259,11 +259,24 @@ static void mono_cursor(display_cursor *cursor, const guint8 *data)
for (x = 0; x < cursor->hdr.width; x++, dest += 4) {
if (and[x/8] & bit) {
if (xor[x/8] & bit) {
- /* flip -> hmm? */
- dest[0] = 0x00;
- dest[1] = 0x00;
- dest[2] = 0x00;
- dest[3] = 0x80;
+ /*
+ * flip -> unsupported by x11, since XCreatePixmapCursor has
+ * no invert functionality, only a mask, shape, background and
+ * foreground colors. Use this checkerboard hack to get some
+ * contrast for cursors in the guest that relied on invert for
+ * the same contrast.
+ */
+ if ((x ^ y) & 1) {
+ dest[0] = 0x30;
+ dest[1] = 0x30;
+ dest[2] = 0x30;
+ dest[3] = 0xc0;
+ } else {
+ dest[0] = 0x50;
+ dest[1] = 0x50;
+ dest[2] = 0x50;
+ dest[3] = 0x30;
+ }
} else {
/* unchanged -> transparent */
dest[0] = 0x00;
commit 630d4d0b2cddefa85aeab796b1859a9d65aaec5d
Author: Alon Levy <alevy at redhat.com>
Date: Wed Aug 28 16:01:15 2013 +0300
gtk/channel-cursor.c: add cursor_type_to_string for debugging
diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
index 99e7a48..41ad696 100644
--- a/gtk/channel-cursor.c
+++ b/gtk/channel-cursor.c
@@ -325,6 +325,23 @@ static void display_cursor_unref(display_cursor *cursor)
g_free(cursor);
}
+static const char *cursor_type_to_string(int type)
+{
+ switch (type) {
+ case SPICE_CURSOR_TYPE_MONO:
+ return "mono";
+ case SPICE_CURSOR_TYPE_ALPHA:
+ return "alpha";
+ case SPICE_CURSOR_TYPE_COLOR32:
+ return "color32";
+ case SPICE_CURSOR_TYPE_COLOR16:
+ return "color16";
+ case SPICE_CURSOR_TYPE_COLOR4:
+ return "color4";
+ }
+ return "unknown";
+}
+
static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
{
SpiceCursorChannelPrivate *c = SPICE_CURSOR_CHANNEL(channel)->priv;
@@ -343,8 +360,9 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor)
if (scursor->flags & SPICE_CURSOR_FLAGS_NONE)
return NULL;
- CHANNEL_DEBUG(channel, "%s: type %d, %" PRIx64 ", %dx%d", __FUNCTION__,
- hdr->type, hdr->unique, hdr->width, hdr->height);
+ CHANNEL_DEBUG(channel, "%s: type %s(%d), %" PRIx64 ", %dx%d", __FUNCTION__,
+ cursor_type_to_string(hdr->type), hdr->type, hdr->unique,
+ hdr->width, hdr->height);
if (scursor->flags & SPICE_CURSOR_FLAGS_FROM_CACHE) {
item = cache_find(&c->cursors, hdr->unique);
commit b7a5abc76d04acb999fcdff0f0139e84f8b14df0
Author: Alon Levy <alevy at redhat.com>
Date: Sun Aug 4 11:58:25 2013 +0200
gtk/channel-display: only use SysV shm for x11
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 14c80d2..75fa8c2 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -746,7 +746,7 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface)
}
CHANNEL_DEBUG(channel, "Create primary canvas");
-#ifdef HAVE_SYS_SHM_H
+#if defined(WITH_X11) && defined(HAVE_SYS_SHM_H)
surface->shmid = shmget(IPC_PRIVATE, surface->size, IPC_CREAT | 0777);
if (surface->shmid >= 0) {
surface->data = shmat(surface->shmid, 0, 0);
commit f670e0197c37b2f12518f6d216642f67cdf5de84
Author: Alon Levy <alevy at redhat.com>
Date: Thu Aug 30 12:02:22 2012 +0300
tmp: debug MIGRATE_DATA
diff --git a/gtk/channel-base.c b/gtk/channel-base.c
index dff3024..2537078 100644
--- a/gtk/channel-base.c
+++ b/gtk/channel-base.c
@@ -145,6 +145,17 @@ get_msg_handler(SpiceChannel *channel, SpiceMsgIn *in, gpointer data)
*msg = in;
}
+static int64_t checksum(uint8_t *message, uint32_t size)
+{
+ uint64_t sum = 0;
+ for (; size; --size, ++message) {
+ printf("%x ", *message);
+ sum += *message;
+ }
+ printf("\n");
+ return sum;
+}
+
/* coroutine context */
G_GNUC_INTERNAL
void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
@@ -176,6 +187,10 @@ void spice_channel_handle_migrate(SpiceChannel *channel, SpiceMsgIn *in)
spice_header_get_msg_type(data->header, c->use_mini_header));
return;
}
+ g_debug("migrate data messagte, len=%d (psize=%zd), checksum=%ld",
+ spice_header_get_msg_size(data->header, c->use_mini_header),
+ data->psize,
+ checksum(data->data, spice_header_get_msg_size(data->header, c->use_mini_header)));
}
/* swapping channels sockets */
More information about the Spice-commits
mailing list