From c7936395ecf322b3de37662c7c6b772e36866cc7 Mon Sep 17 00:00:00 2001 Message-Id: From: Gerd Hoffmann Date: Fri, 13 May 2016 16:09:28 -0400 Subject: [CHANGE 1/3] qxl: allow to specify head limit to qxl driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: rhvirt-patches@redhat.com, jen@redhat.com RH-Author: Gerd Hoffmann Message-id: <1463155769-32352-2-git-send-email-kraxel@redhat.com> Patchwork-id: 70404 O-Subject: [RHEL-7.3 qemu-kvm PATCH 1/2] qxl: allow to specify head limit to qxl driver Bugzilla: 1283198 RH-Acked-by: Marc-André Lureau RH-Acked-by: Laszlo Ersek RH-Acked-by: Thomas Huth From: Frediano Ziglio 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). Signed-off-by: Frediano Ziglio Signed-off-by: Gerd Hoffmann (cherry picked from commit 567161fdd47aeb6987e700702f6bbfef04ae0236) Signed-off-by: Jeff E. Nelson --- hw/display/qxl.c | 26 +++++++++++++++++++++----- hw/display/qxl.h | 3 +++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index f11210c..1f6a303 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -266,6 +266,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, @@ -991,6 +997,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, @@ -1013,17 +1020,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 */ + if (qxl->max_outputs && qxl->max_outputs <= max_outputs) { + max_outputs = qxl->max_outputs; + } +#endif + memset(&rom->client_monitors_config, 0, sizeof(rom->client_monitors_config)); rom->client_monitors_config.count = monitors_config->num_of_monitors; /* monitors_config->flags ignored */ - if (rom->client_monitors_config.count >= - ARRAY_SIZE(rom->client_monitors_config.heads)) { + if (rom->client_monitors_config.count >= max_outputs) { trace_qxl_client_monitors_config_capped(qxl->id, monitors_config->num_of_monitors, - ARRAY_SIZE(rom->client_monitors_config.heads)); - rom->client_monitors_config.count = - ARRAY_SIZE(rom->client_monitors_config.heads); + max_outputs); + rom->client_monitors_config.count = max_outputs; } for (i = 0 ; i < rom->client_monitors_config.count ; ++i) { VDAgentMonConfig *monitor = &monitors_config->monitors[i]; @@ -2294,6 +2307,9 @@ static Property qxl_properties[] = { DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -1), DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16), DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024), +#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */ + DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0), +#endif DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/display/qxl.h b/hw/display/qxl.h index 5da33e2..5247ce9 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -95,6 +95,9 @@ typedef struct PCIQXLDevice { QXLModes *modes; uint32_t rom_size; MemoryRegion rom_bar; +#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */ + uint16_t max_outputs; +#endif /* vram pci bar */ uint32_t vram_size; -- 2.5.5