[Spice-devel] [PATCH 7/7] worker: move red_record_command
Frediano Ziglio
fziglio at redhat.com
Mon Aug 17 08:34:24 PDT 2015
From: Marc-André Lureau <marcandre.lureau at gmail.com>
---
server/red_record_qxl.c | 35 ++++++++++++++++++++++++++++-------
server/red_record_qxl.h | 18 +++---------------
server/red_worker.c | 32 +++++---------------------------
3 files changed, 36 insertions(+), 49 deletions(-)
diff --git a/server/red_record_qxl.c b/server/red_record_qxl.c
index a72a200..5c27311 100644
--- a/server/red_record_qxl.c
+++ b/server/red_record_qxl.c
@@ -659,8 +659,8 @@ static void red_record_compat_drawable(FILE *fd, RedMemSlotInfo *slots, int grou
};
}
-void red_record_drawable(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr, uint32_t flags)
+static void red_record_drawable(FILE *fd, RedMemSlotInfo *slots, int group_id,
+ QXLPHYSICAL addr, uint32_t flags)
{
fprintf(fd, "drawable\n");
if (flags & QXL_COMMAND_FLAG_COMPAT) {
@@ -670,8 +670,8 @@ void red_record_drawable(FILE *fd, RedMemSlotInfo *slots, int group_id,
}
}
-void red_record_update_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr)
+static void red_record_update_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
+ QXLPHYSICAL addr)
{
QXLUpdateCmd *qxl;
int error;
@@ -685,8 +685,8 @@ void red_record_update_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
fprintf(fd, "surface_id %d\n", qxl->surface_id);
}
-void red_record_message(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr)
+static void red_record_message(FILE *fd, RedMemSlotInfo *slots, int group_id,
+ QXLPHYSICAL addr)
{
QXLMessage *qxl;
int error;
@@ -702,7 +702,7 @@ void red_record_message(FILE *fd, RedMemSlotInfo *slots, int group_id,
write_binary(fd, "message", strlen((char*)qxl->data), (uint8_t*)qxl->data);
}
-void red_record_surface_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
+static void red_record_surface_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
QXLPHYSICAL addr)
{
QXLSurfaceCmd *qxl;
@@ -804,3 +804,24 @@ void red_record_event(FILE *fd, int what, uint32_t type, unsigned long ts)
// (that can be up to VGA_FRAMEBUFFER large)
fprintf(fd, "event %d %d %u %lu\n", counter++, what, type, ts);
}
+
+void red_record_qxl_command(FILE *fd, RedMemSlotInfo *slots,
+ QXLCommandExt ext_cmd, unsigned long ts)
+{
+ red_record_event(fd, 0, ext_cmd.cmd.type, ts);
+
+ switch (ext_cmd.cmd.type) {
+ case QXL_CMD_DRAW:
+ red_record_drawable(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data, ext_cmd.flags);
+ break;
+ case QXL_CMD_UPDATE:
+ red_record_update_cmd(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data);
+ break;
+ case QXL_CMD_MESSAGE:
+ red_record_message(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data);
+ break;
+ case QXL_CMD_SURFACE:
+ red_record_surface_cmd(fd, slots, ext_cmd.group_id, ext_cmd.cmd.data);
+ break;
+ }
+}
diff --git a/server/red_record_qxl.h b/server/red_record_qxl.h
index f7dcdc0..b737db8 100644
--- a/server/red_record_qxl.h
+++ b/server/red_record_qxl.h
@@ -23,24 +23,12 @@
#include "red_common.h"
#include "red_memslots.h"
-void red_record_drawable(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr, uint32_t flags);
-
-void red_record_update_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr);
-
-void red_record_message(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr);
-
-void red_record_surface_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr);
-
-void red_record_cursor_cmd(FILE *fd, RedMemSlotInfo *slots, int group_id,
- QXLPHYSICAL addr);
-
void red_record_dev_input_primary_surface_create(
FILE *fd, QXLDevSurfaceCreate *surface, uint8_t *line_0);
void red_record_event(FILE *fd, int what, uint32_t type, unsigned long ts);
+void red_record_qxl_command(FILE *fd, RedMemSlotInfo *slots,
+ QXLCommandExt ext_cmd, unsigned long ts);
+
#endif
diff --git a/server/red_worker.c b/server/red_worker.c
index 98a39dd..b47472a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -5019,30 +5019,6 @@ static RedDrawable *red_drawable_new(void)
return red;
}
-static void red_record_command(RedWorker *worker, QXLCommandExt ext_cmd)
-{
- red_record_event(worker->record_fd, 0, ext_cmd.cmd.type, stat_now());
-
- switch (ext_cmd.cmd.type) {
- case QXL_CMD_DRAW:
- red_record_drawable(worker->record_fd, &worker->mem_slots, ext_cmd.group_id,
- ext_cmd.cmd.data, ext_cmd.flags);
- break;
- case QXL_CMD_UPDATE:
- red_record_update_cmd(worker->record_fd, &worker->mem_slots, ext_cmd.group_id,
- ext_cmd.cmd.data);
- break;
- case QXL_CMD_MESSAGE:
- red_record_message(worker->record_fd, &worker->mem_slots, ext_cmd.group_id,
- ext_cmd.cmd.data);
- break;
- case QXL_CMD_SURFACE:
- red_record_surface_cmd(worker->record_fd, &worker->mem_slots, ext_cmd.group_id,
- ext_cmd.cmd.data);
- break;
- }
-}
-
static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *ring_is_empty)
{
QXLCommandExt ext_cmd;
@@ -5073,9 +5049,11 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
}
continue;
}
- if (worker->record_fd) {
- red_record_command(worker, ext_cmd);
- }
+
+ if (worker->record_fd)
+ red_record_qxl_command(worker->record_fd, &worker->mem_slots, ext_cmd,
+ stat_now());
+
stat_inc_counter(worker->command_counter, 1);
worker->repoll_cmd_ring = 0;
switch (ext_cmd.cmd.type) {
--
2.4.3
More information about the Spice-devel
mailing list