Fix problem that press CTRL+ALT+2 and then CTRL+ALT+1 back to VM graphic console, screen cannot be restored. xenfb_guest_copy only handles xenfb->depth=8 and 24 cases, because it assumes in xenfb->depth=16 or 32 cases, buffer is shared, like in xenfb_update ==> qemu_create_displaysurface_from() does. But as the mentioned bug, it didn't enter the xenfb_update do_resize hunk, buffer is not shared. To solve that problem, either make it enter the xenfb_update do_resize hunk, or change xenfb_guest_copy(), let it handle all cases. This patch is to let xenfb_guest_copy handle xenfb->depth=32 case. diff -r e4f337bb97f7 tools/ioemu-qemu-xen/hw/xenfb.c --- a/tools/ioemu-qemu-xen/hw/xenfb.c Wed Oct 20 19:39:28 2010 +0800 +++ b/tools/ioemu-qemu-xen/hw/xenfb.c Wed Oct 20 21:42:37 2010 +0800 @@ -612,6 +612,12 @@ uint8_t *data = ds_get_data(xenfb->c.ds); if (!is_buffer_shared(xenfb->c.ds->surface)) { + if (xenfb->depth == bpp) { + for (line = y; line < (y+h); line++) { + memcpy (data + (line * linesize) + (x * bpp / 8), xenfb->pixels + xenfb->offset + (line * xenfb->row_stride) + (x * xenfb->depth / 8), w * xenfb->depth / 8); + } + } + else{ switch (xenfb->depth) { case 8: if (bpp == 16) { @@ -631,9 +637,17 @@ oops = 1; } break; + case 32: + if (bpp == 16) { + BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); + } else { + oops = 1; + } + break; default: oops = 1; } + } } if (oops) /* should not happen */ xen_be_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n",