|
Hans de Goede |
56753f |
From f9344933bcc1425cf1e8142dc2f8321522dc00af Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: Alon Levy <alevy@redhat.com>
|
|
Hans de Goede |
56753f |
Date: Fri, 24 Feb 2012 23:19:29 +0200
|
|
Hans de Goede |
56753f |
Subject: [PATCH 416/434] qxl: remove flipped
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Tested on linux and windows guests. For negative stride, qxl_flip copies
|
|
Hans de Goede |
56753f |
directly to vga->ds->surface->data, for positive it's reallocated to
|
|
Hans de Goede |
56753f |
share qxl->guest_primary.data
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Alon Levy <alevy@redhat.com>
|
|
Hans de Goede |
56753f |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
hw/qxl-render.c | 66 +++++++++++++++++++++++++------------------------------
|
|
Hans de Goede |
56753f |
hw/qxl.h | 2 +-
|
|
Hans de Goede |
56753f |
2 files changed, 31 insertions(+), 37 deletions(-)
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
|
|
Hans de Goede |
56753f |
index a7891b2..5811d74 100644
|
|
Hans de Goede |
56753f |
--- a/hw/qxl-render.c
|
|
Hans de Goede |
56753f |
+++ b/hw/qxl-render.c
|
|
Hans de Goede |
56753f |
@@ -23,10 +23,21 @@
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
- uint8_t *src = qxl->guest_primary.data;
|
|
Hans de Goede |
56753f |
- uint8_t *dst = qxl->guest_primary.flipped;
|
|
Hans de Goede |
56753f |
+ uint8_t *src;
|
|
Hans de Goede |
56753f |
+ uint8_t *dst = qxl->vga.ds->surface->data;
|
|
Hans de Goede |
56753f |
int len, i;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
+ if (qxl->guest_primary.qxl_stride > 0) {
|
|
Hans de Goede |
56753f |
+ return;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+ if (!qxl->guest_primary.data) {
|
|
Hans de Goede |
56753f |
+ dprint(qxl, 1, "%s: initializing guest_primary.data\n", __func__);
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+ dprint(qxl, 1, "%s: stride %d, [%d, %d, %d, %d]\n", __func__,
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.qxl_stride,
|
|
Hans de Goede |
56753f |
+ rect->left, rect->right, rect->top, rect->bottom);
|
|
Hans de Goede |
56753f |
+ src = qxl->guest_primary.data;
|
|
Hans de Goede |
56753f |
src += (qxl->guest_primary.surface.height - rect->top - 1) *
|
|
Hans de Goede |
56753f |
qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
dst += rect->top * qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
@@ -75,52 +86,38 @@ void qxl_render_update(PCIQXLDevice *qxl)
|
|
Hans de Goede |
56753f |
{
|
|
Hans de Goede |
56753f |
VGACommonState *vga = &qxl->vga;
|
|
Hans de Goede |
56753f |
QXLRect dirty[32], update;
|
|
Hans de Goede |
56753f |
- void *ptr;
|
|
Hans de Goede |
56753f |
int i, redraw = 0;
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
- if (!is_buffer_shared(vga->ds->surface)) {
|
|
Hans de Goede |
56753f |
- dprint(qxl, 1, "%s: restoring shared displaysurface\n", __func__);
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.resized++;
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.commands++;
|
|
Hans de Goede |
56753f |
- redraw = 1;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
+ DisplaySurface *surface = vga->ds->surface;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
if (qxl->guest_primary.resized) {
|
|
Hans de Goede |
56753f |
qxl->guest_primary.resized = 0;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
- if (qxl->guest_primary.flipped) {
|
|
Hans de Goede |
56753f |
- g_free(qxl->guest_primary.flipped);
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.flipped = NULL;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- qemu_free_displaysurface(vga->ds);
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
|
|
Hans de Goede |
56753f |
- if (qxl->guest_primary.qxl_stride < 0) {
|
|
Hans de Goede |
56753f |
- /* spice surface is upside down -> need extra buffer to flip */
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.flipped =
|
|
Hans de Goede |
56753f |
- g_malloc(qxl->guest_primary.surface.width *
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.abs_stride);
|
|
Hans de Goede |
56753f |
- ptr = qxl->guest_primary.flipped;
|
|
Hans de Goede |
56753f |
- } else {
|
|
Hans de Goede |
56753f |
- ptr = qxl->guest_primary.data;
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
- dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d, flip %s\n",
|
|
Hans de Goede |
56753f |
+ dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d\n",
|
|
Hans de Goede |
56753f |
__FUNCTION__,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.surface.width,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.surface.height,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.qxl_stride,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.bytes_pp,
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.bits_pp,
|
|
Hans de Goede |
56753f |
- qxl->guest_primary.flipped ? "yes" : "no");
|
|
Hans de Goede |
56753f |
- vga->ds->surface =
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.bits_pp);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
+ if (surface->width != qxl->guest_primary.surface.width ||
|
|
Hans de Goede |
56753f |
+ surface->height != qxl->guest_primary.surface.height) {
|
|
Hans de Goede |
56753f |
+ dprint(qxl, 1, "%s: resizing displaysurface to guest_primary\n",
|
|
Hans de Goede |
56753f |
+ __func__);
|
|
Hans de Goede |
56753f |
+ if (qxl->guest_primary.qxl_stride > 0) {
|
|
Hans de Goede |
56753f |
+ qemu_free_displaysurface(vga->ds);
|
|
Hans de Goede |
56753f |
qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.surface.height,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.bits_pp,
|
|
Hans de Goede |
56753f |
qxl->guest_primary.abs_stride,
|
|
Hans de Goede |
56753f |
- ptr);
|
|
Hans de Goede |
56753f |
- dpy_resize(vga->ds);
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.data);
|
|
Hans de Goede |
56753f |
+ } else {
|
|
Hans de Goede |
56753f |
+ qemu_resize_displaysurface(vga->ds,
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.surface.width,
|
|
Hans de Goede |
56753f |
+ qxl->guest_primary.surface.height);
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
update.left = 0;
|
|
Hans de Goede |
56753f |
update.right = qxl->guest_primary.surface.width;
|
|
Hans de Goede |
56753f |
update.top = 0;
|
|
Hans de Goede |
56753f |
@@ -136,14 +133,11 @@ void qxl_render_update(PCIQXLDevice *qxl)
|
|
Hans de Goede |
56753f |
memset(dirty, 0, sizeof(dirty));
|
|
Hans de Goede |
56753f |
dirty[0] = update;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
-
|
|
Hans de Goede |
56753f |
for (i = 0; i < ARRAY_SIZE(dirty); i++) {
|
|
Hans de Goede |
56753f |
if (qemu_spice_rect_is_empty(dirty+i)) {
|
|
Hans de Goede |
56753f |
break;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
- if (qxl->guest_primary.flipped) {
|
|
Hans de Goede |
56753f |
- qxl_flip(qxl, dirty+i);
|
|
Hans de Goede |
56753f |
- }
|
|
Hans de Goede |
56753f |
+ qxl_flip(qxl, dirty+i);
|
|
Hans de Goede |
56753f |
dpy_update(vga->ds,
|
|
Hans de Goede |
56753f |
dirty[i].left, dirty[i].top,
|
|
Hans de Goede |
56753f |
dirty[i].right - dirty[i].left,
|
|
Hans de Goede |
56753f |
diff --git a/hw/qxl.h b/hw/qxl.h
|
|
Hans de Goede |
56753f |
index 9288e46..53a3ace 100644
|
|
Hans de Goede |
56753f |
--- a/hw/qxl.h
|
|
Hans de Goede |
56753f |
+++ b/hw/qxl.h
|
|
Hans de Goede |
56753f |
@@ -52,7 +52,7 @@ typedef struct PCIQXLDevice {
|
|
Hans de Goede |
56753f |
uint32_t abs_stride;
|
|
Hans de Goede |
56753f |
uint32_t bits_pp;
|
|
Hans de Goede |
56753f |
uint32_t bytes_pp;
|
|
Hans de Goede |
56753f |
- uint8_t *data, *flipped;
|
|
Hans de Goede |
56753f |
+ uint8_t *data;
|
|
Hans de Goede |
56753f |
} guest_primary;
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
struct surfaces {
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|