[Spice-devel] [PATCH qxl-wddm-dod v2 06/25] Add type enum to qxl/vga device
Frediano Ziglio
fziglio at redhat.com
Tue Sep 6 13:17:41 UTC 2016
>
> This patch adds type enum to the qxl/vga device class.
>
> Fixed misspelling: HwDeviceInterface
> Fixed misspelling: GetDxgkInterface
>
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
The GetType and its usage was to avoid the usage of virtual
table. Now that we checked that virtual tables are safe to use
from no-paged code it's much better to use virtual functions.
Ok for the typo.
> ---
> qxldod/QxlDod.cpp | 10 ++++++----
> qxldod/QxlDod.h | 25 +++++++++++++++++--------
> 2 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index dd68693..1c6e477 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -2328,7 +2328,7 @@ VOID BltBits (
> }
> }
>
> -VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
> +VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod) : HwDeviceInterface(pQxlDod)
> {
> m_pQxlDod = pQxlDod;
> m_ModeInfo = NULL;
> @@ -2336,6 +2336,7 @@ VgaDevice::VgaDevice(_In_ QxlDod* pQxlDod)
> m_ModeNumbers = NULL;
> m_CurrentMode = 0;
> m_Id = 0;
> + m_type = VGA_DEVICE;
> }
>
> VgaDevice::~VgaDevice(void)
> @@ -2945,7 +2946,7 @@ NTSTATUS VgaDevice::Escape(_In_ CONST DXGKARG_ESCAPE*
> pEscap)
> return STATUS_NOT_IMPLEMENTED;
> }
>
> -QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
> +QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod) : HwDeviceInterface(pQxlDod)
> {
> m_pQxlDod = pQxlDod;
> m_ModeInfo = NULL;
> @@ -2955,6 +2956,7 @@ QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
> m_CustomMode = 0;
> m_FreeOutputs = 0;
> m_Pending = 0;
> + m_type = QXL_DEVICE;
> }
>
> QxlDevice::~QxlDevice(void)
> @@ -3181,7 +3183,7 @@ NTSTATUS QxlDevice::SetPowerState(_In_
> DEVICE_POWER_STATE DevicePowerState, DXGK
> NTSTATUS QxlDevice::HWInit(PCM_RESOURCE_LIST pResList,
> DXGK_DISPLAY_INFORMATION* pDispInfo)
> {
> DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
> - PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface();
> + PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterface();
> UINT pci_range = QXL_RAM_RANGE_INDEX;
> for (ULONG i = 0; i < pResList->Count; ++i)
> {
> @@ -3358,7 +3360,7 @@ void QxlDevice::QxlClose()
>
> void QxlDevice::UnmapMemory(void)
> {
> - PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterrface();
> + PDXGKRNL_INTERFACE pDxgkInterface = m_pQxlDod->GetDxgkInterface();
> if (m_IoMapped && m_IoBase)
> {
> pDxgkInterface->DxgkCbUnmapMemory( pDxgkInterface->DeviceHandle,
> &m_IoBase);
> diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
> index d3d9202..ab44259 100755
> --- a/qxldod/QxlDod.h
> +++ b/qxldod/QxlDod.h
> @@ -212,9 +212,16 @@ typedef struct _CURRENT_BDD_MODE
>
> class QxlDod;
>
> -class HwDeviceIntrface {
> -public:
> - virtual ~HwDeviceIntrface() {;}
> +typedef enum {
> + QXL_DEVICE,
> + VGA_DEVICE,
> + INVALID_DEVICE,
> +}WIN_QXL_DEVICE_TYPE;
> +
> +class HwDeviceInterface {
> +public:
> + HwDeviceInterface(_In_ QxlDod* pQxlDod) {m_type = INVALID_DEVICE;}
> + virtual ~HwDeviceInterface() {;}
> virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0;
> virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
> virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0;
> @@ -258,10 +265,11 @@ protected:
> USHORT m_CurrentMode;
> USHORT m_CustomMode;
> ULONG m_Id;
> + WIN_QXL_DEVICE_TYPE m_type;
> };
>
> class VgaDevice :
> - public HwDeviceIntrface
> + public HwDeviceInterface
> {
> public:
> VgaDevice(_In_ QxlDod* pQxlDod);
> @@ -434,7 +442,7 @@ typedef struct DpcCbContext {
> #define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
>
> class QxlDevice :
> - public HwDeviceIntrface
> + public HwDeviceInterface
> {
> public:
> QxlDevice(_In_ QxlDod* pQxlDod);
> @@ -591,9 +599,10 @@ private:
>
> D3DDDI_VIDEO_PRESENT_SOURCE_ID m_SystemDisplaySourceId;
> DXGKARG_SETPOINTERSHAPE m_PointerShape;
> - HwDeviceIntrface* m_pHWDevice;
> +
> + HwDeviceInterface* m_pHWDevice;
> DWORD m_VgaCompatible;
> - DWORD m_PointerCaps;
> + DWORD m_PointerCaps;
> public:
> QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject);
> ~QxlDod(void);
> @@ -686,7 +695,7 @@ public:
> _In_
> UINT
> SourceStride,
> _In_
> INT
> PositionX,
> _In_
> INT
> PositionY);
> - PDXGKRNL_INTERFACE GetDxgkInterrface(void) { return &m_DxgkInterface;}
> + PDXGKRNL_INTERFACE GetDxgkInterface(void) { return &m_DxgkInterface;}
> private:
> VOID CleanUp(VOID);
> NTSTATUS CheckHardware();
Frediano
More information about the Spice-devel
mailing list