aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-07 10:17:44 +1000
committerGerd Hoffmann <kraxel@redhat.com>2014-12-16 15:14:42 +0100
commit5508099397c480f1c3b4f14b0e64593ebe284b26 (patch)
treea10bbd310fa90f6fd0168b64b15b6a29abc3530e /hw
parentdfa9c2a0f4d0a0c8b2c1449ecdbb1297427e1560 (diff)
vga: Add mechanism to force the use of a shadow surface
This prevents surface sharing which will be necessary to fix cirrus HW cursor support. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/display/vga.c17
-rw-r--r--hw/display/vga_int.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 52eaf05659..a620c07864 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1436,6 +1436,7 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
uint8_t *d;
uint32_t v, addr1, addr;
vga_draw_line_func *vga_draw_line = NULL;
+ bool share_surface;
#ifdef HOST_WORDS_BIGENDIAN
bool byteswap = !s->big_endian_fb;
#else
@@ -1479,21 +1480,33 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
}
depth = s->get_bpp(s);
+
+ share_surface = (!s->force_shadow) &&
+ ( depth == 32 || (depth == 16 && !byteswap) );
if (s->line_offset != s->last_line_offset ||
disp_width != s->last_width ||
height != s->last_height ||
s->last_depth != depth ||
- s->last_byteswap != byteswap) {
- if (depth == 32 || (depth == 16 && !byteswap)) {
+ s->last_byteswap != byteswap ||
+ share_surface != is_buffer_shared(surface)) {
+ if (share_surface) {
pixman_format_code_t format =
qemu_default_pixman_format(depth, !byteswap);
surface = qemu_create_displaysurface_from(disp_width,
height, format, s->line_offset,
s->vram_ptr + (s->start_addr * 4));
dpy_gfx_replace_surface(s->con, surface);
+#ifdef DEBUG_VGA
+ printf("VGA: Using shared surface for depth=%d swap=%d\n",
+ depth, byteswap);
+#endif
} else {
qemu_console_resize(s->con, disp_width, height);
surface = qemu_console_surface(s->con);
+#ifdef DEBUG_VGA
+ printf("VGA: Using shadow surface for depth=%d swap=%d\n",
+ depth, byteswap);
+#endif
}
s->last_scr_width = disp_width;
s->last_scr_height = height;
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index ed69e064a8..72e00f2e0c 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -151,6 +151,7 @@ typedef struct VGACommonState {
uint32_t last_scr_width, last_scr_height; /* in pixels */
uint32_t last_depth; /* in bits */
bool last_byteswap;
+ bool force_shadow;
uint8_t cursor_start, cursor_end;
bool cursor_visible_phase;
int64_t cursor_blink_time;