From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org, kraxel@redhat.com,
spice-devel@freedesktop.org, yhalperi@redhat.com,
elmarco@redhat.com
Subject: [Qemu-devel] [RFC v4 6/9] qxl: remove flipped
Date: Tue, 21 Feb 2012 23:39:34 +0200 [thread overview]
Message-ID: <1329860377-6284-7-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1329860377-6284-1-git-send-email-alevy@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
---
hw/qxl-render.c | 58 ++++++++++++++++++-------------------------------------
hw/qxl.h | 2 +-
2 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 133d093..4518a56 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -23,10 +23,15 @@
static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
{
- uint8_t *src = qxl->guest_primary.data;
- uint8_t *dst = qxl->guest_primary.flipped;
+ uint8_t *src;
+ uint8_t *dst = qxl->vga.ds->surface->data;
int len, i;
+ if (!qxl->guest_primary.data) {
+ dprint(qxl, 1, "%s: initializing guest_primary.data\n", __func__);
+ qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
+ }
+ src = qxl->guest_primary.data;
src += (qxl->guest_primary.surface.height - rect->top - 1) *
qxl->guest_primary.abs_stride;
dst += rect->top * qxl->guest_primary.abs_stride;
@@ -75,50 +80,20 @@ void qxl_render_update(PCIQXLDevice *qxl)
{
VGACommonState *vga = &qxl->vga;
QXLRect dirty[32], update;
- void *ptr;
int i, redraw = 0;
-
- if (!is_buffer_shared(vga->ds->surface)) {
- dprint(qxl, 1, "%s: restoring shared displaysurface\n", __func__);
- qxl->guest_primary.resized++;
- qxl->guest_primary.commands++;
- redraw = 1;
- }
+ DisplaySurface *surface = vga->ds->surface;
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.qxl_stride < 0) {
- /* spice surface is upside down -> need extra buffer to flip */
- qxl->guest_primary.flipped =
- g_malloc(qxl->guest_primary.surface.width *
- qxl->guest_primary.abs_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",
+ dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d\n",
__FUNCTION__,
qxl->guest_primary.surface.width,
qxl->guest_primary.surface.height,
qxl->guest_primary.qxl_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.abs_stride,
- ptr);
- dpy_resize(vga->ds);
+ qxl->guest_primary.bits_pp);
}
if (!qxl->guest_primary.commands) {
@@ -138,14 +113,19 @@ void qxl_render_update(PCIQXLDevice *qxl)
memset(dirty, 0, sizeof(dirty));
dirty[0] = update;
}
-
+ if (surface->width != qxl->guest_primary.surface.width ||
+ surface->height != qxl->guest_primary.surface.height) {
+ dprint(qxl, 1, "%s: resizing displaysurface to guest_primary\n",
+ __func__);
+ qemu_resize_displaysurface(vga->ds,
+ qxl->guest_primary.surface.width,
+ qxl->guest_primary.surface.height);
+ }
for (i = 0; i < ARRAY_SIZE(dirty); i++) {
if (qemu_spice_rect_is_empty(dirty+i)) {
break;
}
- if (qxl->guest_primary.flipped) {
- qxl_flip(qxl, dirty+i);
- }
+ qxl_flip(qxl, dirty+i);
dpy_update(vga->ds,
dirty[i].left, dirty[i].top,
dirty[i].right - dirty[i].left,
diff --git a/hw/qxl.h b/hw/qxl.h
index 739ec27..eadd016 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -52,7 +52,7 @@ typedef struct PCIQXLDevice {
uint32_t abs_stride;
uint32_t bits_pp;
uint32_t bytes_pp;
- uint8_t *data, *flipped;
+ uint8_t *data;
} guest_primary;
struct surfaces {
--
1.7.9.1
next prev parent reply other threads:[~2012-02-21 21:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 21:39 [Qemu-devel] [RFC v4 0/9] qxl: fix hangs caused by qxl_render_update Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 1/9] console: don't call console_select unnecessarily Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 2/9] sdl: remove NULL check, g_malloc0 can't fail Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 3/9] qxl: drop qxl_spice_update_area_async definition Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 4/9] qxl: screen_dump in vga: do a single ppm_save Alon Levy
2012-02-22 11:10 ` Gerd Hoffmann
2012-02-22 12:26 ` Alon Levy
2012-02-22 13:58 ` Gerd Hoffmann
2012-02-22 14:25 ` [Qemu-devel] [Spice-devel] " Alon Levy
2012-02-22 14:37 ` Gerd Hoffmann
2012-02-22 15:27 ` Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 5/9] qxl: require spice >= 0.8.2 Alon Levy
2012-02-22 11:11 ` Gerd Hoffmann
2012-02-21 21:39 ` Alon Levy [this message]
2012-02-22 11:18 ` [Qemu-devel] [RFC v4 6/9] qxl: remove flipped Gerd Hoffmann
2012-02-22 12:28 ` Alon Levy
2012-02-22 14:09 ` Gerd Hoffmann
2012-02-22 14:23 ` Alon Levy
2012-02-22 19:00 ` Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 7/9] qxl: introduce QXLCookie Alon Levy
2012-02-22 11:23 ` Gerd Hoffmann
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 8/9] qxl: make qxl_render_update async Alon Levy
2012-02-22 11:41 ` Gerd Hoffmann
2012-02-22 12:30 ` Alon Levy
2012-02-21 21:39 ` [Qemu-devel] [RFC v4 9/9] qxl-render: call ppm_save on bh Alon Levy
2012-02-22 11:46 ` Gerd Hoffmann
2012-02-22 12:34 ` Alon Levy
2012-02-22 12:45 ` Alon Levy
2012-02-22 18:59 ` Alon Levy
2012-02-21 22:17 ` [Qemu-devel] [Spice-devel] [RFC v4 0/9] qxl: fix hangs caused by qxl_render_update 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=1329860377-6284-7-git-send-email-alevy@redhat.com \
--to=alevy@redhat.com \
--cc=elmarco@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=spice-devel@freedesktop.org \
--cc=yhalperi@redhat.com \
/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).