qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Julian Pidancet <julian.pidancet@citrix.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [Qemu-devel] Re: [PATCH 5/5] linux fbdev display driver.
Date: Thu, 17 Jun 2010 12:43:41 +0200	[thread overview]
Message-ID: <4C19FC5D.9070003@redhat.com> (raw)
In-Reply-To: <4C18FA58.5080808@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

   Hi,

> +static void fbdev_free_displaysurface(DisplaySurface *surface)
> +{
> +    if (surface == NULL)
> +        return;
> +
> +    if (surface->flags&  QEMU_ALLOCATED_FLAG) {
> +        qemu_free(surface->data);
> +    }
> +
> +    surface->data = NULL;

This is pretty pointless ...

> +    qemu_free(surface);

... as you free surface anyway ;)

> @@ -910,7 +959,17 @@ void fbdev_display_init(DisplayState *ds, const char *device)
>       dcl->dpy_update  = fbdev_update;
>       dcl->dpy_resize  = fbdev_resize;
>       dcl->dpy_refresh = fbdev_refresh;
> +    dcl->dpy_setdata = fbdev_setdata;
>       register_displaychangelistener(ds, dcl);
> +
> +    da = qemu_mallocz(sizeof (DisplayAllocator));
> +    da->create_displaysurface = fbdev_create_displaysurface;
> +    da->resize_displaysurface = fbdev_resize_displaysurface;
> +    da->free_displaysurface = fbdev_free_displaysurface;
> +
> +    if (register_displayallocator(ds, da) == da) {
> +        dpy_resize(ds);
> +    }

You register the display allocator, but don't unregister in 
fbdev_display_uninit().

You are just lucky that fbdev_cleanup() forgets to unmap the framebuffer.

Apply the attached fix, start qemu with vnc, then do "change fbdev on" 
and "change fbdev off" in the monitor and watch qemu segfault.

Also after "change fbdev on" the guest screen isn't rendered correctly.

cheers,
   Gerd


[-- Attachment #2: 0001-fbdev-unmap-framebuffer-on-cleanup.patch --]
[-- Type: text/plain, Size: 755 bytes --]

>From 685849ae48eaef7927b90e012fb6afb4494052d0 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 17 Jun 2010 12:32:53 +0200
Subject: [PATCH] fbdev: unmap framebuffer on cleanup

---
 fbdev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fbdev.c b/fbdev.c
index 6623a4f..1a95ede 100644
--- a/fbdev.c
+++ b/fbdev.c
@@ -518,6 +518,10 @@ static void fbdev_cleanup(void)
         fprintf(stderr, "%s\n", __FUNCTION__);
 
     /* restore console */
+    if (fb_mem != NULL) {
+        munmap(fb_mem, fb_fix.smem_len+fb_mem_offset);
+        fb_mem = NULL;
+    }
     if (fb != -1) {
         if (ioctl(fb,FBIOPUT_VSCREENINFO, &fb_ovar) < 0)
             perror("ioctl FBIOPUT_VSCREENINFO");
-- 
1.6.5.2


  reply	other threads:[~2010-06-17 10:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 10:05 [Qemu-devel] [PATCH 0/5] fbdev display driver + misc bits Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 1/5] QLIST-ify display change listeners Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 2/5] add unregister_displaychangelistener Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 3/5] Fix and simplify gui timer logic Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 4/5] add pflib: PixelFormat conversion library Gerd Hoffmann
2010-06-15 10:05 ` [Qemu-devel] [PATCH 5/5] linux fbdev display driver Gerd Hoffmann
2010-06-16 12:44   ` [Qemu-devel] " Stefano Stabellini
2010-06-16 16:22     ` Julian Pidancet
2010-06-17 10:43       ` Gerd Hoffmann [this message]
2010-06-17 14:29         ` Julian Pidancet
2010-06-17 16:25           ` Julian Pidancet
2010-06-18  7:32             ` Gerd Hoffmann
2010-06-18 12:00               ` Julian Pidancet
2010-06-24 18:38 ` [Qemu-devel] [PATCH 0/5] fbdev display driver + misc bits Julian Pidancet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C19FC5D.9070003@redhat.com \
    --to=kraxel@redhat.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=julian.pidancet@citrix.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).