static void xenfb_update(void *opaque)

{

    struct XenFB *xenfb = opaque;

    DisplaySurface *surface;

    int i;



    if (xenfb->c.xendev.be_state != XenbusStateConnected)

        return;



    if (!xenfb->feature_update) {

        /* we don't get update notifications, thus use the

         * sledge hammer approach ... */

        xenfb->up_fullscreen = 1;

    }



    /* resize if needed */

    if (xenfb->do_resize) {

        pixman_format_code_t format;



        xenfb->do_resize = 0;

        switch (xenfb->depth) {

        case 16:

        case 32:

            /* console.c supported depth -> buffer can be used directly */

            format = qemu_default_pixman_format(xenfb->depth, true);

            surface = qemu_create_displaysurface_from

                (xenfb->width, xenfb->height, format,

                 xenfb->row_stride, xenfb->pixels + xenfb->offset);

            break;

        default:

            /* we must convert stuff */

            surface = qemu_create_displaysurface(xenfb->width, xenfb->height);

            break;

        }

        dpy_gfx_replace_surface(xenfb->c.con, surface);

        xen_pv_printf(&xenfb->c.xendev, 1,

                      "update: resizing: %dx%d @ %d bpp%s\n",

                      xenfb->width, xenfb->height, xenfb->depth,

                      is_buffer_shared(surface) ? " (shared)" : "");

        xenfb->up_fullscreen = 1;

    }



    /* run queued updates */

    if (xenfb->up_fullscreen) {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");

        xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);

    } else if (xenfb->up_count) {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: %d rects\n",

                      xenfb->up_count);

        for (i = 0; i < xenfb->up_count; i++)

            xenfb_guest_copy(xenfb,

                             xenfb->up_rects[i].x,

                             xenfb->up_rects[i].y,

                             xenfb->up_rects[i].w,

                             xenfb->up_rects[i].h);

    } else {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: nothing\n");

    }

    xenfb->up_count = 0;

    xenfb->up_fullscreen = 0;

}

static void xenfb_update(void *opaque)

{

    struct XenFB *xenfb = opaque;

    DisplaySurface *surface;

    int i;



    if (xenfb->c.xendev.be_state != XenbusStateConnected)

        return;



    if (!xenfb->feature_update) {

        



        xenfb->up_fullscreen = 1;

    }



    

    if (xenfb->do_resize) {

        pixman_format_code_t format;



        xenfb->do_resize = 0;

        switch (xenfb->depth) {

        case 16:

        case 32:

            

            format = qemu_default_pixman_format(xenfb->depth, true);

            surface = qemu_create_displaysurface_from

                (xenfb->width, xenfb->height, format,

                 xenfb->row_stride, xenfb->pixels + xenfb->offset);

            break;

        default:

            

            surface = qemu_create_displaysurface(xenfb->width, xenfb->height);

            break;

        }

        dpy_gfx_replace_surface(xenfb->c.con, surface);

        xen_pv_printf(&xenfb->c.xendev, 1,

                      "update: resizing: %dx%d @ %d bpp%s\n",

                      xenfb->width, xenfb->height, xenfb->depth,

                      is_buffer_shared(surface) ? " (shared)" : "");

        xenfb->up_fullscreen = 1;

    }



    

    if (xenfb->up_fullscreen) {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");

        xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);

    } else if (xenfb->up_count) {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: %d rects\n",

                      xenfb->up_count);

        for (i = 0; i < xenfb->up_count; i++)

            xenfb_guest_copy(xenfb,

                             xenfb->up_rects[i].x,

                             xenfb->up_rects[i].y,

                             xenfb->up_rects[i].w,

                             xenfb->up_rects[i].h);

    } else {

        xen_pv_printf(&xenfb->c.xendev, 3, "update: nothing\n");

    }

    xenfb->up_count = 0;

    xenfb->up_fullscreen = 0;

}

static void FUNC_0(void *VAR_0)

{

    struct XenFB *VAR_1 = VAR_0;

    DisplaySurface *surface;

    int VAR_2;



    if (VAR_1->c.xendev.be_state != XenbusStateConnected)

        return;



    if (!VAR_1->feature_update) {

        



        VAR_1->up_fullscreen = 1;

    }



    

    if (VAR_1->do_resize) {

        pixman_format_code_t format;



        VAR_1->do_resize = 0;

        switch (VAR_1->depth) {

        case 16:

        case 32:

            

            format = qemu_default_pixman_format(VAR_1->depth, true);

            surface = qemu_create_displaysurface_from

                (VAR_1->width, VAR_1->height, format,

                 VAR_1->row_stride, VAR_1->pixels + VAR_1->offset);

            break;

        default:

            

            surface = qemu_create_displaysurface(VAR_1->width, VAR_1->height);

            break;

        }

        dpy_gfx_replace_surface(VAR_1->c.con, surface);

        xen_pv_printf(&VAR_1->c.xendev, 1,

                      "update: resizing: %dx%d @ %d bpp%s\n",

                      VAR_1->width, VAR_1->height, VAR_1->depth,

                      is_buffer_shared(surface) ? " (shared)" : "");

        VAR_1->up_fullscreen = 1;

    }



    

    if (VAR_1->up_fullscreen) {

        xen_pv_printf(&VAR_1->c.xendev, 3, "update: fullscreen\n");

        xenfb_guest_copy(VAR_1, 0, 0, VAR_1->width, VAR_1->height);

    } else if (VAR_1->up_count) {

        xen_pv_printf(&VAR_1->c.xendev, 3, "update: %d rects\n",

                      VAR_1->up_count);

        for (VAR_2 = 0; VAR_2 < VAR_1->up_count; VAR_2++)

            xenfb_guest_copy(VAR_1,

                             VAR_1->up_rects[VAR_2].x,

                             VAR_1->up_rects[VAR_2].y,

                             VAR_1->up_rects[VAR_2].w,

                             VAR_1->up_rects[VAR_2].h);

    } else {

        xen_pv_printf(&VAR_1->c.xendev, 3, "update: nothing\n");

    }

    VAR_1->up_count = 0;

    VAR_1->up_fullscreen = 0;

}

static void FUNC_0(void *VAR_0)
{ struct XenFB *VAR_1 = VAR_0; DisplaySurface *surface; int VAR_2; if (VAR_1->c.xendev.be_state != XenbusStateConnected)
return; if (!VAR_1->feature_update) { VAR_1->up_fullscreen = 1; } if (VAR_1->do_resize) { pixman_format_code_t format; VAR_1->do_resize = 0; switch (VAR_1->depth) { case 16:
case 32:
format = qemu_default_pixman_format(VAR_1->depth, true); surface = qemu_create_displaysurface_from
(VAR_1->width, VAR_1->height, format,
VAR_1->row_stride, VAR_1->pixels + VAR_1->offset); break; default:
surface = qemu_create_displaysurface(VAR_1->width, VAR_1->height); break; } dpy_gfx_replace_surface(VAR_1->c.con, surface); xen_pv_printf(&VAR_1->c.xendev, 1,
"update: resizing: %dx%d @ %d bpp%s\n",
VAR_1->width, VAR_1->height, VAR_1->depth,
is_buffer_shared(surface) ? " (shared)" : ""); VAR_1->up_fullscreen = 1; } if (VAR_1->up_fullscreen) { xen_pv_printf(&VAR_1->c.xendev, 3, "update: fullscreen\n"); xenfb_guest_copy(VAR_1, 0, 0, VAR_1->width, VAR_1->height); } else if (VAR_1->up_count) { xen_pv_printf(&VAR_1->c.xendev, 3, "update: %d rects\n",
VAR_1->up_count); for (VAR_2 = 0; VAR_2 < VAR_1->up_count; VAR_2++) xenfb_guest_copy(VAR_1,
VAR_1->up_rects[VAR_2].x,
VAR_1->up_rects[VAR_2].y,
VAR_1->up_rects[VAR_2].w,
VAR_1->up_rects[VAR_2].h); } else { xen_pv_printf(&VAR_1->c.xendev, 3, "update: nothing\n"); } VAR_1->up_count = 0; VAR_1->up_fullscreen = 0; }