qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration
@ 2016-04-11 10:47 Gerd Hoffmann
  2016-04-11 10:47 ` [Qemu-devel] [PULL 1/2] ui/virtio-gpu: add and use qemu_create_displaysurface_pixman Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-04-11 10:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Here are two virtio-gpu patches, one fix for pixman-backed surfaces
and one blocking live migration.

please pull,
  Gerd

The following changes since commit 9628af036fade986dcc94f4484bc75c6b1a06d84:

  Merge remote-tracking branch 'remotes/lalrae/tags/mips-20160408' into staging (2016-04-08 13:45:52 +0100)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-vga-20160411-1

for you to fetch changes up to fa49e4656a641af84e4cdf40c8d12dacb25dc0aa:

  virtio-gpu: block live migration (2016-04-11 12:36:34 +0200)

----------------------------------------------------------------
virtio-gpu: pixman surface fix, block live migration

----------------------------------------------------------------
Gerd Hoffmann (2):
      ui/virtio-gpu: add and use qemu_create_displaysurface_pixman
      virtio-gpu: block live migration

 hw/display/virtio-gpu.c | 12 ++++++++----
 include/ui/console.h    |  1 +
 trace-events            |  1 +
 ui/console.c            | 11 +++++++++++
 4 files changed, 21 insertions(+), 4 deletions(-)

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

* [Qemu-devel] [PULL 1/2] ui/virtio-gpu: add and use qemu_create_displaysurface_pixman
  2016-04-11 10:47 [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration Gerd Hoffmann
@ 2016-04-11 10:47 ` Gerd Hoffmann
  2016-04-11 10:47 ` [Qemu-devel] [PULL 2/2] virtio-gpu: block live migration Gerd Hoffmann
  2016-04-11 13:08 ` [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, " Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-04-11 10:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, qemu-stable, Michael S. Tsirkin

Add a the new qemu_create_displaysurface_pixman function, to create
a DisplaySurface backed by an existing pixman image.  In that case
there is no need to create a new pixman image pointing to the same
backing storage.  We can just use the existing image directly.

This does not only simplify things a bit, but most importantly it
gets the reference counting right, so the backing storage for the
pixman image wouldn't be released underneath us.

Use new function in virtio-gpu, where using it actually fixes
use-after-free crashes.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1459499240-742-1-git-send-email-kraxel@redhat.com
---
 hw/display/virtio-gpu.c |  5 +----
 include/ui/console.h    |  1 +
 trace-events            |  1 +
 ui/console.c            | 11 +++++++++++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ddf3bfb..095d7ff 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -572,10 +572,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
         scanout->width != ss.r.width ||
         scanout->height != ss.r.height) {
         /* realloc the surface ptr */
-        scanout->ds = qemu_create_displaysurface_from
-            (ss.r.width, ss.r.height, format,
-             pixman_image_get_stride(res->image),
-             (uint8_t *)pixman_image_get_data(res->image) + offset);
+        scanout->ds = qemu_create_displaysurface_pixman(res->image);
         if (!scanout->ds) {
             cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
             return;
diff --git a/include/ui/console.h b/include/ui/console.h
index eb9419d..d5a88d9 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -234,6 +234,7 @@ DisplayState *init_displaystate(void);
 DisplaySurface *qemu_create_displaysurface_from(int width, int height,
                                                 pixman_format_code_t format,
                                                 int linesize, uint8_t *data);
+DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image);
 DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,
                                                     pixman_format_code_t format,
                                                     int linesize,
diff --git a/trace-events b/trace-events
index 996a77f..8350743 100644
--- a/trace-events
+++ b/trace-events
@@ -1161,6 +1161,7 @@ console_select(int nr) "%d"
 console_refresh(int interval) "interval %d ms"
 displaysurface_create(void *display_surface, int w, int h) "surface=%p, %dx%d"
 displaysurface_create_from(void *display_surface, int w, int h, uint32_t format) "surface=%p, %dx%d, format 0x%x"
+displaysurface_create_pixman(void *display_surface) "surface=%p"
 displaysurface_free(void *display_surface) "surface=%p"
 displaychangelistener_register(void *dcl, const char *name) "%p [ %s ]"
 displaychangelistener_unregister(void *dcl, const char *name) "%p [ %s ]"
diff --git a/ui/console.c b/ui/console.c
index 1fd4ea4..bf38579 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1292,6 +1292,17 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height,
     return surface;
 }
 
+DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image)
+{
+    DisplaySurface *surface = g_new0(DisplaySurface, 1);
+
+    trace_displaysurface_create_pixman(surface);
+    surface->format = pixman_image_get_format(image);
+    surface->image = pixman_image_ref(image);
+
+    return surface;
+}
+
 static void qemu_unmap_displaysurface_guestmem(pixman_image_t *image,
                                                void *unused)
 {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 2/2] virtio-gpu: block live migration
  2016-04-11 10:47 [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration Gerd Hoffmann
  2016-04-11 10:47 ` [Qemu-devel] [PULL 1/2] ui/virtio-gpu: add and use qemu_create_displaysurface_pixman Gerd Hoffmann
@ 2016-04-11 10:47 ` Gerd Hoffmann
  2016-04-11 13:08 ` [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, " Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-04-11 10:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

Feeling a bit nervous putting the full live migration support
patch (https://patchwork.ozlabs.org/patch/606902/) in that
late in the 2.6 devel cycle as it carries some non-trivial
changes.  So disable migration in case virtio-gpu is present
for now.

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

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 095d7ff..c181fb3 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -917,6 +917,11 @@ const GraphicHwOps virtio_gpu_ops = {
     .gl_block = virtio_gpu_gl_block,
 };
 
+static const VMStateDescription vmstate_virtio_gpu_unmigratable = {
+    .name = "virtio-gpu",
+    .unmigratable = 1,
+};
+
 static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
@@ -968,6 +973,8 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
             dpy_gfx_replace_surface(g->scanout[i].con, NULL);
         }
     }
+
+    vmstate_register(qdev, -1, &vmstate_virtio_gpu_unmigratable, g);
 }
 
 static void virtio_gpu_instance_init(Object *obj)
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration
  2016-04-11 10:47 [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration Gerd Hoffmann
  2016-04-11 10:47 ` [Qemu-devel] [PULL 1/2] ui/virtio-gpu: add and use qemu_create_displaysurface_pixman Gerd Hoffmann
  2016-04-11 10:47 ` [Qemu-devel] [PULL 2/2] virtio-gpu: block live migration Gerd Hoffmann
@ 2016-04-11 13:08 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-04-11 13:08 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 11 April 2016 at 11:47, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Here are two virtio-gpu patches, one fix for pixman-backed surfaces
> and one blocking live migration.
>
> please pull,
>   Gerd
>
> The following changes since commit 9628af036fade986dcc94f4484bc75c6b1a06d84:
>
>   Merge remote-tracking branch 'remotes/lalrae/tags/mips-20160408' into staging (2016-04-08 13:45:52 +0100)
>
> are available in the git repository at:
>
>
>   git://git.kraxel.org/qemu tags/pull-vga-20160411-1
>
> for you to fetch changes up to fa49e4656a641af84e4cdf40c8d12dacb25dc0aa:
>
>   virtio-gpu: block live migration (2016-04-11 12:36:34 +0200)
>
> ----------------------------------------------------------------
> virtio-gpu: pixman surface fix, block live migration
>

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2016-04-11 13:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-11 10:47 [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, block live migration Gerd Hoffmann
2016-04-11 10:47 ` [Qemu-devel] [PULL 1/2] ui/virtio-gpu: add and use qemu_create_displaysurface_pixman Gerd Hoffmann
2016-04-11 10:47 ` [Qemu-devel] [PULL 2/2] virtio-gpu: block live migration Gerd Hoffmann
2016-04-11 13:08 ` [Qemu-devel] [PULL 0/2] virtio-gpu: pixman surface fix, " Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).