Revision c78f7137 hw/xenfb.c
b/hw/xenfb.c | ||
---|---|---|
54 | 54 |
struct common { |
55 | 55 |
struct XenDevice xendev; /* must be first */ |
56 | 56 |
void *page; |
57 |
DisplayState *ds;
|
|
57 |
QemuConsole *con;
|
|
58 | 58 |
}; |
59 | 59 |
|
60 | 60 |
struct XenInput { |
... | ... | |
318 | 318 |
int dx, int dy, int dz, int button_state) |
319 | 319 |
{ |
320 | 320 |
struct XenInput *xenfb = opaque; |
321 |
int dw = ds_get_width(xenfb->c.ds); |
|
322 |
int dh = ds_get_height(xenfb->c.ds); |
|
321 |
DisplaySurface *surface = qemu_console_surface(xenfb->c.con); |
|
322 |
int dw = surface_width(surface); |
|
323 |
int dh = surface_height(surface); |
|
323 | 324 |
int i; |
324 | 325 |
|
325 | 326 |
if (xenfb->abs_pointer_wanted) |
... | ... | |
353 | 354 |
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); |
354 | 355 |
int rc; |
355 | 356 |
|
356 |
if (!in->c.ds) { |
|
357 |
char *vfb = xenstore_read_str(NULL, "device/vfb"); |
|
358 |
if (vfb == NULL) { |
|
359 |
/* there is no vfb, run vkbd on its own */ |
|
360 |
in->c.ds = get_displaystate(); |
|
361 |
} else { |
|
362 |
g_free(vfb); |
|
363 |
xen_be_printf(xendev, 1, "ds not set (yet)\n"); |
|
364 |
return -1; |
|
365 |
} |
|
357 |
if (!in->c.con) { |
|
358 |
xen_be_printf(xendev, 1, "ds not set (yet)\n"); |
|
359 |
return -1; |
|
366 | 360 |
} |
367 | 361 |
|
368 | 362 |
rc = common_bind(&in->c); |
... | ... | |
615 | 609 |
*/ |
616 | 610 |
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) |
617 | 611 |
{ |
612 |
DisplaySurface *surface = qemu_console_surface(xenfb->c.con); |
|
618 | 613 |
int line, oops = 0; |
619 |
int bpp = ds_get_bits_per_pixel(xenfb->c.ds);
|
|
620 |
int linesize = ds_get_linesize(xenfb->c.ds);
|
|
621 |
uint8_t *data = ds_get_data(xenfb->c.ds);
|
|
614 |
int bpp = surface_bits_per_pixel(surface);
|
|
615 |
int linesize = surface_stride(surface);
|
|
616 |
uint8_t *data = surface_data(surface);
|
|
622 | 617 |
|
623 |
if (!is_buffer_shared(xenfb->c.ds->surface)) {
|
|
618 |
if (!is_buffer_shared(surface)) { |
|
624 | 619 |
switch (xenfb->depth) { |
625 | 620 |
case 8: |
626 | 621 |
if (bpp == 16) { |
... | ... | |
648 | 643 |
xen_be_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n", |
649 | 644 |
__FUNCTION__, xenfb->depth, bpp); |
650 | 645 |
|
651 |
dpy_gfx_update(xenfb->c.ds, x, y, w, h);
|
|
646 |
dpy_gfx_update(xenfb->c.con, x, y, w, h);
|
|
652 | 647 |
} |
653 | 648 |
|
654 |
#ifdef XENFB_TYPE_REFRESH_PERIOD
|
|
649 |
#if 0 /* def XENFB_TYPE_REFRESH_PERIOD */
|
|
655 | 650 |
static int xenfb_queue_full(struct XenFB *xenfb) |
656 | 651 |
{ |
657 | 652 |
struct xenfb_page *page = xenfb->c.page; |
... | ... | |
710 | 705 |
return; |
711 | 706 |
|
712 | 707 |
if (xenfb->feature_update) { |
713 |
#ifdef XENFB_TYPE_REFRESH_PERIOD
|
|
708 |
#if 0 /* XENFB_TYPE_REFRESH_PERIOD */
|
|
714 | 709 |
struct DisplayChangeListener *l; |
715 | 710 |
int period = 99999999; |
716 | 711 |
int idle = 1; |
... | ... | |
764 | 759 |
surface = qemu_create_displaysurface(xenfb->width, xenfb->height); |
765 | 760 |
break; |
766 | 761 |
} |
767 |
dpy_gfx_replace_surface(xenfb->c.ds, surface);
|
|
762 |
dpy_gfx_replace_surface(xenfb->c.con, surface);
|
|
768 | 763 |
xen_be_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n", |
769 | 764 |
xenfb->width, xenfb->height, xenfb->depth, |
770 |
is_buffer_shared(xenfb->c.ds->surface) ? " (shared)" : "");
|
|
765 |
is_buffer_shared(surface) ? " (shared)" : ""); |
|
771 | 766 |
xenfb->up_fullscreen = 1; |
772 | 767 |
} |
773 | 768 |
|
... | ... | |
1009 | 1004 |
|
1010 | 1005 |
/* vfb */ |
1011 | 1006 |
fb = container_of(xfb, struct XenFB, c.xendev); |
1012 |
fb->c.ds = graphic_console_init(xenfb_update,
|
|
1013 |
xenfb_invalidate, |
|
1014 |
NULL, |
|
1015 |
NULL, |
|
1016 |
fb); |
|
1007 |
fb->c.con = graphic_console_init(xenfb_update,
|
|
1008 |
xenfb_invalidate,
|
|
1009 |
NULL,
|
|
1010 |
NULL,
|
|
1011 |
fb);
|
|
1017 | 1012 |
fb->have_console = 1; |
1018 | 1013 |
|
1019 | 1014 |
/* vkbd */ |
1020 | 1015 |
in = container_of(xin, struct XenInput, c.xendev); |
1021 |
in->c.ds = fb->c.ds;
|
|
1016 |
in->c.con = fb->c.con;
|
|
1022 | 1017 |
|
1023 | 1018 |
/* retry ->init() */ |
1024 | 1019 |
xen_be_check_state(xin); |
Also available in: Unified diff