[Spice-devel] [PATCH qxl-wddm-dod 2/8] Mark all functions that should go to non paged sections
Frediano Ziglio
fziglio at redhat.com
Wed Sep 28 13:55:41 UTC 2016
This make sure that these function goes into the non
paged section.
Also this change is much shorter than marking code if
can be paged as almost code can be paged.
It's also coherent with other source files.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
qxldod/QxlDod.cpp | 39 ++++++++++++++++++++++++---------------
qxldod/QxlDod.h | 50 ++++++++++++++++++++++++++------------------------
2 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index d7830e5..b890a9a 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -2,8 +2,7 @@
#include "qxldod.h"
#include "qxl_windows.h"
-#pragma code_seg(push)
-#pragma code_seg()
+#pragma code_seg("PAGE")
#define WIN_QXL_INT_MASK ((QXL_INTERRUPT_DISPLAY) | \
(QXL_INTERRUPT_CURSOR) | \
@@ -47,8 +46,6 @@ BYTE PixelMask[BITS_PER_BYTE] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
((ULONG)LOWER_5_BITS((Pixel)) << SHIFT_LOWER_5_IN_565_BACK))
-#pragma code_seg(pop)
-
struct QXLEscape {
uint32_t ioctl;
union {
@@ -1645,9 +1642,7 @@ NTSTATUS QxlDod::UpdateActiveVidPnPresentPath(_In_ CONST DXGKARG_UPDATEACTIVEVID
//
// Non-Paged Code
//
-#pragma code_seg(push)
-#pragma code_seg()
-
+QXL_NON_PAGED
VOID QxlDod::DpcRoutine(VOID)
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
@@ -1656,6 +1651,7 @@ VOID QxlDod::DpcRoutine(VOID)
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
}
+QXL_NON_PAGED
BOOLEAN QxlDod::InterruptRoutine(_In_ ULONG MessageNumber)
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> 0 %s\n", __FUNCTION__));
@@ -1665,6 +1661,7 @@ BOOLEAN QxlDod::InterruptRoutine(_In_ ULONG MessageNumber)
return FALSE;
}
+QXL_NON_PAGED
VOID QxlDod::ResetDevice(VOID)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("<---> %s\n", __FUNCTION__));
@@ -1672,6 +1669,7 @@ VOID QxlDod::ResetDevice(VOID)
}
// Must be Non-Paged, as it sets up the display for a bugcheck
+QXL_NON_PAGED
NTSTATUS QxlDod::SystemDisplayEnable(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
_In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS Flags,
_Out_ UINT* pWidth,
@@ -1728,6 +1726,7 @@ NTSTATUS QxlDod::SystemDisplayEnable(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID Target
}
// Must be Non-Paged, as it is called to display the bugcheck screen
+QXL_NON_PAGED
VOID QxlDod::SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VOID* pSource,
_In_ UINT SourceWidth,
_In_ UINT SourceHeight,
@@ -1774,7 +1773,7 @@ VOID QxlDod::SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VO
}
-#pragma code_seg(pop) // End Non-Paged Code
+// End Non-Paged Code
NTSTATUS QxlDod::WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR pszwValueName, _In_ PCSTR pszValue)
{
@@ -1949,11 +1948,7 @@ NTSTATUS QxlDod::ReadConfiguration()
return Status;
}
-//
-// Non-Paged Code
-//
-#pragma code_seg(push)
-#pragma code_seg()
+QXL_NON_PAGED
D3DDDI_VIDEO_PRESENT_SOURCE_ID QxlDod::FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero)
{
UNREFERENCED_PARAMETER(TargetId);
@@ -1968,8 +1963,6 @@ D3DDDI_VIDEO_PRESENT_SOURCE_ID QxlDod::FindSourceForTarget(D3DDDI_VIDEO_PRESENT_
return DefaultToZero ? 0 : D3DDDI_ID_UNINITIALIZED;
}
-#pragma code_seg(pop) // End Non-Paged Code
-
//
// Frame buffer map/unmap
//
@@ -2049,6 +2042,7 @@ UnmapFrameBuffer(
// HW specific code
+QXL_NON_PAGED
VOID GetPitches(_In_ CONST BLT_INFO* pBltInfo, _Out_ LONG* pPixelPitch, _Out_ LONG* pRowPitch)
{
switch (pBltInfo->Rotation)
@@ -2087,6 +2081,7 @@ VOID GetPitches(_In_ CONST BLT_INFO* pBltInfo, _Out_ LONG* pPixelPitch, _Out_ LO
}
}
+QXL_NON_PAGED
BYTE* GetRowStart(_In_ CONST BLT_INFO* pBltInfo, CONST RECT* pRect)
{
BYTE* pRet = NULL;
@@ -2150,6 +2145,7 @@ BYTE* GetRowStart(_In_ CONST BLT_INFO* pBltInfo, CONST RECT* pRect)
*
\**************************************************************************/
+QXL_NON_PAGED
VOID CopyBitsGeneric(
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
@@ -2244,6 +2240,7 @@ VOID CopyBitsGeneric(
}
+QXL_NON_PAGED
VOID CopyBits32_32(
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
@@ -2285,6 +2282,7 @@ VOID CopyBits32_32(
}
+QXL_NON_PAGED
VOID BltBits (
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
@@ -2913,6 +2911,7 @@ VOID VgaDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
pCurrentBddMod->ZeroedOutEnd.QuadPart = NewPhysAddrEnd.QuadPart;
}
+QXL_NON_PAGED
BOOLEAN VgaDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber)
{
UNREFERENCED_PARAMETER(pDxgkInterface);
@@ -2920,10 +2919,12 @@ BOOLEAN VgaDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_
return FALSE;
}
+QXL_NON_PAGED
VOID VgaDevice::DpcRoutine(PVOID)
{
}
+QXL_NON_PAGED
VOID VgaDevice::ResetDevice(VOID)
{
}
@@ -3652,6 +3653,7 @@ void QxlDevice::InitMspace(UINT32 mspace_type, UINT8 *start, size_t capacity)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s _mspace = %p\n", __FUNCTION__, m_MSInfo[mspace_type]._mspace));
}
+QXL_NON_PAGED
void QxlDevice::ResetDevice(void)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
@@ -4717,6 +4719,7 @@ VOID QxlDevice::PushCursor(VOID)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s notify = %d\n", __FUNCTION__, notify));
}
+QXL_NON_PAGED
BOOLEAN QxlDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber)
{
UNREFERENCED_PARAMETER(MessageNumber);
@@ -4737,6 +4740,7 @@ BOOLEAN QxlDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_
return TRUE;
}
+QXL_NON_PAGED
VOID QxlDevice::DpcRoutine(PVOID ptr)
{
PDXGKRNL_INTERFACE pDxgkInterface = (PDXGKRNL_INTERFACE)ptr;
@@ -4773,6 +4777,7 @@ VOID QxlDevice::DpcRoutine(PVOID ptr)
VOID QxlDevice::UpdateArea(CONST RECT* area, UINT32 surface_id)
{
+ PAGED_CODE();
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
CopyRect(&m_RamHdr->update_area, area);
m_RamHdr->update_surface = surface_id;
@@ -4781,6 +4786,7 @@ VOID QxlDevice::UpdateArea(CONST RECT* area, UINT32 surface_id)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
}
+QXL_NON_PAGED
BOOLEAN QxlDevice:: DpcCallbackEx(PVOID ptr)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--> %s\n", __FUNCTION__));
@@ -4790,6 +4796,7 @@ BOOLEAN QxlDevice:: DpcCallbackEx(PVOID ptr)
return TRUE;
}
+QXL_NON_PAGED
VOID QxlDevice::DpcCallback(PDPC_CB_CONTEXT ctx)
{
ctx->data = m_Pending;
@@ -4797,6 +4804,7 @@ VOID QxlDevice::DpcCallback(PDPC_CB_CONTEXT ctx)
}
+QXL_NON_PAGED
UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
{
switch (Format)
@@ -4812,6 +4820,7 @@ UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
}
// Given bits per pixel, return the pixel format at the same bpp
+QXL_NON_PAGED
D3DDDIFORMAT PixelFormatFromBPP(UINT BPP)
{
switch (BPP)
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index bf16724..90d7937 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -14,6 +14,8 @@
#define QXL_BPP 32
#define VGA_BPP 24
+#define QXL_NON_PAGED __declspec(code_seg(".text"))
+
typedef struct _QXL_FLAGS
{
UINT DriverStarted : 1; // ( 1) 1 after StartDevice and 0 after StopDevice
@@ -222,9 +224,9 @@ public:
virtual NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState, DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
virtual NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
virtual NTSTATUS HWClose(void) = 0;
- virtual BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber) = 0;
- virtual VOID DpcRoutine(PVOID) = 0;
- virtual VOID ResetDevice(void) = 0;
+ QXL_NON_PAGED virtual BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber) = 0;
+ QXL_NON_PAGED virtual VOID DpcRoutine(PVOID) = 0;
+ QXL_NON_PAGED virtual VOID ResetDevice(void) = 0;
virtual NTSTATUS AcquireFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode) { return STATUS_SUCCESS; }
virtual NTSTATUS ReleaseFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode) { return STATUS_SUCCESS; }
@@ -289,9 +291,9 @@ public:
_In_ D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation,
_In_ const CURRENT_BDD_MODE* pModeCur);
VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
- BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
- VOID DpcRoutine(PVOID);
- VOID ResetDevice(VOID);
+ QXL_NON_PAGED BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
+ QXL_NON_PAGED VOID DpcRoutine(PVOID);
+ QXL_NON_PAGED VOID ResetDevice(VOID);
NTSTATUS AcquireFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode);
NTSTATUS ReleaseFrameBuffer(CURRENT_BDD_MODE* pCurrentBddMode);
NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape);
@@ -464,9 +466,9 @@ public:
_In_ D3DKMDT_VIDPN_PRESENT_PATH_ROTATION Rotation,
_In_ const CURRENT_BDD_MODE* pModeCur);
VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
- BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
- VOID DpcRoutine(PVOID);
- VOID ResetDevice(VOID);
+ QXL_NON_PAGED BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
+ QXL_NON_PAGED VOID DpcRoutine(PVOID);
+ QXL_NON_PAGED VOID ResetDevice(VOID);
NTSTATUS SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape);
NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition);
NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscap);
@@ -534,8 +536,8 @@ private:
void PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
UINT8 **end_ptr, UINT8 *src, int size,
size_t alloc_size, uint32_t alignment);
- BOOLEAN static DpcCallbackEx(PVOID);
- void DpcCallback(PDPC_CB_CONTEXT);
+ QXL_NON_PAGED BOOLEAN static DpcCallbackEx(PVOID);
+ QXL_NON_PAGED void DpcCallback(PDPC_CB_CONTEXT);
void AsyncIo(UCHAR Port, UCHAR Value);
void SyncIo(UCHAR Port, UCHAR Value);
NTSTATUS UpdateChildStatus(BOOLEAN connect);
@@ -628,7 +630,7 @@ public:
_Out_ ULONG* pNumberOfChildren);
NTSTATUS StopDevice(VOID);
// Must be Non-Paged
- VOID ResetDevice(VOID);
+ QXL_NON_PAGED VOID ResetDevice(VOID);
NTSTATUS DispatchIoRequest(_In_ ULONG VidPnSourceId,
_In_ VIDEO_REQUEST_PACKET* pVideoRequestPacket);
@@ -648,9 +650,9 @@ public:
// Must be Non-Paged
// BDD doesn't have interrupts, so just returns false
- BOOLEAN InterruptRoutine(_In_ ULONG MessageNumber);
+ QXL_NON_PAGED BOOLEAN InterruptRoutine(_In_ ULONG MessageNumber);
- VOID DpcRoutine(VOID);
+ QXL_NON_PAGED VOID DpcRoutine(VOID);
// Return DriverCaps, doesn't support other queries though
NTSTATUS QueryAdapterInfo(_In_ CONST DXGKARG_QUERYADAPTERINFO* pQueryAdapterInfo);
@@ -689,7 +691,7 @@ public:
// Must be Non-Paged
// Call to initialize as part of bugcheck
- NTSTATUS SystemDisplayEnable(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
+ QXL_NON_PAGED NTSTATUS SystemDisplayEnable(_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId,
_In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS Flags,
_Out_ UINT* pWidth,
_Out_ UINT* pHeight,
@@ -697,7 +699,7 @@ public:
// Must be Non-Paged
// Write out pixels as part of bugcheck
- VOID SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VOID* pSource,
+ QXL_NON_PAGED VOID SystemDisplayWrite(_In_reads_bytes_(SourceHeight * SourceStride) VOID* pSource,
_In_ UINT SourceWidth,
_In_ UINT SourceHeight,
_In_ UINT SourceStride,
@@ -725,7 +727,7 @@ private:
D3DKMDT_HVIDPNTARGETMODESET hVidPnTargetModeSet,
_In_opt_ CONST D3DKMDT_VIDPN_SOURCE_MODE* pVidPnPinnedSourceModeInfo,
D3DDDI_VIDEO_PRESENT_SOURCE_ID SourceId);
- D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero);
+ QXL_NON_PAGED D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero);
NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const;
NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const;
NTSTATUS RegisterHWInfo(_In_ ULONG Id);
@@ -743,26 +745,26 @@ UnmapFrameBuffer(
_In_reads_bytes_(Length) VOID* VirtualAddress,
_In_ ULONG Length);
-UINT BPPFromPixelFormat(D3DDDIFORMAT Format);
-D3DDDIFORMAT PixelFormatFromBPP(UINT BPP);
+QXL_NON_PAGED UINT BPPFromPixelFormat(D3DDDIFORMAT Format);
+QXL_NON_PAGED D3DDDIFORMAT PixelFormatFromBPP(UINT BPP);
UINT SpiceFromPixelFormat(D3DDDIFORMAT Format);
-VOID CopyBitsGeneric(
+QXL_NON_PAGED VOID CopyBitsGeneric(
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
UINT NumRects,
_In_reads_(NumRects) CONST RECT *pRects);
-VOID CopyBits32_32(
+QXL_NON_PAGED VOID CopyBits32_32(
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
UINT NumRects,
_In_reads_(NumRects) CONST RECT *pRects);
-VOID BltBits (
+QXL_NON_PAGED VOID BltBits (
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
UINT NumRects,
_In_reads_(NumRects) CONST RECT *pRects);
-BYTE* GetRowStart(_In_ CONST BLT_INFO* pBltInfo, CONST RECT* pRect);
-VOID GetPitches(_In_ CONST BLT_INFO* pBltInfo, _Out_ LONG* pPixelPitch, _Out_ LONG* pRowPitch);
+QXL_NON_PAGED BYTE* GetRowStart(_In_ CONST BLT_INFO* pBltInfo, CONST RECT* pRect);
+QXL_NON_PAGED VOID GetPitches(_In_ CONST BLT_INFO* pBltInfo, _Out_ LONG* pPixelPitch, _Out_ LONG* pRowPitch);
--
2.7.4
More information about the Spice-devel
mailing list