/* $Id$ */
/** @file
* VBox WDDM Display backdoor logger implementation
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* We're unable to use standard r3 vbgl-based backdoor logging API because win8 Metro apps
* can not do CreateFile/Read/Write by default
* this is why we use miniport escape functionality to issue backdoor log string to the miniport
* and submit it to host via standard r0 backdoor logging api accordingly */
# include <windows.h>
# pragma warning(default : 4163)
# else
# include <windows.h>
# endif
#include "VBoxDispMpLogger.h"
#include <d3d9types.h>
#include <D3dumddi.h>
#include <d3dhal.h>
#include "../../common/wddm/VBoxMPIf.h"
#include "VBoxDispKmt.h"
#include <common/VBoxVideoLog.h>
#include <stdio.h>
typedef enum
{
typedef struct VBOXDISPMPLOGGER
{
{
if (ASMAtomicCmpXchgU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState, VBOXDISPMPLOGGER_STATE_INITIALIZING, VBOXDISPMPLOGGER_STATE_UNINITIALIZED))
{
{
/* we are on Vista+
* check if we can Open Adapter, i.e. WDDM driver is installed */
{
ASMAtomicWriteU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState, VBOXDISPMPLOGGER_STATE_INITIALIZED);
return &g_VBoxDispMpLogger;
}
}
}
else if (ASMAtomicReadU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState) == VBOXDISPMPLOGGER_STATE_INITIALIZED)
{
return &g_VBoxDispMpLogger;
}
return NULL;
}
{
if (!pLogger)
return VERR_NOT_SUPPORTED;
return VINF_SUCCESS;
}
{
if (ASMAtomicCmpXchgU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState, VBOXDISPMPLOGGER_STATE_UNINITIALIZING, VBOXDISPMPLOGGER_STATE_INITIALIZED))
{
ASMAtomicWriteU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState, VBOXDISPMPLOGGER_STATE_UNINITIALIZED);
return S_OK;
}
else if (ASMAtomicReadU32((volatile uint32_t *)&g_VBoxDispMpLogger.enmState) == VBOXDISPMPLOGGER_STATE_UNINITIALIZED)
{
return S_OK;
}
return VERR_NOT_SUPPORTED;
}
{
if (!pLogger)
return;
{
if (pCmd)
{
//EscapeData.hDevice = NULL;
// EscapeData.Flags.HardwareAccess = 1;
//EscapeData.hContext = NULL;
if (Status)
{
BP_WARN();
}
}
else
{
BP_WARN();
}
{
BP_WARN();
}
}
}
{
if (!pLogger)
return;
}
static void vboxDispMpLoggerDumpBuf(void *pvBuf, uint32_t cbBuf, VBOXDISPIFESCAPE_DBGDUMPBUF_TYPE enmBuf)
{
if (!pLogger)
return;
{
if (pCmd)
{
#ifdef VBOX_WDDM_WOW64
#endif
//EscapeData.hDevice = NULL;
// EscapeData.Flags.HardwareAccess = 1;
//EscapeData.hContext = NULL;
if (Status)
{
BP_WARN();
}
}
else
{
BP_WARN();
}
{
BP_WARN();
}
}
}
{
}