aboutsummaryrefslogtreecommitdiff
path: root/hw/xenfb.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-03-05 15:24:14 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-03-18 10:21:59 +0100
commitc78f71378a345ea240c288993ca1378ded5504b9 (patch)
tree0d5dc0c86064556faed610883db4422ac13c6d66 /hw/xenfb.c
parentbc2ed9704fff2c721e4056ab5281f0291718bfa6 (diff)
console: stop using DisplayState in gfx hardware emulation
Use QemuConsole instead. Updates interfaces in console.[ch] and adapts gfx hardware emulation code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/xenfb.c')
-rw-r--r--hw/xenfb.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/hw/xenfb.c b/hw/xenfb.c
index 7779097f50..7c46a2fa1e 100644
--- a/hw/xenfb.c
+++ b/hw/xenfb.c
@@ -54,7 +54,7 @@
struct common {
struct XenDevice xendev; /* must be first */
void *page;
- DisplayState *ds;
+ QemuConsole *con;
};
struct XenInput {
@@ -318,8 +318,9 @@ static void xenfb_mouse_event(void *opaque,
int dx, int dy, int dz, int button_state)
{
struct XenInput *xenfb = opaque;
- int dw = ds_get_width(xenfb->c.ds);
- int dh = ds_get_height(xenfb->c.ds);
+ DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
+ int dw = surface_width(surface);
+ int dh = surface_height(surface);
int i;
if (xenfb->abs_pointer_wanted)
@@ -353,16 +354,9 @@ static int input_initialise(struct XenDevice *xendev)
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
int rc;
- if (!in->c.ds) {
- char *vfb = xenstore_read_str(NULL, "device/vfb");
- if (vfb == NULL) {
- /* there is no vfb, run vkbd on its own */
- in->c.ds = get_displaystate();
- } else {
- g_free(vfb);
- xen_be_printf(xendev, 1, "ds not set (yet)\n");
- return -1;
- }
+ if (!in->c.con) {
+ xen_be_printf(xendev, 1, "ds not set (yet)\n");
+ return -1;
}
rc = common_bind(&in->c);
@@ -615,12 +609,13 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
*/
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
{
+ DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
int line, oops = 0;
- int bpp = ds_get_bits_per_pixel(xenfb->c.ds);
- int linesize = ds_get_linesize(xenfb->c.ds);
- uint8_t *data = ds_get_data(xenfb->c.ds);
+ int bpp = surface_bits_per_pixel(surface);
+ int linesize = surface_stride(surface);
+ uint8_t *data = surface_data(surface);
- if (!is_buffer_shared(xenfb->c.ds->surface)) {
+ if (!is_buffer_shared(surface)) {
switch (xenfb->depth) {
case 8:
if (bpp == 16) {
@@ -648,10 +643,10 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
xen_be_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n",
__FUNCTION__, xenfb->depth, bpp);
- dpy_gfx_update(xenfb->c.ds, x, y, w, h);
+ dpy_gfx_update(xenfb->c.con, x, y, w, h);
}
-#ifdef XENFB_TYPE_REFRESH_PERIOD
+#if 0 /* def XENFB_TYPE_REFRESH_PERIOD */
static int xenfb_queue_full(struct XenFB *xenfb)
{
struct xenfb_page *page = xenfb->c.page;
@@ -710,7 +705,7 @@ static void xenfb_update(void *opaque)
return;
if (xenfb->feature_update) {
-#ifdef XENFB_TYPE_REFRESH_PERIOD
+#if 0 /* XENFB_TYPE_REFRESH_PERIOD */
struct DisplayChangeListener *l;
int period = 99999999;
int idle = 1;
@@ -764,10 +759,10 @@ static void xenfb_update(void *opaque)
surface = qemu_create_displaysurface(xenfb->width, xenfb->height);
break;
}
- dpy_gfx_replace_surface(xenfb->c.ds, surface);
+ dpy_gfx_replace_surface(xenfb->c.con, surface);
xen_be_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n",
xenfb->width, xenfb->height, xenfb->depth,
- is_buffer_shared(xenfb->c.ds->surface) ? " (shared)" : "");
+ is_buffer_shared(surface) ? " (shared)" : "");
xenfb->up_fullscreen = 1;
}
@@ -1009,16 +1004,16 @@ wait_more:
/* vfb */
fb = container_of(xfb, struct XenFB, c.xendev);
- fb->c.ds = graphic_console_init(xenfb_update,
- xenfb_invalidate,
- NULL,
- NULL,
- fb);
+ fb->c.con = graphic_console_init(xenfb_update,
+ xenfb_invalidate,
+ NULL,
+ NULL,
+ fb);
fb->have_console = 1;
/* vkbd */
in = container_of(xin, struct XenInput, c.xendev);
- in->c.ds = fb->c.ds;
+ in->c.con = fb->c.con;
/* retry ->init() */
xen_be_check_state(xin);