On Fri, Jun 12, 2015 at 03:05:10PM +0100, Frediano Ziglio wrote: > This patch allow to limit number of heads using qxl driver. By default > qxl driver is not limited on any kind on head use so can decide to use > as much heads. > > libvirt has this as a video card parameter (actually set to 1 but not > used). This parameter will allow to limit setting a use can do (which > could be confusing). > > This patch rely on some change in spice-protocol which are not still > accepted. See > http://lists.freedesktop.org/archives/spice-devel/2015-June/020221.html. > > Signed-off-by: Frediano Ziglio > --- > hw/display/qxl.c | 26 +++++++++++++++++++++----- > hw/display/qxl.h | 3 +++ > 2 files changed, 24 insertions(+), 5 deletions(-) > > Change from v1: > - check spice-server version. > > diff --git a/hw/display/qxl.c b/hw/display/qxl.c > index b220e2d..d6e9369 100644 > --- a/hw/display/qxl.c > +++ b/hw/display/qxl.c > @@ -272,6 +272,12 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay) > QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG, > 0)); > } else { > +#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */ > + if (qxl->max_outputs) { > + spice_qxl_set_monitors_config_limit(&qxl->ssd.qxl, > + qxl->max_outputs); > + } > +#endif > qxl->guest_monitors_config = qxl->ram->monitors_config; > spice_qxl_monitors_config_async(&qxl->ssd.qxl, > qxl->ram->monitors_config, > @@ -992,6 +998,7 @@ static int interface_client_monitors_config(QXLInstance *sin, > PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl); > QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar); > int i; > + unsigned max_outputs = ARRAY_SIZE(rom->client_monitors_config.heads); > > if (qxl->revision < 4) { > trace_qxl_client_monitors_config_unsupported_by_device(qxl->id, > @@ -1014,17 +1021,23 @@ static int interface_client_monitors_config(QXLInstance *sin, > if (!monitors_config) { > return 1; > } > + > +#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */ > + /* limit number of outputs based on setting limit */ « based on 'max_outputs' command line parameter » maybe ? Patch looks good to me. Christophe