[Spice-devel] [PATCH v3 20/28] Add type enum to qxl/vga device

Frediano Ziglio fziglio at redhat.com
Fri Sep 9 11:42:05 UTC 2016


> 
> This patch adds type enum to the qxl/vga device class.
> 
> Based on a patch by Sandy Stutsman <sstutsma at redhat.com>
> 
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
> ---
>  qxldod/QxlDod.cpp | 2 ++
>  qxldod/QxlDod.h   | 9 ++++++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 21cb653..5f475b0 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -2312,6 +2312,7 @@ VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod) :
> HwDeviceInterface(pQxlDod)
>      m_ModeNumbers = NULL;
>      m_CurrentMode = 0;
>      m_Id = 0;
> +    m_type = VGA_DEVICE;
>  }
>  
>  VgaDevice::~VgaDevice(void)
> @@ -2947,6 +2948,7 @@ QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod) :
> HwDeviceInterface(pQxlDod)
>      m_CustomMode = 0;
>      m_FreeOutputs = 0;
>      m_Pending = 0;
> +    m_type = QXL_DEVICE;
>  }
>  
>  QxlDevice::~QxlDevice(void)
> diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
> index fc7c245..7e2990d 100755
> --- a/qxldod/QxlDod.h
> +++ b/qxldod/QxlDod.h
> @@ -213,9 +213,15 @@ typedef struct _CURRENT_BDD_MODE
>  
>  class QxlDod;
>  
> +typedef enum {
> +    QXL_DEVICE,
> +    VGA_DEVICE,
> +    INVALID_DEVICE,
> +}WIN_QXL_DEVICE_TYPE;
> +
>  class HwDeviceInterface {
>  public:
> -    HwDeviceInterface(_In_ QxlDod* pQxlDod) {}
> +    HwDeviceInterface(_In_ QxlDod* pQxlDod) {m_type = INVALID_DEVICE;}
>      virtual ~HwDeviceInterface() {;}
>      virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0;
>      virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
> @@ -260,6 +266,7 @@ protected:
>      USHORT m_CurrentMode;
>      USHORT m_CustomMode;
>      ULONG  m_Id;
> +    WIN_QXL_DEVICE_TYPE m_type;
>  };
>  
>  class VgaDevice  :

As already said in C++ usually virtual functions are used
for this purpose.

Frediano


More information about the Spice-devel mailing list