static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,

                                     qxl_async_io async)

{

    QXLDevSurfaceCreate surface;

    QXLSurfaceCreate *sc = &qxl->guest_primary.surface;

    int size;

    int requested_height = le32_to_cpu(sc->height);

    int requested_stride = le32_to_cpu(sc->stride);



    size = abs(requested_stride) * requested_height;

    if (size > qxl->vgamem_size) {

        qxl_set_guest_bug(qxl, "%s: requested primary larger then framebuffer"

                               " size", __func__);

        return;

    }



    if (qxl->mode == QXL_MODE_NATIVE) {

        qxl_set_guest_bug(qxl, "%s: nop since already in QXL_MODE_NATIVE",

                      __func__);

    }

    qxl_exit_vga_mode(qxl);



    surface.format     = le32_to_cpu(sc->format);

    surface.height     = le32_to_cpu(sc->height);

    surface.mem        = le64_to_cpu(sc->mem);

    surface.position   = le32_to_cpu(sc->position);

    surface.stride     = le32_to_cpu(sc->stride);

    surface.width      = le32_to_cpu(sc->width);

    surface.type       = le32_to_cpu(sc->type);

    surface.flags      = le32_to_cpu(sc->flags);

    trace_qxl_create_guest_primary(qxl->id, sc->width, sc->height, sc->mem,

                                   sc->format, sc->position);

    trace_qxl_create_guest_primary_rest(qxl->id, sc->stride, sc->type,

                                        sc->flags);



    if ((surface.stride & 0x3) != 0) {

        qxl_set_guest_bug(qxl, "primary surface stride = %d %% 4 != 0",

                          surface.stride);

        return;

    }



    surface.mouse_mode = true;

    surface.group_id   = MEMSLOT_GROUP_GUEST;

    if (loadvm) {

        surface.flags |= QXL_SURF_FLAG_KEEP_DATA;

    }



    qxl->mode = QXL_MODE_NATIVE;

    qxl->cmdflags = 0;

    qemu_spice_create_primary_surface(&qxl->ssd, 0, &surface, async);



    if (async == QXL_SYNC) {

        qxl_create_guest_primary_complete(qxl);

    }

}

static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,

                                     qxl_async_io async)

{

    QXLDevSurfaceCreate surface;

    QXLSurfaceCreate *sc = &qxl->guest_primary.surface;

    int size;

    int requested_height = le32_to_cpu(sc->height);

    int requested_stride = le32_to_cpu(sc->stride);



    size = abs(requested_stride) * requested_height;

    if (size > qxl->vgamem_size) {

        qxl_set_guest_bug(qxl, "%s: requested primary larger then framebuffer"

                               " size", __func__);

        return;

    }



    if (qxl->mode == QXL_MODE_NATIVE) {

        qxl_set_guest_bug(qxl, "%s: nop since already in QXL_MODE_NATIVE",

                      __func__);

    }

    qxl_exit_vga_mode(qxl);



    surface.format     = le32_to_cpu(sc->format);

    surface.height     = le32_to_cpu(sc->height);

    surface.mem        = le64_to_cpu(sc->mem);

    surface.position   = le32_to_cpu(sc->position);

    surface.stride     = le32_to_cpu(sc->stride);

    surface.width      = le32_to_cpu(sc->width);

    surface.type       = le32_to_cpu(sc->type);

    surface.flags      = le32_to_cpu(sc->flags);

    trace_qxl_create_guest_primary(qxl->id, sc->width, sc->height, sc->mem,

                                   sc->format, sc->position);

    trace_qxl_create_guest_primary_rest(qxl->id, sc->stride, sc->type,

                                        sc->flags);



    if ((surface.stride & 0x3) != 0) {

        qxl_set_guest_bug(qxl, "primary surface stride = %d %% 4 != 0",

                          surface.stride);

        return;

    }



    surface.mouse_mode = true;

    surface.group_id   = MEMSLOT_GROUP_GUEST;

    if (loadvm) {

        surface.flags |= QXL_SURF_FLAG_KEEP_DATA;

    }



    qxl->mode = QXL_MODE_NATIVE;

    qxl->cmdflags = 0;

    qemu_spice_create_primary_surface(&qxl->ssd, 0, &surface, async);



    if (async == QXL_SYNC) {

        qxl_create_guest_primary_complete(qxl);

    }

}

    int size;     int requested_height = le32_to_cpu(sc->height);     size = abs(requested_stride) * requested_height;     if (size > qxl->vgamem_size) {         qxl_set_guest_bug(qxl, "%s: requested primary larger then framebuffer"                                " size", __func__);
static void FUNC_0(PCIQXLDevice *VAR_0, int VAR_1,

                                     qxl_async_io VAR_2)

{

    QXLDevSurfaceCreate surface;

    QXLSurfaceCreate *sc = &VAR_0->guest_primary.surface;

    int VAR_3;

    int VAR_4 = le32_to_cpu(sc->height);

    int VAR_5 = le32_to_cpu(sc->stride);



    VAR_3 = abs(VAR_5) * VAR_4;

    if (VAR_3 > VAR_0->vgamem_size) {

        qxl_set_guest_bug(VAR_0, "%s: requested primary larger then framebuffer"

                               " VAR_3", __func__);

        return;

    }



    if (VAR_0->mode == QXL_MODE_NATIVE) {

        qxl_set_guest_bug(VAR_0, "%s: nop since already in QXL_MODE_NATIVE",

                      __func__);

    }

    qxl_exit_vga_mode(VAR_0);



    surface.format     = le32_to_cpu(sc->format);

    surface.height     = le32_to_cpu(sc->height);

    surface.mem        = le64_to_cpu(sc->mem);

    surface.position   = le32_to_cpu(sc->position);

    surface.stride     = le32_to_cpu(sc->stride);

    surface.width      = le32_to_cpu(sc->width);

    surface.type       = le32_to_cpu(sc->type);

    surface.flags      = le32_to_cpu(sc->flags);

    trace_qxl_create_guest_primary(VAR_0->id, sc->width, sc->height, sc->mem,

                                   sc->format, sc->position);

    trace_qxl_create_guest_primary_rest(VAR_0->id, sc->stride, sc->type,

                                        sc->flags);



    if ((surface.stride & 0x3) != 0) {

        qxl_set_guest_bug(VAR_0, "primary surface stride = %d %% 4 != 0",

                          surface.stride);

        return;

    }



    surface.mouse_mode = true;

    surface.group_id   = MEMSLOT_GROUP_GUEST;

    if (VAR_1) {

        surface.flags |= QXL_SURF_FLAG_KEEP_DATA;

    }



    VAR_0->mode = QXL_MODE_NATIVE;

    VAR_0->cmdflags = 0;

    qemu_spice_create_primary_surface(&VAR_0->ssd, 0, &surface, VAR_2);



    if (VAR_2 == QXL_SYNC) {

        qxl_create_guest_primary_complete(VAR_0);

    }

}

static void FUNC_0(PCIQXLDevice *VAR_0, int VAR_1,
qxl_async_io VAR_2)
{ QXLDevSurfaceCreate surface; QXLSurfaceCreate *sc = &VAR_0->guest_primary.surface; int VAR_3; int VAR_4 = le32_to_cpu(sc->height); int VAR_5 = le32_to_cpu(sc->stride); VAR_3 = abs(VAR_5) * VAR_4; if (VAR_3 > VAR_0->vgamem_size) { qxl_set_guest_bug(VAR_0, "%s: requested primary larger then framebuffer"
" VAR_3", __func__); return; } if (VAR_0->mode == QXL_MODE_NATIVE) { qxl_set_guest_bug(VAR_0, "%s: nop since already in QXL_MODE_NATIVE",
__func__); } qxl_exit_vga_mode(VAR_0); surface.format     = le32_to_cpu(sc->format); surface.height     = le32_to_cpu(sc->height); surface.mem        = le64_to_cpu(sc->mem); surface.position   = le32_to_cpu(sc->position); surface.stride     = le32_to_cpu(sc->stride); surface.width      = le32_to_cpu(sc->width); surface.type       = le32_to_cpu(sc->type); surface.flags      = le32_to_cpu(sc->flags); trace_qxl_create_guest_primary(VAR_0->id, sc->width, sc->height, sc->mem,
sc->format, sc->position); trace_qxl_create_guest_primary_rest(VAR_0->id, sc->stride, sc->type,
sc->flags); if ((surface.stride & 0x3) != 0) { qxl_set_guest_bug(VAR_0, "primary surface stride = %d %% 4 != 0",
surface.stride); return; } surface.mouse_mode = true; surface.group_id   = MEMSLOT_GROUP_GUEST; if (VAR_1) { surface.flags |= QXL_SURF_FLAG_KEEP_DATA; } VAR_0->mode = QXL_MODE_NATIVE; VAR_0->cmdflags = 0; qemu_spice_create_primary_surface(&VAR_0->ssd, 0, &surface, VAR_2); if (VAR_2 == QXL_SYNC) { qxl_create_guest_primary_complete(VAR_0); } }