[Spice-devel] [win32/vd_agent 2/4] add to CCD object reference to parent WDDM object

Frediano Ziglio fziglio at redhat.com
Thu Mar 7 22:28:19 UTC 2019


> 
> Adding to CCD object reference to WDDM interface that includes it.
> This allows to use WDDM methods from CCD methods.
> 

This is just spaghetti code. CCD was added to deal with a specific
Windows API, if now it calls WDDMInterface it does not make any sense.
Would be better to just send the escape from WDDMInterface::set_monitor_state
in case the state became detached.

> Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
> ---
>  vdagent/display_configuration.cpp | 4 +++-
>  vdagent/display_configuration.h   | 5 ++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/vdagent/display_configuration.cpp
> b/vdagent/display_configuration.cpp
> index bb2fb80..f535a38 100644
> --- a/vdagent/display_configuration.cpp
> +++ b/vdagent/display_configuration.cpp
> @@ -416,6 +416,7 @@ WDDMInterface::WDDMInterface()
>      , _pfnEscape(NULL)
>      , _pfnOpen_adapter_device_name(NULL)
>      , _pfnOpen_adapter_gdi_name(NULL)
> +    , _ccd(*this)
>  {
>      LONG error(0);
>      //Can we find the D3D calls we need?
> @@ -679,7 +680,7 @@ bool WDDMInterface::escape(LPCTSTR device_name, void*
> data, UINT size_data)
>      return NT_SUCCESS(status);
>  }
>  
> -CCD::CCD()
> +CCD::CCD(WDDMInterface& wddm)
>      :_numPathElements(0)
>      ,_numModeElements(0)
>      ,_pPathInfo(NULL)
> @@ -690,6 +691,7 @@ CCD::CCD()
>      ,_pfnSetDisplayConfig(NULL)
>      ,_primary_detached(false)
>      ,_path_state(PATH_UPDATED)
> +    ,_wddm(wddm)
>  {
>      load_api();
>      get_config_buffers();
> diff --git a/vdagent/display_configuration.h
> b/vdagent/display_configuration.h
> index 7b5578e..81fabfe 100644
> --- a/vdagent/display_configuration.h
> +++ b/vdagent/display_configuration.h
> @@ -48,9 +48,11 @@ typedef LONG(APIENTRY* PQUERYDISPLAYCONFIG)(UINT32,
> UINT32*, DISPLAYCONFIG_PATH_
>  typedef LONG(APIENTRY* PSETDISPLAYCONFIG)(UINT32, DISPLAYCONFIG_PATH_INFO*,
>  UINT32,
>                                            DISPLAYCONFIG_MODE_INFO*, UINT32);
>  
> +class WDDMInterface;
> +
>  class CCD {
>  public:
> -    CCD();
> +    CCD(WDDMInterface& wddm);
>      ~CCD();
>  
>      bool query_display_config();
> @@ -87,6 +89,7 @@ private:
>  
>      bool  _primary_detached;
>      PATH_STATE _path_state;
> +    WDDMInterface& _wddm;
>  };
>  
>  class DisplayMode;

Frediano


More information about the Spice-devel mailing list