[Spice-devel] [PATCH 3/4] replay: fill entire screen with a single color at the end

Frediano Ziglio fziglio at redhat.com
Mon Aug 24 06:20:29 PDT 2015


This fake command allows to free current drawing in red worker to
allow to see possible memory leaks in red worker.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/replay.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/server/tests/replay.c b/server/tests/replay.c
index c35cb52..088b565 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -83,6 +83,30 @@ static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info)
     info->n_surfaces = MAX_SURFACE_NUM;
 }
 
+static QXLCommandExt *create_fill_command(void)
+{
+    int i;
+    QXLCommandExt* cmd = g_malloc0(sizeof(QXLCommandExt));
+    QXLDrawable *qxl = g_malloc0(sizeof(QXLDrawable));
+
+    cmd->cmd.type = QXL_CMD_DRAW;
+    cmd->cmd.data = (QXLPHYSICAL)qxl;
+    cmd->group_id = 0;
+    cmd->flags = 0;
+
+    qxl->type = QXL_DRAW_FILL;
+    qxl->bbox.bottom = 8192;
+    qxl->bbox.right  = 8192;
+    for (i = 0; i < 3; i++)
+        qxl->surfaces_dest[i] = -1;
+    qxl->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;
+    qxl->u.fill.brush.u.color = 0xff0000;
+    qxl->u.fill.rop_descriptor = SPICE_ROPD_OP_PUT;
+    qxl->release_info.id = (uint64_t) cmd;
+
+    return cmd;
+}
+
 static gboolean fill_queue_idle(gpointer user_data)
 {
     gboolean keep = FALSE;
@@ -90,6 +114,7 @@ static gboolean fill_queue_idle(gpointer user_data)
     while (g_async_queue_length(aqueue) < 50) {
         QXLCommandExt *cmd = spice_replay_next_cmd(replay, qxl_worker);
         if (!cmd) {
+            g_async_queue_push(aqueue, create_fill_command());
             g_async_queue_push(aqueue, GINT_TO_POINTER(-1));
             goto end;
         }
-- 
2.4.3



More information about the Spice-devel mailing list