[Spice-commits] 3 commits - vdagent/display_configuration.cpp vdagent/display_configuration.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 8 11:43:57 UTC 2019


 vdagent/display_configuration.cpp |   30 +++++++++++++++++++++++++-----
 vdagent/display_configuration.h   |    1 +
 2 files changed, 26 insertions(+), 5 deletions(-)

New commits:
commit 93f3aee7b456e4845e6a4da77435484f188d4839
Author: Yuri Benditovich <yuri.benditovich at daynix.com>
Date:   Fri Mar 8 11:15:51 2019 +0200

    make display disconnection persistent
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1477191
    Currently on Win10 when one of multiple displays is
    disconnected by the client, the qxl-wddm-dod driver
    does not receive any update, the system just stops using
    this adapter for rendering. As a result, the 'disconnected'
    state of the adapter is not saved anywhere. On further
    connect the client side recognize the adapter as active
    and opens window for it. Current commit fixes the problem
    by sending QXL_ESCAPE_MONITOR_CONFIG with zero area
    to disabled adapter.
    
    Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index 8a694aa..4994917 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -440,7 +440,10 @@ bool WDDMInterface::is_attached(DISPLAY_DEVICE* dev_info)
 
 bool WDDMInterface::set_monitor_state(LPCTSTR device_name, DEVMODE* dev_mode, MONITOR_STATE state)
 {
-   return  _ccd.set_path_state(device_name, state);
+    if (_ccd.is_attached(device_name) && state == MONITOR_DETACHED) {
+        turn_monitor_off(device_name);
+    }
+    return  _ccd.set_path_state(device_name, state);
 }
 
 bool WDDMInterface::custom_display_escape(LPCTSTR device_name, DEVMODE* dev_mode)
commit 12a8f08f3294162ede41c53afd8d35213f115878
Author: Yuri Benditovich <yuri.benditovich at daynix.com>
Date:   Fri Mar 8 11:15:50 2019 +0200

    introduce turn_monitor_off method of WDDM interface
    
    Adding method 'turn_monitor_off' to WDDM interface.
    It sends QXL_ESCAPE_MONITOR_CONFIG escape with zeroed
    display size to qxl-wddm-dod driver.
    
    Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index bb2fb80..8a694aa 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -488,6 +488,23 @@ bool WDDMInterface::update_monitor_config(LPCTSTR device_name, DisplayMode* disp
 
 }
 
+bool WDDMInterface::turn_monitor_off(LPCTSTR device_name)
+{
+    vd_printf("for %S", device_name);
+    if (!_send_monitors_config) {
+        vd_printf("do nothing as _send_monitors_config is off");
+        return false;
+    }
+
+    WDDMMonitorConfigEscape wddm_escape(NULL);
+    if (escape(device_name, &wddm_escape, sizeof(wddm_escape))) {
+        return true;
+    }
+
+    vd_printf("%S failed", device_name);
+    return false;
+}
+
 LONG WDDMInterface::update_display_settings()
 {
     LONG error(0);
diff --git a/vdagent/display_configuration.h b/vdagent/display_configuration.h
index 7b5578e..bdf89dc 100644
--- a/vdagent/display_configuration.h
+++ b/vdagent/display_configuration.h
@@ -160,6 +160,7 @@ private:
 
     void close_adapter(D3D_HANDLE handle);
     bool escape(LPCTSTR device_name, void* data, UINT sizeData);
+    bool turn_monitor_off(LPCTSTR device_name);
 
     //GDI Function pointers
     PFND3DKMT_OPENADAPTERFROMHDC _pfnOpen_adapter_hdc;
commit 6e159118b2318779b0288a1b248ba8aab054d192
Author: Yuri Benditovich <yuri.benditovich at daynix.com>
Date:   Fri Mar 8 11:15:49 2019 +0200

    construct WDDMMonitorConfigEscape also with NULL DisplayMode
    
    Adding possibility to construct WDDMMonitorConfigEscape object
    with NULL parameter of DisplayMode. In this case all the fields
    depending on DisplayMode are set to zero.
    
    Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index cdbbe23..bb2fb80 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -242,10 +242,10 @@ struct WDDMMonitorConfigEscape {
     {
         _ioctl = QXL_ESCAPE_MONITOR_CONFIG;
         _head.id = _head.surface_id = 0;
-        _head.x = mode->get_pos_x();
-        _head.y = mode->get_pos_y();
-        _head.width = mode->get_width();
-        _head.height = mode->get_height();
+        _head.x = mode ? mode->get_pos_x() : 0;
+        _head.y = mode ? mode->get_pos_y() : 0;
+        _head.width = mode ? mode->get_width() : 0;
+        _head.height = mode ? mode->get_height() : 0;
     }
     uint32_t    _ioctl;
     QXLHead     _head;


More information about the Spice-commits mailing list