[Spice-commits] 5 commits - server/red_memslots.c server/red_memslots.h server/red_worker.c server/tests
Alon Levy
alon at kemper.freedesktop.org
Thu Mar 22 02:16:00 PDT 2012
server/red_memslots.c | 29 +++++++++--------------------
server/red_memslots.h | 13 ++++---------
server/red_worker.c | 3 +--
server/tests/test_display_base.c | 10 +++++-----
4 files changed, 19 insertions(+), 36 deletions(-)
New commits:
commit c36bf55971ec7422b83d31f23cb28afaf370c515
Author: Alon Levy <alevy at redhat.com>
Date: Tue Mar 20 19:23:03 2012 +0200
server/tests/test_display_base: remove 64bit arch assumptions
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 92a4043..3c08b0f 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -496,7 +496,7 @@ static void do_wakeup(void *opaque)
static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info)
{
- QXLCommandExt *ext = (void*)release_info.info->id;
+ QXLCommandExt *ext = (unsigned long)release_info.info->id;
//printf("%s\n", __func__);
ASSERT(release_info.group_id == MEM_SLOT_GROUP_ID);
switch (ext->cmd.type) {
@@ -507,7 +507,7 @@ static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_
free(ext);
break;
case QXL_CMD_CURSOR: {
- QXLCursorCmd *cmd = (QXLCursorCmd *)ext->cmd.data;
+ QXLCursorCmd *cmd = (unsigned long)ext->cmd.data;
if (cmd->type == QXL_CURSOR_SET) {
free(cmd);
}
@@ -563,14 +563,14 @@ static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
cmd = calloc(sizeof(QXLCommandExt), 1);
cursor_cmd = calloc(sizeof(QXLCursorCmd), 1);
- cursor_cmd->release_info.id = (uint64_t)cmd;
+ cursor_cmd->release_info.id = (unsigned long)cmd;
if (set) {
cursor_cmd->type = QXL_CURSOR_SET;
cursor_cmd->u.set.position.x = 0;
cursor_cmd->u.set.position.y = 0;
cursor_cmd->u.set.visible = TRUE;
- cursor_cmd->u.set.shape = (uint64_t)&cursor;
+ cursor_cmd->u.set.shape = (unsigned long)&cursor;
// Only a white rect (32x32) as cursor
memset(cursor.data, 255, sizeof(cursor.data));
set = 0;
@@ -580,7 +580,7 @@ static int get_cursor_command(QXLInstance *qin, struct QXLCommandExt *ext)
cursor_cmd->u.position.y = y++ % HEIGHT;
}
- cmd->cmd.data = (uint64_t)cursor_cmd;
+ cmd->cmd.data = (unsigned long)cursor_cmd;
cmd->cmd.type = QXL_CMD_CURSOR;
cmd->group_id = MEM_SLOT_GROUP_ID;
cmd->flags = 0;
commit aef7eaf9bbe9018d56a34760b74a9cfa365d893b
Author: Alon Levy <alevy at redhat.com>
Date: Tue Mar 20 19:00:49 2012 +0200
server/red_memslots: don't assume 64 bit environment
assumption that unsigned long == QXLPHYSICAL causes get_virt to compute
the wrong slot. Fix by replacing addr variables to be of type
QXLPHYSICAL.
diff --git a/server/red_memslots.c b/server/red_memslots.c
index 8c8f3cc..249b241 100644
--- a/server/red_memslots.c
+++ b/server/red_memslots.c
@@ -19,10 +19,12 @@
#include <config.h>
#endif
+#include <inttypes.h>
+
#include "red_common.h"
#include "red_memslots.h"
-static unsigned long __get_clean_virt(RedMemSlotInfo *info, unsigned long addr)
+static unsigned long __get_clean_virt(RedMemSlotInfo *info, QXLPHYSICAL addr)
{
return addr & info->memslot_clean_virt_mask;
}
@@ -46,7 +48,7 @@ static void print_memslots(RedMemSlotInfo *info)
}
}
-unsigned long get_virt_delta(RedMemSlotInfo *info, unsigned long addr, int group_id)
+unsigned long get_virt_delta(RedMemSlotInfo *info, QXLPHYSICAL addr, int group_id)
{
MemSlot *slot;
int slot_id;
@@ -107,7 +109,7 @@ unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size
slot_id = get_memslot_id(info, addr);
if (slot_id > info->num_memslots) {
print_memslots(info);
- PANIC("slot_id too big, addr=%lx", addr);
+ PANIC("slot_id too big, addr=%" PRIx64, addr);
}
slot = &info->mem_slots[group_id][slot_id];
@@ -165,10 +167,11 @@ void red_memslot_info_init(RedMemSlotInfo *info,
info->mem_slots[i] = spice_new0(MemSlot, num_slots);
}
+ /* TODO: use QXLPHYSICAL_BITS */
info->memslot_id_shift = 64 - info->mem_slot_bits;
info->memslot_gen_shift = 64 - (info->mem_slot_bits + info->generation_bits);
- info->memslot_gen_mask = ~((unsigned long)-1 << info->generation_bits);
- info->memslot_clean_virt_mask = (((unsigned long)(-1)) >>
+ info->memslot_gen_mask = ~((QXLPHYSICAL)-1 << info->generation_bits);
+ info->memslot_clean_virt_mask = (((QXLPHYSICAL)(-1)) >>
(info->mem_slot_bits + info->generation_bits));
}
diff --git a/server/red_memslots.h b/server/red_memslots.h
index 75754d0..d50587f 100644
--- a/server/red_memslots.h
+++ b/server/red_memslots.h
@@ -53,10 +53,10 @@ static inline int get_generation(RedMemSlotInfo *info, uint64_t addr)
return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask;
}
-unsigned long get_virt_delta(RedMemSlotInfo *info, unsigned long addr, int group_id);
+unsigned long get_virt_delta(RedMemSlotInfo *info, QXLPHYSICAL addr, int group_id);
void validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
uint32_t add_size, uint32_t group_id);
-unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_size,
+unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
int group_id);
void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out);
commit 07f55e49f509d1664620c266dd7a9517846d3409
Author: Alon Levy <alevy at redhat.com>
Date: Tue Mar 20 18:59:21 2012 +0200
server/red_worker: fix for case where ASSERT is compiled out
diff --git a/server/red_worker.c b/server/red_worker.c
index 0d09622..45260ee 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -8374,9 +8374,8 @@ static void red_display_marshall_stream_clip(RedChannelClient *rcc,
{
DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
StreamAgent *agent = item->stream_agent;
- Stream *stream = agent->stream;
- ASSERT(stream);
+ ASSERT(agent->stream);
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CLIP, &item->base);
SpiceMsgDisplayStreamClip stream_clip;
commit 5391736c29c5452252a5f00833ea76087e7c8a71
Author: Alon Levy <alevy at redhat.com>
Date: Wed Mar 21 17:57:32 2012 +0200
server/red_memslots: use QXLPHYSICAL for addresses
Cannot assume unsigned long == QXLPHYSICAL, not true for 32 bit
architectures.
diff --git a/server/red_memslots.c b/server/red_memslots.c
index 5057218..8c8f3cc 100644
--- a/server/red_memslots.c
+++ b/server/red_memslots.c
@@ -91,7 +91,7 @@ void validate_virt(RedMemSlotInfo *info, unsigned long virt, int slot_id,
}
}
-unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_size,
+unsigned long get_virt(RedMemSlotInfo *info, QXLPHYSICAL addr, uint32_t add_size,
int group_id)
{
int slot_id;
diff --git a/server/red_memslots.h b/server/red_memslots.h
index 7aea0a3..75754d0 100644
--- a/server/red_memslots.h
+++ b/server/red_memslots.h
@@ -43,12 +43,12 @@ typedef struct RedMemSlotInfo {
unsigned long memslot_clean_virt_mask;
} RedMemSlotInfo;
-static inline int get_memslot_id(RedMemSlotInfo *info, unsigned long addr)
+static inline int get_memslot_id(RedMemSlotInfo *info, uint64_t addr)
{
return addr >> info->memslot_id_shift;
}
-static inline int get_generation(RedMemSlotInfo *info, unsigned long addr)
+static inline int get_generation(RedMemSlotInfo *info, uint64_t addr)
{
return (addr >> info->memslot_gen_shift) & info->memslot_gen_mask;
}
commit f360273614ac06493ea5a9d501036fa36d3224ee
Author: Alon Levy <alevy at redhat.com>
Date: Wed Mar 21 17:55:23 2012 +0200
server/red_memslots: drop two unused functions
cb_get_virt and cb_validate_virt have disappeared a long time ago,
not needed since:
commit 5ac88aa79fa6445f96e5419d8bf4fce81da63b90
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Thu Jul 1 17:55:33 2010 +0200
Properly parse QXLImage to the new-world SpiceImage
SpiceImage now replaces RedImage and has all image types in it.
All image data are now chunked (and as such not copied when demarshalling).
diff --git a/server/red_memslots.c b/server/red_memslots.c
index d98f38c..5057218 100644
--- a/server/red_memslots.c
+++ b/server/red_memslots.c
@@ -127,20 +127,6 @@ unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_si
return h_virt;
}
-void *cb_get_virt(void *opaque, unsigned long addr,
- uint32_t add_size, uint32_t group_id)
-{
- return (void *)get_virt((RedMemSlotInfo *)opaque, addr, add_size, group_id);
-}
-
-void cb_validate_virt(void *opaque,
- unsigned long virt, unsigned long from_addr,
- uint32_t add_size, uint32_t group_id)
-{
- int slot_id = get_memslot_id((RedMemSlotInfo *)opaque, from_addr);
- validate_virt((RedMemSlotInfo *)opaque, virt, slot_id, add_size, group_id);
-}
-
void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out)
{
QXLDataChunk *chunk;
diff --git a/server/red_memslots.h b/server/red_memslots.h
index 18d5208..7aea0a3 100644
--- a/server/red_memslots.h
+++ b/server/red_memslots.h
@@ -60,11 +60,6 @@ unsigned long get_virt(RedMemSlotInfo *info, unsigned long addr, uint32_t add_si
int group_id);
void *validate_chunk (RedMemSlotInfo *info, QXLPHYSICAL data, uint32_t group_id, uint32_t *data_size_out, QXLPHYSICAL *next_out);
-void *cb_get_virt(void *opaque, unsigned long addr,
- uint32_t add_size, uint32_t group_id);
-void cb_validate_virt(void *opaque,
- unsigned long virt, unsigned long from_addr,
- uint32_t add_size, uint32_t group_id);
void red_memslot_info_init(RedMemSlotInfo *info,
uint32_t num_groups, uint32_t num_slots,
uint8_t generation_bits,
More information about the Spice-commits
mailing list