[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 8/9] spice: simple display
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH 8/9] spice: simple display |
Date: |
Thu, 19 Aug 2010 19:23:42 +0400 (MSD) |
User-agent: |
Alpine 2.00 (LNX 1167 2008-08-23) |
On Thu, 19 Aug 2010, Anthony Liguori wrote:
> On 08/19/2010 07:40 AM, Gerd Hoffmann wrote:
> > With that patch applied you'll actually see the guests screen in the
> > spice client. This does *not* bring qxl and full spice support though.
> > This is basically the qxl vga mode made more generic, so it plays
> > together with any qemu-emulated gfx card. You can display stdvga or
> > cirrus via spice client. You can have both vnc and spice enabled and
> > clients connected at the same time.
[..snip..]
> > +
> > +void qemu_spice_destroy_update(SimpleSpiceDisplay *sdpy, SimpleSpiceUpdate
> > *update)
> > +{
> > + qemu_free(update->bitmap);
> > + qemu_free(update);
> > +}
> > +
> > +void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd)
> > +{
> > + QXLDevMemSlot memslot;
> > +
> > + if (debug)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> >
>
> a dprintf() would better fit qemu's style.
A dprintf is a POSIX function.
>
> > + memset(&memslot, 0, sizeof(memslot));
> > + memslot.slot_group_id = MEMSLOT_GROUP_HOST;
> > + memslot.virt_end = ~0;
> > + ssd->worker->add_memslot(ssd->worker,&memslot);
> > +}
> > +
> > +void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
> > +{
> > + QXLDevSurfaceCreate surface;
> > +
> > + if (debug)
> > + fprintf(stderr, "%s: %dx%d\n", __FUNCTION__,
> > + ds_get_width(ssd->ds), ds_get_height(ssd->ds));
> > +
> > + surface.format = SPICE_SURFACE_FMT_32_xRGB;
> > + surface.width = ds_get_width(ssd->ds);
> > + surface.height = ds_get_height(ssd->ds);
> > + surface.stride = -surface.width * 4;
> > + surface.mouse_mode = 0;
> > + surface.flags = 0;
> > + surface.type = 0;
> > + surface.mem = (intptr_t)ssd->buf;
> > + surface.group_id = MEMSLOT_GROUP_HOST;
> > + ssd->worker->create_primary_surface(ssd->worker, 0,&surface);
> > +}
> > +
> > +void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd)
> > +{
> > + if (debug)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > +
> > + ssd->worker->destroy_primary_surface(ssd->worker, 0);
> > +}
> > +
> > +void qemu_spice_vm_change_state_handler(void *opaque, int running, int
> > reason)
> > +{
> > + SimpleSpiceDisplay *ssd = opaque;
> > +
> > + if (running) {
> > + ssd->worker->start(ssd->worker);
> > + } else {
> > + ssd->worker->stop(ssd->worker);
> > + }
> > + ssd->running = running;
> > +}
> > +
> > +/* display listener callbacks */
> > +
> > +void qemu_spice_display_update(SimpleSpiceDisplay *ssd,
> > + int x, int y, int w, int h)
> > +{
> > + QXLRect update_area;
> > +
> > + if (debug> 1)
> > + fprintf(stderr, "%s: x %d y %d w %d h %d\n", __FUNCTION__, x, y, w,
> > h);
> > + update_area.left = x,
> > + update_area.right = x + w;
> > + update_area.top = y;
> > + update_area.bottom = y + h;
> > +
> > + pthread_mutex_lock(&ssd->lock);
> > + if (qemu_spice_rect_is_empty(&ssd->dirty)) {
> > + ssd->notify++;
> > + }
> > + qemu_spice_rect_union(&ssd->dirty,&update_area);
> > + pthread_mutex_unlock(&ssd->lock);
> > +}
> > +
> > +void qemu_spice_display_resize(SimpleSpiceDisplay *ssd)
> > +{
> > + if (debug)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > +
> > + pthread_mutex_lock(&ssd->lock);
> > + memset(&ssd->dirty, 0, sizeof(ssd->dirty));
> > + pthread_mutex_unlock(&ssd->lock);
> > +
> > + qemu_spice_destroy_host_primary(ssd);
> > + qemu_spice_create_host_primary(ssd);
> > + qemu_pf_conv_put(ssd->conv);
> > + ssd->conv = NULL;
> > +
> > + pthread_mutex_lock(&ssd->lock);
> > + memset(&ssd->dirty, 0, sizeof(ssd->dirty));
> > + ssd->notify++;
> > + pthread_mutex_unlock(&ssd->lock);
> > +}
> > +
> > +void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
> > +{
> > + if (debug> 2)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > + vga_hw_update();
> > + if (ssd->notify) {
> > + ssd->notify = 0;
> > + ssd->worker->wakeup(ssd->worker);
> > + if (debug> 1)
> > + fprintf(stderr, "%s: notify\n", __FUNCTION__);
> > + }
> > +}
> > +
> > +/* spice display interface callbacks */
> > +
> > +static void interface_attach_worker(QXLInstance *sin, QXLWorker
> > *qxl_worker)
> > +{
> > + SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
> > +
> > + if (debug)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > + ssd->worker = qxl_worker;
> > +}
> > +
> > +static void interface_set_compression_level(QXLInstance *sin, int level)
> > +{
> > + if (debug)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > + /* nothing to do */
> > +}
> > +
> > +static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
> > +{
> > + if (debug> 2)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > + /* nothing to do */
> > +}
> > +
> > +static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
> > +{
> > + SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
> > +
> > + info->memslot_gen_bits = MEMSLOT_GENERATION_BITS;
> > + info->memslot_id_bits = MEMSLOT_SLOT_BITS;
> > + info->num_memslots = NUM_MEMSLOTS;
> > + info->num_memslots_groups = NUM_MEMSLOTS_GROUPS;
> > + info->internal_groupslot_id = 0;
> > + info->qxl_ram_size = ssd->bufsize;
> > + info->n_surfaces = NUM_SURFACES;
> > +}
> > +
> > +static int interface_get_command(QXLInstance *sin, struct QXLCommandExt
> > *ext)
> > +{
> > + SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
> > + SimpleSpiceUpdate *update;
> > +
> > + if (debug> 2)
> > + fprintf(stderr, "%s:\n", __FUNCTION__);
> > + update = qemu_spice_create_update(ssd);
[..snip..]
--
mailto:address@hidden
- [Qemu-devel] [PATCH 7/9] spice: add mouse, (continued)
[Qemu-devel] [PATCH 9/9] spice: add tablet support, Gerd Hoffmann, 2010/08/19
[Qemu-devel] [PATCH 8/9] spice: simple display, Gerd Hoffmann, 2010/08/19
Re: [Qemu-devel] [PATCH 8/9] spice: simple display, Alexander Graf, 2010/08/19
Re: [Qemu-devel] [PATCH 8/9] spice: simple display, Gerd Hoffmann, 2010/08/25
Re: [Qemu-devel] [PATCH 8/9] spice: simple display, Gerd Hoffmann, 2010/08/19
Re: [Qemu-devel] [PATCH 8/9] spice: simple display, Anthony Liguori, 2010/08/19