[Spice-devel] [PATCH 1/3] move command flags handling to the qxl parser
Gerd Hoffmann
kraxel at redhat.com
Tue Sep 14 01:45:17 PDT 2010
Pass through command flags to the qxl parser, so we can hide all
compat bits for spice 0.4 within the qxl parser.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
server/red_parse_qxl.c | 18 ++++++++++++++----
server/red_parse_qxl.h | 4 +---
server/red_worker.c | 10 +++-------
3 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index e0eba20..adeadd6 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -734,8 +734,8 @@ static void red_put_clip(SpiceClip *red)
}
}
-void red_get_drawable(RedMemSlotInfo *slots, int group_id,
- RedDrawable *red, QXLPHYSICAL addr)
+static void red_get_native_drawable(RedMemSlotInfo *slots, int group_id,
+ RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
{
QXLDrawable *qxl;
int i;
@@ -807,8 +807,8 @@ void red_get_drawable(RedMemSlotInfo *slots, int group_id,
};
}
-void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
- RedDrawable *red, QXLPHYSICAL addr)
+static void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
+ RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
{
QXLCompatDrawable *qxl;
@@ -885,6 +885,16 @@ void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
};
}
+void red_get_drawable(RedMemSlotInfo *slots, int group_id,
+ RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
+{
+ if (flags & QXL_COMMAND_FLAG_COMPAT) {
+ red_get_compat_drawable(slots, group_id, red, addr, flags);
+ } else {
+ red_get_native_drawable(slots, group_id, red, addr, flags);
+ }
+}
+
void red_put_drawable(RedDrawable *red)
{
red_put_clip(&red->clip);
diff --git a/server/red_parse_qxl.h b/server/red_parse_qxl.h
index 1d97249..5de0325 100644
--- a/server/red_parse_qxl.h
+++ b/server/red_parse_qxl.h
@@ -113,9 +113,7 @@ typedef struct RedCursorCmd {
void red_get_rect_ptr(SpiceRect *red, QXLRect *qxl);
void red_get_drawable(RedMemSlotInfo *slots, int group_id,
- RedDrawable *red, QXLPHYSICAL addr);
-void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
- RedDrawable *red, QXLPHYSICAL addr);
+ RedDrawable *red, QXLPHYSICAL addr, uint32_t flags);
void red_put_drawable(RedDrawable *red);
void red_put_image(SpiceImage *red);
diff --git a/server/red_worker.c b/server/red_worker.c
index 74d26fe..f4e6f7c 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4350,13 +4350,9 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
switch (ext_cmd.cmd.type) {
case QXL_CMD_DRAW: {
RedDrawable *drawable = spice_new0(RedDrawable, 1);
- if (ext_cmd.flags & QXL_COMMAND_FLAG_COMPAT) {
- red_get_compat_drawable(&worker->mem_slots, ext_cmd.group_id,
- drawable, ext_cmd.cmd.data);
- } else {
- red_get_drawable(&worker->mem_slots, ext_cmd.group_id,
- drawable, ext_cmd.cmd.data);
- }
+
+ red_get_drawable(&worker->mem_slots, ext_cmd.group_id,
+ drawable, ext_cmd.cmd.data, ext_cmd.flags);
red_process_drawable(worker, drawable, ext_cmd.group_id);
break;
}
--
1.7.1
More information about the Spice-devel
mailing list