summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-11-07 17:34:36 +0100
committerAlon Levy <alevy@redhat.com>2012-11-07 17:34:36 +0100
commit4ead6cf34bbfb35f62d65a368056a210fe5736cb (patch)
tree5cbd8d47dfd77d42ef336e3dc734a280cd3afc61
parent29ca17762ef5c8a81b2dc0745f476465448e0527 (diff)
wddm/um/qxlum.c: OpenAdapter10, try CreateFile/WriteFile (failed), try calling pfnQueryAdapterInfoCb - mingw example fails during dwmapi.dll loadwddm
-rw-r--r--wddm/umd/qxlum.c66
-rw-r--r--wddm/umd/qxlum.def2
-rw-r--r--wddm/umd/sources1
3 files changed, 68 insertions, 1 deletions
diff --git a/wddm/umd/qxlum.c b/wddm/umd/qxlum.c
index 9e09f37..992e54e 100644
--- a/wddm/umd/qxlum.c
+++ b/wddm/umd/qxlum.c
@@ -1,11 +1,77 @@
+#include <stdio.h>
+
+#include <winerror.h>
+#include <windows.h>
#include <windef.h>
+#include <crtdbg.h>
+
+/* TODO: fix this
+ * Copy NTSTATUS & PHYSICAL_ADDRESS typedefs from ntdef.h over here because it
+ * conflicts with winnt.h which is required by windows.h (not directly) */
+typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
+typedef LONG NTSTATUS;
+
#include <d3dtypes.h>
+#ifdef DEFINE_OPENADAPTER
#include <d3dumddi.h>
+#endif
+#include <d3d10umddi.h>
+
+static void log_file_v(const char *format, va_list ap)
+{
+ static HANDLE h;
+ char buf[2048];
+ DWORD bytes_written;
+ int n;
+
+ if (h == 0) {
+ h = CreateFile("c:\\qxlum.log", FILE_WRITE_DATA | FILE_APPEND_DATA, 0, NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE) {
+ return; // TODO - log this..
+ }
+ SetFilePointer(h, 0, NULL, FILE_END);
+ }
+ if (h == INVALID_HANDLE_VALUE) {
+ return; // TODO - log this..
+ }
+ n = _vsnprintf_s(buf, sizeof(buf), _TRUNCATE, format, ap);
+ WriteFile(h, buf, n, &bytes_written, NULL);
+}
+
+static void log_file(const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ log_file_v(format, ap);
+ va_end(ap);
+}
+
+// TODO: mingw ifdef to __func__
+#define QXL_FUNCTION __FUNCTION__
+
+// Required for Directx 9 - not sure if we can forgoe this, let's try
+#ifdef DEFINE_OPENADAPTER
__declspec(dllexport) HRESULT OpenAdapter(
D3DDDIARG_OPENADAPTER *pOpenData
)
{
+ log_file("%s: TODO\n", QXL_FUNCTION);
// return S_OK;
return E_OUTOFMEMORY;
}
+#endif
+
+__declspec(dllexport) HRESULT OpenAdapter10(
+ D3D10DDIARG_OPENADAPTER *pOpenData
+ )
+{
+ const D3DDDI_ADAPTERCALLBACKS *adapter_callbacks = pOpenData->pAdapterCallbacks;
+ void *adapter = pOpenData->hRTAdapter.handle;
+ D3DDDICB_QUERYADAPTERINFO info;
+
+ log_file("%s: TODO\n", QXL_FUNCTION);
+ adapter_callbacks->pfnQueryAdapterInfoCb(adapter, &info);
+ return S_OK;
+}
diff --git a/wddm/umd/qxlum.def b/wddm/umd/qxlum.def
index ccf9f95..58c2b6d 100644
--- a/wddm/umd/qxlum.def
+++ b/wddm/umd/qxlum.def
@@ -1,2 +1,2 @@
EXPORTS
- OpenAdapter
+ OpenAdapter10
diff --git a/wddm/umd/sources b/wddm/umd/sources
index 4d9d392..96525e2 100644
--- a/wddm/umd/sources
+++ b/wddm/umd/sources
@@ -1,6 +1,7 @@
TARGETNAME=qxlum
TARGETTYPE=DYNLINK
SOURCES=qxlum.c
+USE_MSVCRT=1
TARGETLIBS= \
$(DDK_LIB_PATH)\kernel32.lib