aboutsummaryrefslogtreecommitdiff
path: root/hw/qxl-render.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-11-01 13:06:46 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-01 13:06:46 -0500
commit110fc0864d901cf5954a3663389f9598533d1ef5 (patch)
tree8cf223766b6a6f6067e3c9d9862edc0039d9c980 /hw/qxl-render.c
parent596235300608575ece1828b12a5faf32ebfee3fc (diff)
parent54825d2e39b0a809332b5fee837f456d5d9befee (diff)
downloadqemu-110fc0864d901cf5954a3663389f9598533d1ef5.zip
qemu-110fc0864d901cf5954a3663389f9598533d1ef5.tar.gz
qemu-110fc0864d901cf5954a3663389f9598533d1ef5.tar.bz2
Merge remote-tracking branch 'spice/spice.v46' into staging
Diffstat (limited to 'hw/qxl-render.c')
-rw-r--r--hw/qxl-render.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index c290739..2c51ba9 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -28,16 +28,16 @@ static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)
int len, i;
src += (qxl->guest_primary.surface.height - rect->top - 1) *
- qxl->guest_primary.stride;
- dst += rect->top * qxl->guest_primary.stride;
+ qxl->guest_primary.abs_stride;
+ dst += rect->top * qxl->guest_primary.abs_stride;
src += rect->left * qxl->guest_primary.bytes_pp;
dst += rect->left * qxl->guest_primary.bytes_pp;
len = (rect->right - rect->left) * qxl->guest_primary.bytes_pp;
for (i = rect->top; i < rect->bottom; i++) {
memcpy(dst, src, len);
- dst += qxl->guest_primary.stride;
- src -= qxl->guest_primary.stride;
+ dst += qxl->guest_primary.abs_stride;
+ src -= qxl->guest_primary.abs_stride;
}
}
@@ -45,7 +45,8 @@ void qxl_render_resize(PCIQXLDevice *qxl)
{
QXLSurfaceCreate *sc = &qxl->guest_primary.surface;
- qxl->guest_primary.stride = sc->stride;
+ qxl->guest_primary.qxl_stride = sc->stride;
+ qxl->guest_primary.abs_stride = abs(sc->stride);
qxl->guest_primary.resized++;
switch (sc->format) {
case SPICE_SURFACE_FMT_16_555:
@@ -75,7 +76,14 @@ void qxl_render_update(PCIQXLDevice *qxl)
VGACommonState *vga = &qxl->vga;
QXLRect dirty[32], update;
void *ptr;
- int i;
+ 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;
+ }
if (qxl->guest_primary.resized) {
qxl->guest_primary.resized = 0;
@@ -87,11 +95,11 @@ void qxl_render_update(PCIQXLDevice *qxl)
qemu_free_displaysurface(vga->ds);
qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram);
- if (qxl->guest_primary.stride < 0) {
+ if (qxl->guest_primary.qxl_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);
+ 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;
@@ -100,7 +108,7 @@ void qxl_render_update(PCIQXLDevice *qxl)
__FUNCTION__,
qxl->guest_primary.surface.width,
qxl->guest_primary.surface.height,
- qxl->guest_primary.stride,
+ qxl->guest_primary.qxl_stride,
qxl->guest_primary.bytes_pp,
qxl->guest_primary.bits_pp,
qxl->guest_primary.flipped ? "yes" : "no");
@@ -108,7 +116,7 @@ void qxl_render_update(PCIQXLDevice *qxl)
qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
qxl->guest_primary.surface.height,
qxl->guest_primary.bits_pp,
- qxl->guest_primary.stride,
+ qxl->guest_primary.abs_stride,
ptr);
dpy_resize(vga->ds);
}
@@ -126,6 +134,10 @@ void qxl_render_update(PCIQXLDevice *qxl)
memset(dirty, 0, sizeof(dirty));
qxl_spice_update_area(qxl, 0, &update,
dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC);
+ if (redraw) {
+ memset(dirty, 0, sizeof(dirty));
+ dirty[0] = update;
+ }
for (i = 0; i < ARRAY_SIZE(dirty); i++) {
if (qemu_spice_rect_is_empty(dirty+i)) {