misc spice patches

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJS77A5AAoJEEy22O7T6HE44LEQAKNNrNRbiL129H7aUq/dEKJs
 Gn7gVIjY/cTBQRDBo7O1qVgZ9lshrkSYZf8RSqOHd3gRzypjrmh/Xcb4SkfckAhX
 uzU+PZTF5GLyq7VRZZzAdjgHClfwUMbVJ5+CjZ66GH123ZdRcUar2wMafk/mjEDG
 ZqYMzi6GboyERZ/bDeqysmKdOzTZQnCKsaV1/0PKWE36dXNQ9s2sUZH4dsWM/Gyl
 xltL4h0sYCQ2UuWTUriZantVV1v4P407qEOWcYOZ+fVNDg5HkX03ryGP0+AVX7Tr
 Eu0UZhpNj8gNnz53oekpByO394XEh4lIiLRY7kwY2054Q0bJ/gecwQObg43jEDTv
 wCtK5dQGOFs2HSKKlkfzhQpt4lfLb0V6cZ7tzWVMYEQFZ2G769BQgStZSbdcwrkk
 R7TW5DtmwsQBeR+E3rQdq6LJMQCkLKgwVkClJP4YK4Lq9YaRBWa8DBNMYn/jdzyt
 dRKuK7K3cwtJ8Md2TmAAY4FxBEk6luDcyUM1e7Y3sRF8pUKEXJhLGoxrYtzuWmr3
 mmimkn9NdbRYgA0jONeAC2VANtAB0zoEBAy3mvUJ6mTuz6OYfy//bQ2OsSVh9ckU
 p7rc2UlDBu0oldestyt91L/l7WfsyQilxVzglgVBKgk/UlNwRL61x1mpHJ1fZFDE
 nqMy6rZQZjGhJvGiymgm
 =+QMF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/spice/tags/pull-spice-2' into staging

misc spice patches

# gpg: Signature made Mon 03 Feb 2014 15:05:29 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/spice/tags/pull-spice-2:
  spice: hook qemu_chr_fe_set_open() event to ports
  Add the ability to vary Spice playback and record rates, to facilitate Opus support.
  hw/display/qxl: fix signed to unsigned comparison
  qxl: clear irq on reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-02-06 10:21:12 +00:00
commit 26530780c2
3 changed files with 55 additions and 13 deletions

View File

@ -25,8 +25,17 @@
#include "audio.h"
#include "audio_int.h"
#define LINE_IN_SAMPLES 1024
#define LINE_OUT_SAMPLES 1024
#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
#define LINE_OUT_SAMPLES (480 * 4)
#else
#define LINE_OUT_SAMPLES (256 * 4)
#endif
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
#define LINE_IN_SAMPLES (480 * 4)
#else
#define LINE_IN_SAMPLES (256 * 4)
#endif
typedef struct SpiceRateCtl {
int64_t start_ticks;
@ -111,7 +120,11 @@ static int line_out_init (HWVoiceOut *hw, struct audsettings *as)
SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);
struct audsettings settings;
#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
settings.freq = spice_server_get_best_playback_rate(NULL);
#else
settings.freq = SPICE_INTERFACE_PLAYBACK_FREQ;
#endif
settings.nchannels = SPICE_INTERFACE_PLAYBACK_CHAN;
settings.fmt = AUD_FMT_S16;
settings.endianness = AUDIO_HOST_ENDIANNESS;
@ -122,6 +135,9 @@ static int line_out_init (HWVoiceOut *hw, struct audsettings *as)
out->sin.base.sif = &playback_sif.base;
qemu_spice_add_interface (&out->sin.base);
#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
spice_server_set_playback_rate(&out->sin, settings.freq);
#endif
return 0;
}
@ -232,7 +248,11 @@ static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
struct audsettings settings;
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
settings.freq = spice_server_get_best_record_rate(NULL);
#else
settings.freq = SPICE_INTERFACE_RECORD_FREQ;
#endif
settings.nchannels = SPICE_INTERFACE_RECORD_CHAN;
settings.fmt = AUD_FMT_S16;
settings.endianness = AUDIO_HOST_ENDIANNESS;
@ -243,6 +263,9 @@ static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
in->sin.base.sif = &record_sif.base;
qemu_spice_add_interface (&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, settings.freq);
#endif
return 0;
}

View File

@ -19,6 +19,7 @@
*/
#include <zlib.h>
#include <stdint.h>
#include "qemu-common.h"
#include "qemu/timer.h"
@ -1126,6 +1127,7 @@ static void qxl_reset_state(PCIQXLDevice *d)
d->num_free_res = 0;
d->last_release = NULL;
memset(&d->ssd.dirty, 0, sizeof(d->ssd.dirty));
qxl_update_irq(d);
}
static void qxl_soft_reset(PCIQXLDevice *d)
@ -1360,14 +1362,16 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,
{
QXLDevSurfaceCreate surface;
QXLSurfaceCreate *sc = &qxl->guest_primary.surface;
int size;
int requested_height = le32_to_cpu(sc->height);
uint32_t 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__);
if (requested_stride == INT32_MIN ||
abs(requested_stride) * (uint64_t)requested_height
> qxl->vgamem_size) {
qxl_set_guest_bug(qxl, "%s: requested primary larger than framebuffer"
" stride %d x height %" PRIu32 " > %" PRIu32,
__func__, requested_stride, requested_height,
qxl->vgamem_size);
return;
}

View File

@ -212,7 +212,7 @@ static void spice_chr_close(struct CharDriverState *chr)
g_free(s);
}
static void spice_chr_set_fe_open(struct CharDriverState *chr, int fe_open)
static void spice_vmc_set_fe_open(struct CharDriverState *chr, int fe_open)
{
SpiceCharDriver *s = chr->opaque;
if (fe_open) {
@ -222,6 +222,19 @@ static void spice_chr_set_fe_open(struct CharDriverState *chr, int fe_open)
}
}
static void spice_port_set_fe_open(struct CharDriverState *chr, int fe_open)
{
#if SPICE_SERVER_VERSION >= 0x000c02
SpiceCharDriver *s = chr->opaque;
if (fe_open) {
spice_server_port_event(&s->sin, SPICE_PORT_EVENT_OPENED);
} else {
spice_server_port_event(&s->sin, SPICE_PORT_EVENT_CLOSED);
}
#endif
}
static void spice_chr_fe_event(struct CharDriverState *chr, int event)
{
#if SPICE_SERVER_VERSION >= 0x000c02
@ -248,7 +261,9 @@ static void print_allowed_subtypes(void)
fprintf(stderr, "\n");
}
static CharDriverState *chr_open(const char *subtype)
static CharDriverState *chr_open(const char *subtype,
void (*set_fe_open)(struct CharDriverState *, int))
{
CharDriverState *chr;
SpiceCharDriver *s;
@ -262,7 +277,7 @@ static CharDriverState *chr_open(const char *subtype)
chr->chr_write = spice_chr_write;
chr->chr_add_watch = spice_chr_add_watch;
chr->chr_close = spice_chr_close;
chr->chr_set_fe_open = spice_chr_set_fe_open;
chr->chr_set_fe_open = set_fe_open;
chr->explicit_be_open = true;
chr->chr_fe_event = spice_chr_fe_event;
@ -291,7 +306,7 @@ CharDriverState *qemu_chr_open_spice_vmc(const char *type)
return NULL;
}
return chr_open(type);
return chr_open(type, spice_vmc_set_fe_open);
}
#if SPICE_SERVER_VERSION >= 0x000c02
@ -305,7 +320,7 @@ CharDriverState *qemu_chr_open_spice_port(const char *name)
return NULL;
}
chr = chr_open("port");
chr = chr_open("port", spice_port_set_fe_open);
s = chr->opaque;
s->sin.portname = g_strdup(name);