summaryrefslogtreecommitdiffstats
path: root/hw/display/qxl-render.c
diff options
context:
space:
mode:
authorPeter Maydell2017-09-14 13:58:13 +0200
committerPeter Maydell2017-09-14 13:58:13 +0200
commitbcf9e2c0a5f8de395842e034ca15be13d1fc5f90 (patch)
tree0516090ffe4ea4fb5d33678cffc9ee18d31855f1 /hw/display/qxl-render.c
parenttcg/tci: do not use ldst label (never implemented) (diff)
parentvirtio-gpu: don't clear QemuUIInfo information on reset (diff)
downloadqemu-bcf9e2c0a5f8de395842e034ca15be13d1fc5f90.tar.gz
qemu-bcf9e2c0a5f8de395842e034ca15be13d1fc5f90.tar.xz
qemu-bcf9e2c0a5f8de395842e034ca15be13d1fc5f90.zip
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20170913-pull-request' into staging
vga: bugfixes. qxl: chunked cursor support. # gpg: Signature made Wed 13 Sep 2017 08:41:08 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/vga-20170913-pull-request: virtio-gpu: don't clear QemuUIInfo information on reset vga/migration: Update memory map in post_load qxl: add support for chunked cursors. qxl: drop mono cursor support vga: stop passing pointers to vga_draw_line* functions vga: fix display update region calculation (split screen) Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/display/qxl-render.c')
-rw-r--r--hw/display/qxl-render.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index 9ad9d9e0f5..90e0865618 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -204,10 +204,35 @@ void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie)
g_free(cookie);
}
-static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)
+static void qxl_unpack_chunks(void *dest, size_t size, PCIQXLDevice *qxl,
+ QXLDataChunk *chunk, uint32_t group_id)
+{
+ uint32_t max_chunks = 32;
+ size_t offset = 0;
+ size_t bytes;
+
+ for (;;) {
+ bytes = MIN(size - offset, chunk->data_size);
+ memcpy(dest + offset, chunk->data, bytes);
+ offset += bytes;
+ if (offset == size) {
+ return;
+ }
+ chunk = qxl_phys2virt(qxl, chunk->next_chunk, group_id);
+ if (!chunk) {
+ return;
+ }
+ max_chunks--;
+ if (max_chunks == 0) {
+ return;
+ }
+ }
+}
+
+static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
+ uint32_t group_id)
{
QEMUCursor *c;
- uint8_t *image, *mask;
size_t size;
c = cursor_alloc(cursor->header.width, cursor->header.height);
@@ -216,19 +241,11 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)
switch (cursor->header.type) {
case SPICE_CURSOR_TYPE_ALPHA:
size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;
- memcpy(c->data, cursor->chunk.data, size);
+ qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id);
if (qxl->debug > 2) {
cursor_print_ascii_art(c, "qxl/alpha");
}
break;
- case SPICE_CURSOR_TYPE_MONO:
- mask = cursor->chunk.data;
- image = mask + cursor_get_mono_bpl(c) * c->width;
- cursor_set_mono(c, 0xffffff, 0x000000, image, 1, mask);
- if (qxl->debug > 2) {
- cursor_print_ascii_art(c, "qxl/mono");
- }
- break;
default:
fprintf(stderr, "%s: not implemented: type %d\n",
__FUNCTION__, cursor->header.type);
@@ -268,11 +285,7 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
if (!cursor) {
return 1;
}
- if (cursor->chunk.data_size != cursor->data_size) {
- fprintf(stderr, "%s: multiple chunks\n", __FUNCTION__);
- return 1;
- }
- c = qxl_cursor(qxl, cursor);
+ c = qxl_cursor(qxl, cursor, ext->group_id);
if (c == NULL) {
c = cursor_builtin_left_ptr();
}