All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] Vga 20171110 patches
@ 2017-11-10 13:26 Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 1/3] virtio-gpu: fix bug in host memory calculation Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-11-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:

  Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/vga-20171110-pull-request

for you to fetch changes up to cf7040e284069fc235172c187551b268c66d8553:

  vmsvga: use ARRAY_SIZE macro (2017-11-10 14:25:56 +0100)

----------------------------------------------------------------
vga: bugfixes for 2.11

----------------------------------------------------------------

Gerd Hoffmann (1):
  vga: fix region checks in wraparound case

Philippe Mathieu-Daudé (1):
  vmsvga: use ARRAY_SIZE macro

Tao Wu (1):
  virtio-gpu: fix bug in host memory calculation.

 hw/display/vga.c        |  4 ++--
 hw/display/virtio-gpu.c | 16 ++++++++++++++--
 hw/display/vmware_vga.c |  5 ++---
 3 files changed, 18 insertions(+), 7 deletions(-)

-- 
2.9.3

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

* [Qemu-devel] [PULL 1/3] virtio-gpu: fix bug in host memory calculation.
  2017-11-10 13:26 [Qemu-devel] [PULL 0/3] Vga 20171110 patches Gerd Hoffmann
@ 2017-11-10 13:26 ` Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 2/3] vga: fix region checks in wraparound case Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-11-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tao Wu, Gerd Hoffmann, Michael S. Tsirkin

From: Tao Wu <lepton@google.com>

The old code treats bits as bytes when calculating host memory usage.
Change it to be consistent with allocation logic in pixman library.

Signed-off-by: Tao Wu <lepton@google.com>
Message-Id: <20171109181741.31318-1-lepton@google.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 43bbe09ea0..274e365713 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -322,6 +322,18 @@ static pixman_format_code_t get_pixman_format(uint32_t virtio_gpu_format)
     }
 }
 
+static uint32_t calc_image_hostmem(pixman_format_code_t pformat,
+                                   uint32_t width, uint32_t height)
+{
+    /* Copied from pixman/pixman-bits-image.c, skip integer overflow check.
+     * pixman_image_create_bits will fail in case it overflow.
+     */
+
+    int bpp = PIXMAN_FORMAT_BPP(pformat);
+    int stride = ((width * bpp + 0x1f) >> 5) * sizeof(uint32_t);
+    return height * stride;
+}
+
 static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
                                           struct virtio_gpu_ctrl_command *cmd)
 {
@@ -366,7 +378,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g,
         return;
     }
 
-    res->hostmem = PIXMAN_FORMAT_BPP(pformat) * c2d.width * c2d.height;
+    res->hostmem = calc_image_hostmem(pformat, c2d.width, c2d.height);
     if (res->hostmem + g->hostmem < g->conf.max_hostmem) {
         res->image = pixman_image_create_bits(pformat,
                                               c2d.width,
@@ -1087,7 +1099,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
             return -EINVAL;
         }
 
-        res->hostmem = PIXMAN_FORMAT_BPP(pformat) * res->width * res->height;
+        res->hostmem = calc_image_hostmem(pformat, res->width, res->height);
 
         res->addrs = g_new(uint64_t, res->iov_cnt);
         res->iov = g_new(struct iovec, res->iov_cnt);
-- 
2.9.3

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

* [Qemu-devel] [PULL 2/3] vga: fix region checks in wraparound case
  2017-11-10 13:26 [Qemu-devel] [PULL 0/3] Vga 20171110 patches Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 1/3] virtio-gpu: fix bug in host memory calculation Gerd Hoffmann
@ 2017-11-10 13:26 ` Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 3/3] vmsvga: use ARRAY_SIZE macro Gerd Hoffmann
  2017-11-13 23:24 ` [Qemu-devel] [PULL 0/3] Vga 20171110 patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-11-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Dr. David Alan Gilbert

Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 20171030102830.4469-1-kraxel@redhat.com
---
 hw/display/vga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 1d19f6bc48..a64a0942da 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1666,9 +1666,9 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
             /* scanline wraps from end of video memory to the start */
             assert(force_shadow);
             update = memory_region_snapshot_get_dirty(&s->vram, snap,
-                                                      page0, 0);
+                                                      page0, s->vbe_size - page0);
             update |= memory_region_snapshot_get_dirty(&s->vram, snap,
-                                                       page1, 0);
+                                                       0, page1);
         } else {
             update = memory_region_snapshot_get_dirty(&s->vram, snap,
                                                       page0, page1 - page0);
-- 
2.9.3

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

* [Qemu-devel] [PULL 3/3] vmsvga: use ARRAY_SIZE macro
  2017-11-10 13:26 [Qemu-devel] [PULL 0/3] Vga 20171110 patches Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 1/3] virtio-gpu: fix bug in host memory calculation Gerd Hoffmann
  2017-11-10 13:26 ` [Qemu-devel] [PULL 2/3] vga: fix region checks in wraparound case Gerd Hoffmann
@ 2017-11-10 13:26 ` Gerd Hoffmann
  2017-11-13 23:24 ` [Qemu-devel] [PULL 0/3] Vga 20171110 patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-11-10 13:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170718061005.29518-23-f4bug@amsat.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/vmware_vga.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index cdc3fed6ca..0e6673a911 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -679,10 +679,9 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
             if (cursor.width > 256
                 || cursor.height > 256
                 || cursor.bpp > 32
-                || SVGA_BITMAP_SIZE(x, y)
-                    > sizeof(cursor.mask) / sizeof(cursor.mask[0])
+                || SVGA_BITMAP_SIZE(x, y) > ARRAY_SIZE(cursor.mask)
                 || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
-                    > sizeof(cursor.image) / sizeof(cursor.image[0])) {
+                    > ARRAY_SIZE(cursor.image)) {
                     goto badcmd;
             }
 
-- 
2.9.3

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

* Re: [Qemu-devel] [PULL 0/3] Vga 20171110 patches
  2017-11-10 13:26 [Qemu-devel] [PULL 0/3] Vga 20171110 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2017-11-10 13:26 ` [Qemu-devel] [PULL 3/3] vmsvga: use ARRAY_SIZE macro Gerd Hoffmann
@ 2017-11-13 23:24 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2017-11-13 23:24 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 10 November 2017 at 13:26, Gerd Hoffmann <kraxel@redhat.com> wrote:
> The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842:
>
>   Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/vga-20171110-pull-request
>
> for you to fetch changes up to cf7040e284069fc235172c187551b268c66d8553:
>
>   vmsvga: use ARRAY_SIZE macro (2017-11-10 14:25:56 +0100)
>
> ----------------------------------------------------------------
> vga: bugfixes for 2.11
>
> ----------------------------------------------------------------
>
> Gerd Hoffmann (1):
>   vga: fix region checks in wraparound case
>
> Philippe Mathieu-Daudé (1):
>   vmsvga: use ARRAY_SIZE macro
>
> Tao Wu (1):
>   virtio-gpu: fix bug in host memory calculation.
>
>  hw/display/vga.c        |  4 ++--
>  hw/display/virtio-gpu.c | 16 ++++++++++++++--
>  hw/display/vmware_vga.c |  5 ++---
>  3 files changed, 18 insertions(+), 7 deletions(-)
>
Applied, thanks.

-- PMM

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

end of thread, other threads:[~2017-11-13 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 13:26 [Qemu-devel] [PULL 0/3] Vga 20171110 patches Gerd Hoffmann
2017-11-10 13:26 ` [Qemu-devel] [PULL 1/3] virtio-gpu: fix bug in host memory calculation Gerd Hoffmann
2017-11-10 13:26 ` [Qemu-devel] [PULL 2/3] vga: fix region checks in wraparound case Gerd Hoffmann
2017-11-10 13:26 ` [Qemu-devel] [PULL 3/3] vmsvga: use ARRAY_SIZE macro Gerd Hoffmann
2017-11-13 23:24 ` [Qemu-devel] [PULL 0/3] Vga 20171110 patches Peter Maydell

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.