thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-qxl-allow-to-specify-head-limit-to-qxl-driver.patch

34b321
From c7936395ecf322b3de37662c7c6b772e36866cc7 Mon Sep 17 00:00:00 2001
34b321
Message-Id: <c7936395ecf322b3de37662c7c6b772e36866cc7.1464449390.git.jen@redhat.com>
34b321
From: Gerd Hoffmann <kraxel@redhat.com>
34b321
Date: Fri, 13 May 2016 16:09:28 -0400
34b321
Subject: [CHANGE 1/3] qxl: allow to specify head limit to qxl driver
34b321
MIME-Version: 1.0
34b321
Content-Type: text/plain; charset=UTF-8
34b321
Content-Transfer-Encoding: 8bit
34b321
To: rhvirt-patches@redhat.com,
34b321
    jen@redhat.com
34b321
34b321
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
34b321
Message-id: <1463155769-32352-2-git-send-email-kraxel@redhat.com>
34b321
Patchwork-id: 70404
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH 1/2] qxl: allow to specify head limit to qxl driver
34b321
Bugzilla: 1283198
34b321
RH-Acked-by: Marc-André Lureau <mlureau@redhat.com>
34b321
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
34b321
RH-Acked-by: Thomas Huth <thuth@redhat.com>
34b321
34b321
From: Frediano Ziglio <fziglio@redhat.com>
34b321
34b321
This patch allow to limit number of heads using qxl driver. By default
34b321
qxl driver is not limited on any kind on head use so can decide to use
34b321
as much heads.
34b321
34b321
libvirt has this as a video card parameter (actually set to 1 but not
34b321
used). This parameter will allow to limit setting a use can do (which
34b321
could be confusing).
34b321
34b321
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
34b321
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
34b321
(cherry picked from commit 567161fdd47aeb6987e700702f6bbfef04ae0236)
34b321
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
34b321
---
34b321
 hw/display/qxl.c | 26 +++++++++++++++++++++-----
34b321
 hw/display/qxl.h |  3 +++
34b321
 2 files changed, 24 insertions(+), 5 deletions(-)
34b321
34b321
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
34b321
index f11210c..1f6a303 100644
34b321
--- a/hw/display/qxl.c
34b321
+++ b/hw/display/qxl.c
34b321
@@ -266,6 +266,12 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
34b321
                     QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
34b321
                     0));
34b321
     } else {
34b321
+#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
34b321
+        if (qxl->max_outputs) {
34b321
+            spice_qxl_set_monitors_config_limit(&qxl->ssd.qxl,
34b321
+                                                qxl->max_outputs);
34b321
+        }
34b321
+#endif
34b321
         qxl->guest_monitors_config = qxl->ram->monitors_config;
34b321
         spice_qxl_monitors_config_async(&qxl->ssd.qxl,
34b321
                 qxl->ram->monitors_config,
34b321
@@ -991,6 +997,7 @@ static int interface_client_monitors_config(QXLInstance *sin,
34b321
     PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
34b321
     QXLRom *rom = memory_region_get_ram_ptr(&qxl->rom_bar);
34b321
     int i;
34b321
+    unsigned max_outputs = ARRAY_SIZE(rom->client_monitors_config.heads);
34b321
 
34b321
     if (qxl->revision < 4) {
34b321
         trace_qxl_client_monitors_config_unsupported_by_device(qxl->id,
34b321
@@ -1013,17 +1020,23 @@ static int interface_client_monitors_config(QXLInstance *sin,
34b321
     if (!monitors_config) {
34b321
         return 1;
34b321
     }
34b321
+
34b321
+#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
34b321
+    /* limit number of outputs based on setting limit */
34b321
+    if (qxl->max_outputs && qxl->max_outputs <= max_outputs) {
34b321
+        max_outputs = qxl->max_outputs;
34b321
+    }
34b321
+#endif
34b321
+
34b321
     memset(&rom->client_monitors_config, 0,
34b321
            sizeof(rom->client_monitors_config));
34b321
     rom->client_monitors_config.count = monitors_config->num_of_monitors;
34b321
     /* monitors_config->flags ignored */
34b321
-    if (rom->client_monitors_config.count >=
34b321
-            ARRAY_SIZE(rom->client_monitors_config.heads)) {
34b321
+    if (rom->client_monitors_config.count >= max_outputs) {
34b321
         trace_qxl_client_monitors_config_capped(qxl->id,
34b321
                                 monitors_config->num_of_monitors,
34b321
-                                ARRAY_SIZE(rom->client_monitors_config.heads));
34b321
-        rom->client_monitors_config.count =
34b321
-            ARRAY_SIZE(rom->client_monitors_config.heads);
34b321
+                                max_outputs);
34b321
+        rom->client_monitors_config.count = max_outputs;
34b321
     }
34b321
     for (i = 0 ; i < rom->client_monitors_config.count ; ++i) {
34b321
         VDAgentMonConfig *monitor = &monitors_config->monitors[i];
34b321
@@ -2294,6 +2307,9 @@ static Property qxl_properties[] = {
34b321
         DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -1),
34b321
         DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16),
34b321
         DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024),
34b321
+#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
34b321
+        DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0),
34b321
+#endif
34b321
         DEFINE_PROP_END_OF_LIST(),
34b321
 };
34b321
 
34b321
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
34b321
index 5da33e2..5247ce9 100644
34b321
--- a/hw/display/qxl.h
34b321
+++ b/hw/display/qxl.h
34b321
@@ -95,6 +95,9 @@ typedef struct PCIQXLDevice {
34b321
     QXLModes           *modes;
34b321
     uint32_t           rom_size;
34b321
     MemoryRegion       rom_bar;
34b321
+#if SPICE_SERVER_VERSION >= 0x000c06 /* release 0.12.6 */
34b321
+    uint16_t           max_outputs;
34b321
+#endif
34b321
 
34b321
     /* vram pci bar */
34b321
     uint32_t           vram_size;
34b321
-- 
34b321
2.5.5
34b321