[Spice-devel] [PATCH 2/6] qxl abi: parse QXLCompatDrawable.
Gerd Hoffmann
kraxel at redhat.com
Wed Jun 23 04:03:43 PDT 2010
---
server/red_parse_qxl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
server/red_parse_qxl.h | 2 +
server/red_worker.c | 9 ++++++-
3 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index b22cb83..aafd75a 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -82,6 +82,59 @@ void red_get_drawable(RedMemSlotInfo *slots, int group_id,
};
}
+void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
+ RedDrawable *red, SPICE_ADDRESS addr)
+{
+ QXLCompatDrawable *qxl;
+
+ qxl = (QXLCompatDrawable *)get_virt(slots, addr, sizeof(*qxl), group_id);
+ red->release_info = &qxl->release_info;
+
+ red->bbox = qxl->bbox;
+ red->clip = qxl->clip;
+ red->effect = qxl->effect;
+ red->mm_time = qxl->mm_time;
+
+ red->type = qxl->type;
+ switch (red->type) {
+ case QXL_DRAW_ALPHA_BLEND:
+ red->u.alpha_blend = qxl->u.alpha_blend;
+ break;
+ case QXL_DRAW_BLACKNESS:
+ red->u.blackness = qxl->u.blackness;
+ break;
+ case QXL_DRAW_BLEND:
+ red->u.blend = qxl->u.blend;
+ break;
+ case QXL_DRAW_COPY:
+ red->u.copy = qxl->u.copy;
+ break;
+ case QXL_DRAW_FILL:
+ red->u.fill = qxl->u.fill;
+ break;
+ case QXL_DRAW_INVERS:
+ red->u.invers = qxl->u.invers;
+ break;
+ case QXL_DRAW_NOP:
+ break;
+ case QXL_DRAW_ROP3:
+ red->u.rop3 = qxl->u.rop3;
+ break;
+ case QXL_DRAW_STROKE:
+ red->u.stroke = qxl->u.stroke;
+ break;
+ case QXL_DRAW_TEXT:
+ red->u.text = qxl->u.text;
+ break;
+ case QXL_DRAW_TRANSPARENT:
+ red->u.transparent = qxl->u.transparent;
+ break;
+ case QXL_DRAW_WHITENESS:
+ red->u.whiteness = qxl->u.whiteness;
+ break;
+ };
+}
+
void red_put_drawable(RedDrawable *red)
{
/* nothing yet */
diff --git a/server/red_parse_qxl.h b/server/red_parse_qxl.h
index d8955d2..5737b55 100644
--- a/server/red_parse_qxl.h
+++ b/server/red_parse_qxl.h
@@ -55,6 +55,8 @@ typedef struct SPICE_ATTR_PACKED RedDrawable {
void red_get_drawable(RedMemSlotInfo *slots, int group_id,
RedDrawable *red, SPICE_ADDRESS addr);
+void red_get_compat_drawable(RedMemSlotInfo *slots, int group_id,
+ RedDrawable *red, SPICE_ADDRESS addr);
void red_put_drawable(RedDrawable *red);
#endif
diff --git a/server/red_worker.c b/server/red_worker.c
index 3cea558..55d69a4 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -5041,8 +5041,13 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size)
switch (ext_cmd.cmd.type) {
case QXL_CMD_DRAW: {
RedDrawable *drawable = spice_new0(RedDrawable, 1);
- red_get_drawable(&worker->mem_slots, ext_cmd.group_id,
- drawable, ext_cmd.cmd.data);
+ 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_process_drawable(worker, drawable, ext_cmd.group_id);
break;
}
--
1.6.5.2
More information about the Spice-devel
mailing list