fix dpc routine

This commit is contained in:
Vadim Rozenfeld 2014-06-11 22:14:20 +10:00
parent 054d00dbd7
commit e04e2d683e
2 changed files with 53 additions and 14 deletions

View File

@ -1640,7 +1640,7 @@ NTSTATUS QxlDod::UpdateActiveVidPnPresentPath(_In_ CONST DXGKARG_UPDATEACTIVEVID
VOID QxlDod::DpcRoutine(VOID)
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s\n", __FUNCTION__));
m_pHWDevice->DpcRoutine();
m_pHWDevice->DpcRoutine(&m_DxgkInterface);
m_DxgkInterface.DxgkCbNotifyDpc((HANDLE)m_DxgkInterface.DeviceHandle);
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s\n", __FUNCTION__));
}
@ -2816,7 +2816,7 @@ BOOLEAN VgaDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_
return FALSE;
}
VOID VgaDevice::DpcRoutine(VOID)
VOID VgaDevice::DpcRoutine(PVOID)
{
}
@ -4085,24 +4085,41 @@ BOOLEAN QxlDevice::InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_
if (!pDxgkInterface->DxgkCbQueueDpc(pDxgkInterface->DeviceHandle)) {
m_RamHdr->int_mask = QXL_INTERRUPT_MASK;
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0);
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s DxgkCbQueueDpc failed\n", __FUNCTION__));
}
return TRUE;
}
VOID QxlDevice::DpcRoutine(VOID)
VOID QxlDevice::DpcRoutine(PVOID ptr)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
m_RamHdr->int_mask = QXL_INTERRUPT_MASK;
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0);
if (m_Pending & QXL_INTERRUPT_DISPLAY) {
PDXGKRNL_INTERFACE pDxgkInterface = (PDXGKRNL_INTERFACE)ptr;
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s\n", __FUNCTION__));
DPC_CB_CONTEXT ctx;
BOOLEAN dummy;
ctx.ptr = this;
NTSTATUS Status = pDxgkInterface->DxgkCbSynchronizeExecution(
pDxgkInterface->DeviceHandle,
DpcCallbackEx,
&ctx,
0,
&dummy);
ASSERT(Status == STATUS_SUCCESS);
if (ctx.data & QXL_INTERRUPT_DISPLAY) {
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s m_DisplayEvent\n", __FUNCTION__));
KeSetEvent (&m_DisplayEvent, IO_NO_INCREMENT, FALSE);
}
if (m_Pending & QXL_INTERRUPT_CURSOR) {
if (ctx.data & QXL_INTERRUPT_CURSOR) {
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s m_CursorEvent\n", __FUNCTION__));
KeSetEvent (&m_CursorEvent, IO_NO_INCREMENT, FALSE);
}
if (m_Pending & QXL_INTERRUPT_IO_CMD) {
if (ctx.data & QXL_INTERRUPT_IO_CMD) {
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s m_IoCmdEvent\n", __FUNCTION__));
KeSetEvent (&m_IoCmdEvent, IO_NO_INCREMENT, FALSE);
}
m_RamHdr->int_mask = QXL_INTERRUPT_MASK;
WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_UPDATE_IRQ), 0);
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
}
@ -4116,6 +4133,21 @@ VOID QxlDevice::UpdateArea(RECTL *area, UINT32 surface_id)
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
}
BOOLEAN QxlDevice:: DpcCallbackEx(PVOID ptr)
{
DbgPrint(TRACE_LEVEL_VERBOSE, ("<--> %s\n", __FUNCTION__));
PDPC_CB_CONTEXT ctx = (PDPC_CB_CONTEXT) ptr;
QxlDevice* pqxl = (QxlDevice*)ctx->ptr;
pqxl->DpcCallback(ctx);
return TRUE;
}
VOID QxlDevice::DpcCallback(PDPC_CB_CONTEXT ctx)
{
ctx->data = m_Pending;
m_Pending = 0;
}
UINT BPPFromPixelFormat(D3DDDIFORMAT Format)
{

View File

@ -211,8 +211,6 @@ class HwDeviceIntrface :
public BaseObject
{
public:
// HwDeviceIntrface(_In_ QxlDod* pQxlDod) {m_pQxlDod = pQxlDod;}
// virtual ~HwDeviceIntrface(void);
virtual NTSTATUS QueryCurrentMode(PVIDEO_MODE RequestedMode) = 0;
virtual NTSTATUS SetCurrentMode(ULONG Mode) = 0;
virtual NTSTATUS GetCurrentMode(ULONG* Mode) = 0;
@ -220,7 +218,7 @@ public:
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(VOID) = 0;
virtual VOID DpcRoutine(PVOID) = 0;
virtual VOID ResetDevice(void) = 0;
ULONG GetModeCount(void) {return m_ModeCount;}
@ -276,7 +274,7 @@ public:
_In_ const CURRENT_BDD_MODE* pModeCur);
VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
VOID DpcRoutine(VOID);
VOID DpcRoutine(PVOID);
VOID ResetDevice(VOID);
protected:
NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo);
@ -397,6 +395,13 @@ typedef struct InternalImage {
QXLImage image;
} InternalImage;
typedef struct DpcCbContext {
void* ptr;
UINT32 data;
} DPC_CB_CONTEXT,* PDPC_CB_CONTEXT;
#define BITMAP_ALLOC_BASE (sizeof(Resource) + sizeof(InternalImage) + sizeof(QXLDataChunk))
#define BITS_BUF_MAX (64 * 1024)
#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
@ -426,7 +431,7 @@ public:
_In_ const CURRENT_BDD_MODE* pModeCur);
VOID BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod);
BOOLEAN InterruptRoutine(_In_ PDXGKRNL_INTERFACE pDxgkInterface, _In_ ULONG MessageNumber);
VOID DpcRoutine(VOID);
VOID DpcRoutine(PVOID);
VOID ResetDevice(VOID);
protected:
NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo);
@ -479,6 +484,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);
private:
PUCHAR m_IoBase;