|
Hans de Goede |
56753f |
From 7027fa0d3be22f48a51420a45aff13bec54fef1e Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
56753f |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
Date: Mon, 27 Feb 2012 11:05:09 +0100
|
|
Hans de Goede |
56753f |
Subject: [PATCH 421/434] qxl: properly handle upright and non-shared surfaces
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Although qxl creates a shared displaysurface when the qxl surface is
|
|
Hans de Goede |
56753f |
upright and doesn't need to be flipped there is no guarantee that the
|
|
Hans de Goede |
56753f |
surface doesn't become unshared for some reason. Rename qxl_flip to
|
|
Hans de Goede |
56753f |
qxl_blit and fix it to handle both flip and non-flip cases.
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
56753f |
---
|
|
Hans de Goede |
56753f |
hw/qxl-render.c | 20 +++++++++++++-------
|
|
Hans de Goede |
56753f |
1 file changed, 13 insertions(+), 7 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 4857838..2e10e93 100644
|
|
Hans de Goede |
56753f |
--- a/hw/qxl-render.c
|
|
Hans de Goede |
56753f |
+++ b/hw/qxl-render.c
|
|
Hans de Goede |
56753f |
@@ -21,25 +21,31 @@
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
#include "qxl.h"
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
-static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
|
|
Hans de Goede |
56753f |
+static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
|
|
Hans de Goede |
56753f |
{
|
|
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 |
+ if (is_buffer_shared(qxl->vga.ds->surface)) {
|
|
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 |
+ dprint(qxl, 2, "%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 |
+ if (qxl->guest_primary.qxl_stride < 0) {
|
|
Hans de Goede |
56753f |
+ /* qxl surface is upside down, walk src scanlines
|
|
Hans de Goede |
56753f |
+ * in reverse order to flip it */
|
|
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 |
+ } else {
|
|
Hans de Goede |
56753f |
+ src += rect->top * qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
+ }
|
|
Hans de Goede |
56753f |
dst += rect->top * qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
src += rect->left * qxl->guest_primary.bytes_pp;
|
|
Hans de Goede |
56753f |
dst += rect->left * qxl->guest_primary.bytes_pp;
|
|
Hans de Goede |
56753f |
@@ -48,7 +54,7 @@ static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
|
|
Hans de Goede |
56753f |
for (i = rect->top; i < rect->bottom; i++) {
|
|
Hans de Goede |
56753f |
memcpy(dst, src, len);
|
|
Hans de Goede |
56753f |
dst += qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
- src -= qxl->guest_primary.abs_stride;
|
|
Hans de Goede |
56753f |
+ src += qxl->guest_primary.qxl_stride;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
|
|
Hans de Goede |
56753f |
@@ -132,7 +138,7 @@ static void qxl_render_update_area_unlocked(PCIQXLDevice *qxl)
|
|
Hans de Goede |
56753f |
if (qemu_spice_rect_is_empty(qxl->dirty+i)) {
|
|
Hans de Goede |
56753f |
break;
|
|
Hans de Goede |
56753f |
}
|
|
Hans de Goede |
56753f |
- qxl_flip(qxl, qxl->dirty+i);
|
|
Hans de Goede |
56753f |
+ qxl_blit(qxl, qxl->dirty+i);
|
|
Hans de Goede |
56753f |
dpy_update(vga->ds,
|
|
Hans de Goede |
56753f |
qxl->dirty[i].left, qxl->dirty[i].top,
|
|
Hans de Goede |
56753f |
qxl->dirty[i].right - qxl->dirty[i].left,
|
|
Hans de Goede |
56753f |
--
|
|
Hans de Goede |
56753f |
1.7.10
|
|
Hans de Goede |
56753f |
|