All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors.
@ 2017-08-24  8:13 Gerd Hoffmann
  2017-08-24  8:13 ` [Qemu-devel] [PATCH 1/2] qxl: drop mono cursor support Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2017-08-24  8:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: René Rebe, Gerd Hoffmann

This series adds support for unpacking qxl chunks, and uses it to
support chunked cursor images.  Windows guest drivers seem to use
that when in HiDPI mode.

Also drop (broken) support for mono cursors.

Gerd Hoffmann (2):
  qxl: drop mono cursor support
  qxl: add support for chunked cursors.

 hw/display/qxl-render.c | 42 ++++++++++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 16 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] qxl: drop mono cursor support
  2017-08-24  8:13 [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors Gerd Hoffmann
@ 2017-08-24  8:13 ` Gerd Hoffmann
  2017-08-24  8:13 ` [Qemu-devel] [PATCH 2/2] qxl: add support for chunked cursors Gerd Hoffmann
  2017-08-24  8:40 ` [Qemu-devel] [PATCH 0/2] " no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2017-08-24  8:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: René Rebe, Gerd Hoffmann

The chunk size sanity check in qxl_render_cursor works for
SPICE_CURSOR_TYPE_ALPHA cursors only.  So support for
SPICE_CURSOR_TYPE_MONO cursors must be broken for ages without anyone
noticing.  Most likely it simply isn't used any more by guest drivers.
Drop the dead code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl-render.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index 9ad9d9e0f5..e1b3f05ecb 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -207,7 +207,6 @@ void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie)
 static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)
 {
     QEMUCursor *c;
-    uint8_t *image, *mask;
     size_t size;
 
     c = cursor_alloc(cursor->header.width, cursor->header.height);
@@ -221,14 +220,6 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)
             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);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] qxl: add support for chunked cursors.
  2017-08-24  8:13 [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors Gerd Hoffmann
  2017-08-24  8:13 ` [Qemu-devel] [PATCH 1/2] qxl: drop mono cursor support Gerd Hoffmann
@ 2017-08-24  8:13 ` Gerd Hoffmann
  2017-08-24  8:40 ` [Qemu-devel] [PATCH 0/2] " no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2017-08-24  8:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: René Rebe, Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl-render.c | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index e1b3f05ecb..b2c98f90c0 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -204,7 +204,30 @@ 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;
     size_t size;
@@ -215,7 +238,7 @@ 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");
         }
@@ -259,11 +282,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();
         }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors.
  2017-08-24  8:13 [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors Gerd Hoffmann
  2017-08-24  8:13 ` [Qemu-devel] [PATCH 1/2] qxl: drop mono cursor support Gerd Hoffmann
  2017-08-24  8:13 ` [Qemu-devel] [PATCH 2/2] qxl: add support for chunked cursors Gerd Hoffmann
@ 2017-08-24  8:40 ` no-reply
  2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2017-08-24  8:40 UTC (permalink / raw)
  To: kraxel; +Cc: famz, qemu-devel, rene

Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20170824081305.8445-1-kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors.

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
008bbacb9b qxl: add support for chunked cursors.
1b9a2e39e8 qxl: drop mono cursor support

=== OUTPUT BEGIN ===
Checking PATCH 1/2: qxl: drop mono cursor support...
Checking PATCH 2/2: qxl: add support for chunked cursors....
ERROR: braces {} are necessary for all arms of this statement
#29: FILE: hw/display/qxl-render.c:218:
+        if (offset == size)
[...]

ERROR: braces {} are necessary for all arms of this statement
#32: FILE: hw/display/qxl-render.c:221:
+        if (!chunk)
[...]

total: 2 errors, 0 warnings, 51 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-24  8:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  8:13 [Qemu-devel] [PATCH 0/2] qxl: add support for chunked cursors Gerd Hoffmann
2017-08-24  8:13 ` [Qemu-devel] [PATCH 1/2] qxl: drop mono cursor support Gerd Hoffmann
2017-08-24  8:13 ` [Qemu-devel] [PATCH 2/2] qxl: add support for chunked cursors Gerd Hoffmann
2017-08-24  8:40 ` [Qemu-devel] [PATCH 0/2] " no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.