[Spice-commits] 3 commits - server/red-record-qxl.c server/red-replay-qxl.c server/red-worker.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Mon Jun 6 08:30:43 UTC 2016
server/red-record-qxl.c | 3 +
server/red-replay-qxl.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
server/red-worker.c | 5 +++
3 files changed, 88 insertions(+)
New commits:
commit b46fcbb3ab4a6fc5074a8b59959a608c59ca2712
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jun 2 23:54:09 2016 +0100
replay: Load cursor commands
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 17019f8..b17c38b 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -306,6 +306,14 @@ static void red_replay_point_ptr(SpiceReplay *replay, QXLPoint *qxl)
replay_fscanf(replay, "point %d %d\n", &qxl->x, &qxl->y);
}
+static void red_replay_point16_ptr(SpiceReplay *replay, QXLPoint16 *qxl)
+{
+ int x, y;
+ replay_fscanf(replay, "point16 %d %d\n", &x, &y);
+ qxl->x = x;
+ qxl->y = y;
+}
+
static void red_replay_rect_ptr(SpiceReplay *replay, const char *prefix, QXLRect *qxl)
{
char template[1024];
@@ -1052,6 +1060,69 @@ static void red_replay_surface_cmd_free(SpiceReplay *replay, QXLSurfaceCmd *qxl)
free(qxl);
}
+static QXLCursor *red_replay_cursor(SpiceReplay *replay)
+{
+ int temp;
+ QXLCursor cursor, *qxl = NULL;
+
+ replay_fscanf(replay, "header.unique %"SCNu64"\n", &cursor.header.unique);
+ replay_fscanf(replay, "header.type %d\n", &temp);
+ cursor.header.type = temp;
+ replay_fscanf(replay, "header.width %d\n", &temp);
+ cursor.header.width = temp;
+ replay_fscanf(replay, "header.height %d\n", &temp);
+ cursor.header.height = temp;
+ replay_fscanf(replay, "header.hot_spot_x %d\n", &temp);
+ cursor.header.hot_spot_x = temp;
+ replay_fscanf(replay, "header.hot_spot_y %d\n", &temp);
+ cursor.header.hot_spot_y = temp;
+
+ replay_fscanf(replay, "data_size %d\n", &temp);
+ cursor.data_size = temp;
+ cursor.data_size = red_replay_data_chunks(replay, "cursor", (uint8_t**)&qxl, sizeof(QXLCursor));
+ qxl->header = cursor.header;
+ qxl->data_size = cursor.data_size;
+ return qxl;
+}
+
+static QXLCursorCmd *red_replay_cursor_cmd(SpiceReplay *replay)
+{
+ int temp;
+ QXLCursorCmd *qxl = spice_new0(QXLCursorCmd, 1);
+
+ replay_fscanf(replay, "cursor_cmd\n");
+ replay_fscanf(replay, "type %d\n", &temp);
+ qxl->type = temp;
+ switch (qxl->type) {
+ case QXL_CURSOR_SET:
+ red_replay_point16_ptr(replay, &qxl->u.set.position);
+ replay_fscanf(replay, "u.set.visible %d\n", &temp);
+ qxl->u.set.visible = temp;
+ qxl->u.set.shape = QXLPHYSICAL_FROM_PTR(red_replay_cursor(replay));
+ break;
+ case QXL_CURSOR_MOVE:
+ red_replay_point16_ptr(replay, &qxl->u.position);
+ break;
+ case QXL_CURSOR_TRAIL:
+ replay_fscanf(replay, "u.trail.length %d\n", &temp);
+ qxl->u.trail.length = temp;
+ replay_fscanf(replay, "u.trail.frequency %d\n", &temp);
+ qxl->u.trail.frequency = temp;
+ break;
+ }
+ return qxl;
+}
+
+static void red_replay_cursor_cmd_free(SpiceReplay *replay, QXLCursorCmd *qxl)
+{
+ if (qxl->type == QXL_CURSOR_SET) {
+ QXLCursor *cursor = QXLPHYSICAL_TO_PTR(qxl->u.set.shape);
+ red_replay_data_chunks_free(replay, cursor, sizeof(*cursor));
+ }
+
+ free(qxl);
+}
+
static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
{
QXLDevSurfaceCreate surface = { 0, };
@@ -1148,6 +1219,9 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
case QXL_CMD_SURFACE:
cmd->cmd.data = QXLPHYSICAL_FROM_PTR(red_replay_surface_cmd(replay));
break;
+ case QXL_CMD_CURSOR:
+ cmd->cmd.data = QXLPHYSICAL_FROM_PTR(red_replay_cursor_cmd(replay));
+ break;
}
QXLReleaseInfo *info;
@@ -1155,6 +1229,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
case QXL_CMD_DRAW:
case QXL_CMD_UPDATE:
case QXL_CMD_SURFACE:
+ case QXL_CMD_CURSOR:
info = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
info->id = (uintptr_t)cmd;
}
@@ -1187,6 +1262,11 @@ SPICE_GNUC_VISIBLE void spice_replay_free_cmd(SpiceReplay *replay, QXLCommandExt
red_replay_surface_cmd_free(replay, qxl);
break;
}
+ case QXL_CMD_CURSOR: {
+ QXLCursorCmd *qxl = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
+ red_replay_cursor_cmd_free(replay, qxl);
+ break;
+ }
default:
break;
}
commit 52f9850be8c650f51998c87af2d6cde1909a3788
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu May 19 10:16:18 2016 +0100
worker: Record cursor commands
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-worker.c b/server/red-worker.c
index a14f55d..e754bd2 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -156,6 +156,11 @@ static int red_process_cursor(RedWorker *worker, int *ring_is_empty)
worker->cursor_poll_tries++;
return n;
}
+
+ if (worker->record)
+ red_record_qxl_command(worker->record, &worker->mem_slots, ext_cmd,
+ stat_now(CLOCK_MONOTONIC));
+
worker->cursor_poll_tries = 0;
switch (ext_cmd.cmd.type) {
case QXL_CMD_CURSOR: {
commit 3f4ba5e5f5ea6d0ab0fa2bed47e5fb959a425196
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Mon Jun 6 09:19:39 2016 +0100
record: Support cursor commands
Use red_record_cursor_cmd to be able to record cursor commands.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index 39d6639..5673f7d 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -834,6 +834,9 @@ void red_record_qxl_command(RedRecord *record, RedMemSlotInfo *slots,
case QXL_CMD_SURFACE:
red_record_surface_cmd(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data);
break;
+ case QXL_CMD_CURSOR:
+ red_record_cursor_cmd(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data);
+ break;
}
}
More information about the Spice-commits
mailing list