[Spice-devel] [win32/vd_agent 3/4] introduce turn_monitor_off method of WDDM interface
Yuri Benditovich
yuri.benditovich at daynix.com
Wed Mar 6 17:01:36 UTC 2019
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>
---
vdagent/display_configuration.cpp | 18 ++++++++++++++++++
vdagent/display_configuration.h | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/vdagent/display_configuration.cpp b/vdagent/display_configuration.cpp
index f535a38..4577db2 100644
--- a/vdagent/display_configuration.cpp
+++ b/vdagent/display_configuration.cpp
@@ -489,6 +489,24 @@ 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 81fabfe..756303e 100644
--- a/vdagent/display_configuration.h
+++ b/vdagent/display_configuration.h
@@ -153,7 +153,7 @@ public:
bool update_monitor_config(LPCTSTR device_name, DisplayMode* mode, DEVMODE* dev_mode);
bool update_dev_mode_position(LPCTSTR device_name, DEVMODE * dev_mode, LONG x, LONG y);
void update_config_path();
-
+ bool turn_monitor_off(LPCTSTR device_name);
private:
bool init_d3d_api();
D3D_HANDLE adapter_handle(LPCTSTR device_name);
--
2.16.1.windows.4
More information about the Spice-devel
mailing list