qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: lcapitulino@redhat.com, armbru@redhat.com, kraxel@redhat.com
Cc: mlureau@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/5] qxl: split qxl_render_display_resized
Date: Mon, 24 Oct 2011 14:02:18 +0200	[thread overview]
Message-ID: <1319457739-14562-5-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1319457739-14562-1-git-send-email-alevy@redhat.com>

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl-render.c |   75 ++++++++++++++++++++++++++++++-------------------------
 1 files changed, 41 insertions(+), 34 deletions(-)

diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 23a4289..fd3c016 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -70,47 +70,54 @@ void qxl_render_resize(PCIQXLDevice *qxl)
     }
 }
 
+static void qxl_render_display_resized(PCIQXLDevice *qxl)
+{
+    VGACommonState *vga = &qxl->vga;
+    void *ptr;
+
+    qxl->guest_primary.resized = 0;
+
+    if (qxl->guest_primary.flipped) {
+        g_free(qxl->guest_primary.flipped);
+        qxl->guest_primary.flipped = NULL;
+    }
+    qemu_free_displaysurface(vga->ds);
+
+    qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
+    if (qxl->guest_primary.stride < 0) {
+        /* spice surface is upside down -> need extra buffer to flip */
+        qxl->guest_primary.stride = -qxl->guest_primary.stride;
+        qxl->guest_primary.flipped = g_malloc(qxl->guest_primary.surface.width *
+                                                 qxl->guest_primary.stride);
+        ptr = qxl->guest_primary.flipped;
+    } else {
+        ptr = qxl->guest_primary.data;
+    }
+    dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d, flip %s\n",
+           __func__,
+           qxl->guest_primary.surface.width,
+           qxl->guest_primary.surface.height,
+           qxl->guest_primary.stride,
+           qxl->guest_primary.bytes_pp,
+           qxl->guest_primary.bits_pp,
+           qxl->guest_primary.flipped ? "yes" : "no");
+    vga->ds->surface =
+        qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
+                                        qxl->guest_primary.surface.height,
+                                        qxl->guest_primary.bits_pp,
+                                        qxl->guest_primary.stride,
+                                        ptr);
+    dpy_resize(vga->ds);
+}
+
 void qxl_render_update(PCIQXLDevice *qxl)
 {
     VGACommonState *vga = &qxl->vga;
     QXLRect dirty[32], update;
-    void *ptr;
     int i;
 
     if (qxl->guest_primary.resized) {
-        qxl->guest_primary.resized = 0;
-
-        if (qxl->guest_primary.flipped) {
-            g_free(qxl->guest_primary.flipped);
-            qxl->guest_primary.flipped = NULL;
-        }
-        qemu_free_displaysurface(vga->ds);
-
-        qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
-        if (qxl->guest_primary.stride < 0) {
-            /* spice surface is upside down -> need extra buffer to flip */
-            qxl->guest_primary.stride = -qxl->guest_primary.stride;
-            qxl->guest_primary.flipped = g_malloc(qxl->guest_primary.surface.width *
-                                                     qxl->guest_primary.stride);
-            ptr = qxl->guest_primary.flipped;
-        } else {
-            ptr = qxl->guest_primary.data;
-        }
-        dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d, flip %s\n",
-               __FUNCTION__,
-               qxl->guest_primary.surface.width,
-               qxl->guest_primary.surface.height,
-               qxl->guest_primary.stride,
-               qxl->guest_primary.bytes_pp,
-               qxl->guest_primary.bits_pp,
-               qxl->guest_primary.flipped ? "yes" : "no");
-        vga->ds->surface =
-            qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
-                                            qxl->guest_primary.surface.height,
-                                            qxl->guest_primary.bits_pp,
-                                            qxl->guest_primary.stride,
-                                            ptr);
-        dpy_resize(vga->ds);
+        qxl_render_display_resized(qxl);
     }
 
     if (!qxl->guest_primary.commands) {
-- 
1.7.7

  parent reply	other threads:[~2011-10-24 12:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24 12:02 [Qemu-devel] [PATCH 0/5] monitor+qxl: async monitor support Alon Levy
2011-10-24 12:02 ` [Qemu-devel] [PATCH 1/5] monitor: screen_dump async Alon Levy
2011-10-24 15:13   ` Gerd Hoffmann
2011-10-24 15:45     ` Luiz Capitulino
2011-10-24 17:29       ` Alon Levy
2011-10-25  0:31         ` Luiz Capitulino
2011-10-25 10:13           ` Alon Levy
2011-10-25 12:51             ` Luiz Capitulino
2011-10-25 13:21               ` Alon Levy
2011-10-25 18:41                 ` Luiz Capitulino
2011-10-26 11:48                   ` Alon Levy
2011-10-25  7:16       ` Gerd Hoffmann
2011-10-24 12:02 ` [Qemu-devel] [PATCH 2/5] qxl: s/__FUNCTION__/__func__/, change logging levels Alon Levy
2011-10-24 12:02 ` [Qemu-devel] [PATCH 3/5] qxl: support concurrent async commands Alon Levy
2011-10-24 15:26   ` Gerd Hoffmann
2011-10-25 12:19     ` Alon Levy
2011-10-24 12:02 ` Alon Levy [this message]
2011-10-24 12:02 ` [Qemu-devel] [PATCH 5/5] qxl: support async monitor screen dump Alon Levy
2011-10-24 15:29   ` Gerd Hoffmann
2011-10-24 17:30     ` Alon Levy

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=1319457739-14562-5-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mlureau@redhat.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).