summaryrefslogtreecommitdiff
path: root/xddm/include
diff options
context:
space:
mode:
Diffstat (limited to 'xddm/include')
-rw-r--r--xddm/include/murmur_hash2a.h152
-rw-r--r--xddm/include/os_dep.h41
-rw-r--r--xddm/include/qxl_driver.h127
-rw-r--r--xddm/include/stdint.h397
-rw-r--r--xddm/include/wdmhelper.h38
5 files changed, 755 insertions, 0 deletions
diff --git a/xddm/include/murmur_hash2a.h b/xddm/include/murmur_hash2a.h
new file mode 100644
index 0000000..51da7db
--- /dev/null
+++ b/xddm/include/murmur_hash2a.h
@@ -0,0 +1,152 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This software is licensed under the GNU General Public License,
+ version 2 (GPLv2) (see COPYING for details), subject to the
+ following clarification.
+
+ With respect to binaries built using the Microsoft(R) Windows
+ Driver Kit (WDK), GPLv2 does not extend to any code contained in or
+ derived from the WDK ("WDK Code"). As to WDK Code, by using or
+ distributing such binaries you agree to be bound by the Microsoft
+ Software License Terms for the WDK. All WDK Code is considered by
+ the GPLv2 licensors to qualify for the special exception stated in
+ section 3 of GPLv2 (commonly known as the system library
+ exception).
+
+ There is NO WARRANTY for this software, express or implied,
+ including the implied warranties of NON-INFRINGEMENT, TITLE,
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+//Some modifications by Red Hat any bug is probably our fault
+
+//-----------------------------------------------------------------------------
+// MurmurHash2A, by Austin Appleby
+
+// This is a variant of MurmurHash2 modified to use the Merkle-Damgard
+// construction. Bulk speed should be identical to Murmur2, small-key speed
+// will be 10%-20% slower due to the added overhead at the end of the hash.
+
+// This variant fixes a minor issue where null keys were more likely to
+// collide with each other than expected, and also makes the algorithm
+// more amenable to incremental implementations. All other caveats from
+// MurmurHash2 still apply.
+
+#ifndef __MURMUR_HASH2A_H
+#define __MURMUR_HASH2A_H
+
+#include <windef.h>
+#include "os_dep.h"
+
+typedef UINT32 uint32_t;
+typedef UINT16 uint16_t;
+typedef UINT8 uint8_t;
+
+#define mmix(h,k) { k *= m; k ^= k >> r; k *= m; h *= m; h ^= k; }
+
+_inline uint32_t MurmurHash2A(const void * key, uint32_t len, uint32_t seed )
+{
+ const uint32_t m = 0x5bd1e995;
+ const uint32_t r = 24;
+ uint32_t l = len;
+ uint32_t t = 0;
+
+ const uint8_t * data = (const uint8_t *)key;
+
+ uint32_t h = seed;
+
+ while (len >= 4) {
+ uint32_t k = *(uint32_t*)data;
+
+ mmix(h,k);
+
+ data += 4;
+ len -= 4;
+ }
+
+ switch (len) {
+ case 3: t ^= data[2] << 16;
+ case 2: t ^= data[1] << 8;
+ case 1: t ^= data[0];
+ };
+
+ mmix(h,t);
+ mmix(h,l);
+
+ h ^= h >> 13;
+ h *= m;
+ h ^= h >> 15;
+
+ return h;
+}
+
+_inline uint32_t MurmurHash2AJump3(const uint32_t * key, uint32_t len, uint32_t seed )
+{
+ uint32_t m = 0x5bd1e995;
+ uint32_t r = 24;
+ uint32_t l = len << 2;
+
+ const uint8_t * data = (const uint8_t *)key;
+
+ uint32_t h = seed;
+
+ while (len >= 4) {
+ uint32_t k = *(uint32_t*)data;
+ uint32_t tmp;
+
+ data += 4;
+ tmp = *(uint32_t *)data;
+ k = k << 8;
+ k |= (uint8_t)tmp;
+ mmix(h,k);
+
+ k = tmp << 8;
+ k = k & 0xffff0000;
+ data += 4;
+ tmp = *(uint32_t *)data;
+ k |= (uint16_t)(tmp >> 8);
+ mmix(h,k);
+
+ data += 4;
+ k = *(uint32_t *)data;
+ k = k << 8;
+ k |= (uint8_t)tmp;
+ mmix(h,k);
+
+ data += 4;
+ len -= 4;
+ }
+
+ while (len >= 1) {
+ uint32_t k = *(uint32_t*)data;
+
+ k = k << 8;
+ mmix(h,k);
+
+ data += 4;
+ len--;
+ }
+
+ h *= m;
+ mmix(h,l);
+
+ h ^= h >> 13;
+ h *= m;
+ h ^= h >> 15;
+
+ return h;
+}
+
+
+_inline uint32_t murmurhash2a(const void *key, size_t length, uint32_t initval)
+{
+ return MurmurHash2A(key, length, initval);
+}
+
+_inline uint32_t murmurhash2ajump3(const uint32_t *key, size_t length, uint32_t initval)
+{
+ return MurmurHash2AJump3(key, length, initval);
+}
+#endif
+
diff --git a/xddm/include/os_dep.h b/xddm/include/os_dep.h
new file mode 100644
index 0000000..ad229e2
--- /dev/null
+++ b/xddm/include/os_dep.h
@@ -0,0 +1,41 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This software is licensed under the GNU General Public License,
+ version 2 (GPLv2) (see COPYING for details), subject to the
+ following clarification.
+
+ With respect to binaries built using the Microsoft(R) Windows
+ Driver Kit (WDK), GPLv2 does not extend to any code contained in or
+ derived from the WDK ("WDK Code"). As to WDK Code, by using or
+ distributing such binaries you agree to be bound by the Microsoft
+ Software License Terms for the WDK. All WDK Code is considered by
+ the GPLv2 licensors to qualify for the special exception stated in
+ section 3 of GPLv2 (commonly known as the system library
+ exception).
+
+ There is NO WARRANTY for this software, express or implied,
+ including the implied warranties of NON-INFRINGEMENT, TITLE,
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#ifndef OS_DEP_H
+#define OS_DEP_H
+
+#if (WINVER < 0x0501) //Definitions for Win2K
+typedef signed char INT8, *PINT8;
+typedef signed short INT16, *PINT16;
+typedef signed int INT32, *PINT32;
+typedef signed __int64 INT64, *PINT64;
+typedef unsigned char UINT8, *PUINT8;
+typedef unsigned short UINT16, *PUINT16;
+typedef unsigned int UINT32, *PUINT32;
+typedef unsigned __int64 UINT64, *PUINT64;
+
+#define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA 0x50
+
+#define VideoPortFreePool VideoPortReleaseBuffer
+
+#endif
+
+#endif
diff --git a/xddm/include/qxl_driver.h b/xddm/include/qxl_driver.h
new file mode 100644
index 0000000..677ee17
--- /dev/null
+++ b/xddm/include/qxl_driver.h
@@ -0,0 +1,127 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This software is licensed under the GNU General Public License,
+ version 2 (GPLv2) (see COPYING for details), subject to the
+ following clarification.
+
+ With respect to binaries built using the Microsoft(R) Windows
+ Driver Kit (WDK), GPLv2 does not extend to any code contained in or
+ derived from the WDK ("WDK Code"). As to WDK Code, by using or
+ distributing such binaries you agree to be bound by the Microsoft
+ Software License Terms for the WDK. All WDK Code is considered by
+ the GPLv2 licensors to qualify for the special exception stated in
+ section 3 of GPLv2 (commonly known as the system library
+ exception).
+
+ There is NO WARRANTY for this software, express or implied,
+ including the implied warranties of NON-INFRINGEMENT, TITLE,
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#ifndef _H_QXL_DRIVER
+#define _H_QXL_DRIVER
+
+#include <spice\qxl_dev.h>
+#include <spice\qxl_windows.h>
+
+#if (WINVER < 0x0501)
+#include "wdmhelper.h"
+#endif
+
+enum {
+ FIRST_AVIL_IOCTL_FUNC = 0x800,
+ QXL_GET_INFO_FUNC = FIRST_AVIL_IOCTL_FUNC,
+ QXL_SET_CUSTOM_DISPLAY
+};
+
+#define IOCTL_QXL_GET_INFO \
+ CTL_CODE(FILE_DEVICE_VIDEO, QXL_GET_INFO_FUNC, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define IOCTL_QXL_SET_CUSTOM_DISPLAY \
+ CTL_CODE(FILE_DEVICE_VIDEO, QXL_SET_CUSTOM_DISPLAY, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define QXL_DRIVER_INFO_VERSION 3
+
+typedef struct MemSlot {
+ UINT8 generation;
+ UINT64 start_phys_addr;
+ UINT64 end_phys_addr;
+ UINT64 start_virt_addr;
+ UINT64 end_virt_addr;
+} MemSlot;
+
+typedef struct QXLDriverInfo {
+ UINT32 version;
+ QXLCommandRing *cmd_ring;
+ QXLCursorRing *cursor_ring;
+ QXLReleaseRing *release_ring;
+ PUCHAR notify_cmd_port;
+ PUCHAR notify_cursor_port;
+ PUCHAR notify_oom_port;
+ PUCHAR update_area_async_port;
+ PUCHAR memslot_add_async_port;
+ PUCHAR create_primary_async_port;
+ PUCHAR destroy_primary_async_port;
+ PUCHAR destroy_surface_async_port;
+ PUCHAR destroy_all_surfaces_async_port;
+ PUCHAR flush_surfaces_async_port;
+ PUCHAR flush_release_port;
+ PEVENT display_event;
+ PEVENT cursor_event;
+ PEVENT sleep_event;
+ PEVENT io_cmd_event;
+
+ UINT32 num_pages;
+ void *io_pages_virt;
+ UINT64 io_pages_phys;
+
+ UINT8 *surface0_area;
+ UINT32 surface0_area_size;
+
+ UINT32 *update_id;
+ UINT32 *compression_level;
+
+ PUCHAR update_area_port;
+ QXLRect *update_area;
+ UINT32 *update_surface;
+
+ UINT32 *mm_clock;
+
+ PUCHAR log_port;
+ UINT8 *log_buf;
+ UINT32 *log_level;
+#if (WINVER < 0x0501)
+ PQXLWaitForEvent WaitForEvent;
+#endif
+ UINT8 num_mem_slot;
+ UINT8 main_mem_slot_id;
+ UINT8 slot_id_bits;
+ UINT8 slot_gen_bits;
+ UINT8 *slots_generation;
+ UINT64 *ram_slot_start;
+ UINT64 *ram_slot_end;
+ MemSlot main_mem_slot;
+
+ PUCHAR destroy_surface_wait_port;
+ PUCHAR create_primary_port;
+ PUCHAR destroy_primary_port;
+ PUCHAR memslot_add_port;
+ PUCHAR memslot_del_port;
+ PUCHAR destroy_all_surfaces_port;
+
+ UCHAR pci_revision;
+
+ UINT32 dev_id;
+
+ QXLSurfaceCreate *primary_surface_create;
+
+ UINT32 n_surfaces;
+
+ UINT64 fb_phys;
+
+ UINT8 create_non_primary_surfaces;
+} QXLDriverInfo;
+
+#endif
+
diff --git a/xddm/include/stdint.h b/xddm/include/stdint.h
new file mode 100644
index 0000000..f825d4b
--- /dev/null
+++ b/xddm/include/stdint.h
@@ -0,0 +1,397 @@
+/* ISO C9x 7.18 Integer types <stdint.h>
+
+ * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
+
+ *
+
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+
+ *
+
+ * Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
+
+ *
+
+ * This source code is offered for use in the public domain. You may
+
+ * use, modify or distribute it freely.
+
+ *
+
+ * This code is distributed in the hope that it will be useful but
+
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
+
+ * DISCLAIMED. This includes but is not limited to warranties of
+
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ *
+
+ * Date: 2000-12-02
+
+ */
+
+
+
+
+
+#ifndef _STDINT_H
+
+#define _STDINT_H
+
+#define __need_wint_t
+
+#define __need_wchar_t
+
+#include <stddef.h>
+
+
+
+#ifdef _WIN32_WCE
+
+typedef _int64 int64_t;
+
+typedef unsigned _int64 uint64_t;
+
+#else
+
+typedef long long int64_t;
+
+typedef unsigned long long uint64_t;
+
+#endif /* _WIN32_WCE */
+
+
+
+/* 7.18.1.1 Exact-width integer types */
+
+typedef signed char int8_t;
+
+typedef unsigned char uint8_t;
+
+typedef short int16_t;
+
+typedef unsigned short uint16_t;
+
+typedef int int32_t;
+
+typedef unsigned uint32_t;
+
+
+
+/* 7.18.1.2 Minimum-width integer types */
+
+typedef signed char int_least8_t;
+
+typedef unsigned char uint_least8_t;
+
+typedef short int_least16_t;
+
+typedef unsigned short uint_least16_t;
+
+typedef int int_least32_t;
+
+typedef unsigned uint_least32_t;
+
+#ifndef _WIN32_WCE
+
+typedef long long int_least64_t;
+
+typedef unsigned long long uint_least64_t;
+
+#endif
+
+
+
+/* 7.18.1.3 Fastest minimum-width integer types
+
+ * Not actually guaranteed to be fastest for all purposes
+
+ * Here we use the exact-width types for 8 and 16-bit ints.
+
+ */
+
+typedef char int_fast8_t;
+
+typedef unsigned char uint_fast8_t;
+
+typedef short int_fast16_t;
+
+typedef unsigned short uint_fast16_t;
+
+typedef int int_fast32_t;
+
+typedef unsigned int uint_fast32_t;
+
+#ifndef _WIN32_WCE
+
+typedef long long int_fast64_t;
+
+typedef unsigned long long uint_fast64_t;
+
+#endif
+
+
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+
+#ifndef _WIN64
+
+typedef int intptr_t;
+
+typedef unsigned uintptr_t;
+
+#endif
+
+/* 7.18.1.5 Greatest-width integer types */
+
+#ifndef _WIN32_WCE
+
+typedef long long intmax_t;
+
+typedef unsigned long long uintmax_t;
+
+#endif
+
+
+
+/* 7.18.2 Limits of specified-width integer types */
+
+#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
+
+
+
+/* 7.18.2.1 Limits of exact-width integer types */
+
+#define INT8_MIN (-128)
+
+#define INT16_MIN (-32768)
+
+#define INT32_MIN (-2147483647 - 1)
+
+#define INT64_MIN (-9223372036854775807LL - 1)
+
+
+
+#define INT8_MAX 127
+
+#define INT16_MAX 32767
+
+#define INT32_MAX 2147483647
+
+#define INT64_MAX 9223372036854775807LL
+
+
+
+#define UINT8_MAX 0xff /* 255U */
+
+#define UINT16_MAX 0xffff /* 65535U */
+
+#define UINT32_MAX 0xffffffff /* 4294967295U */
+
+#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
+
+
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+
+#define INT_LEAST8_MIN INT8_MIN
+
+#define INT_LEAST16_MIN INT16_MIN
+
+#define INT_LEAST32_MIN INT32_MIN
+
+#define INT_LEAST64_MIN INT64_MIN
+
+
+
+#define INT_LEAST8_MAX INT8_MAX
+
+#define INT_LEAST16_MAX INT16_MAX
+
+#define INT_LEAST32_MAX INT32_MAX
+
+#define INT_LEAST64_MAX INT64_MAX
+
+
+
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define UINT_LEAST64_MAX UINT64_MAX
+
+
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+
+#define INT_FAST8_MIN INT8_MIN
+
+#define INT_FAST16_MIN INT16_MIN
+
+#define INT_FAST32_MIN INT32_MIN
+
+#define INT_FAST64_MIN INT64_MIN
+
+
+
+#define INT_FAST8_MAX INT8_MAX
+
+#define INT_FAST16_MAX INT16_MAX
+
+#define INT_FAST32_MAX INT32_MAX
+
+#define INT_FAST64_MAX INT64_MAX
+
+
+
+#define UINT_FAST8_MAX UINT8_MAX
+
+#define UINT_FAST16_MAX UINT16_MAX
+
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define UINT_FAST64_MAX UINT64_MAX
+
+
+
+/* 7.18.2.4 Limits of integer types capable of holding
+
+ object pointers */
+
+#define INTPTR_MIN INT32_MIN
+
+#define INTPTR_MAX INT32_MAX
+
+#define UINTPTR_MAX UINT32_MAX
+
+
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+
+#define INTMAX_MIN INT64_MIN
+
+#define INTMAX_MAX INT64_MAX
+
+#define UINTMAX_MAX UINT64_MAX
+
+
+
+/* 7.18.3 Limits of other integer types */
+
+#define PTRDIFF_MIN INT32_MIN
+
+#define PTRDIFF_MAX INT32_MAX
+
+
+
+#define SIG_ATOMIC_MIN INT32_MIN
+
+#define SIG_ATOMIC_MAX INT32_MAX
+
+
+
+#ifndef SIZE_MAX
+#define SIZE_MAX UINT32_MAX
+#endif
+
+
+#ifndef WCHAR_MIN /* also in wchar.h */
+
+#define WCHAR_MIN 0
+
+#define WCHAR_MAX 0xffff /* UINT16_MAX */
+
+#endif
+
+
+
+/*
+
+ * wint_t is unsigned short for compatibility with MS runtime
+
+ */
+
+#define WINT_MIN 0
+
+#define WINT_MAX 0xffff /* UINT16_MAX */
+
+
+
+#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
+
+
+
+
+
+/* 7.18.4 Macros for integer constants */
+
+#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
+
+
+
+/* 7.18.4.1 Macros for minimum-width integer constants
+
+
+
+ Accoding to Douglas Gwyn <gwyn@arl.mil>:
+
+ "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
+
+ 9899:1999 as initially published, the expansion was required
+
+ to be an integer constant of precisely matching type, which
+
+ is impossible to accomplish for the shorter types on most
+
+ platforms, because C99 provides no standard way to designate
+
+ an integer constant with width less than that of type int.
+
+ TC1 changed this to require just an integer constant
+
+ *expression* with *promoted* type."
+
+*/
+
+
+
+#define INT8_C(val) ((int8_t) + (val))
+
+#define UINT8_C(val) ((uint8_t) + (val##U))
+
+#define INT16_C(val) ((int16_t) + (val))
+
+#define UINT16_C(val) ((uint16_t) + (val##U))
+
+
+
+#define INT32_C(val) val##L
+
+#define UINT32_C(val) val##UL
+
+#define INT64_C(val) val##LL
+
+#define UINT64_C(val) val##ULL
+
+
+
+/* 7.18.4.2 Macros for greatest-width integer constants */
+
+#define INTMAX_C(val) INT64_C(val)
+
+#define UINTMAX_C(val) UINT64_C(val)
+
+
+
+#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
+
+
+
+#endif
+
+
+
diff --git a/xddm/include/wdmhelper.h b/xddm/include/wdmhelper.h
new file mode 100644
index 0000000..854a4cc
--- /dev/null
+++ b/xddm/include/wdmhelper.h
@@ -0,0 +1,38 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This software is licensed under the GNU General Public License,
+ version 2 (GPLv2) (see COPYING for details), subject to the
+ following clarification.
+
+ With respect to binaries built using the Microsoft(R) Windows
+ Driver Kit (WDK), GPLv2 does not extend to any code contained in or
+ derived from the WDK ("WDK Code"). As to WDK Code, by using or
+ distributing such binaries you agree to be bound by the Microsoft
+ Software License Terms for the WDK. All WDK Code is considered by
+ the GPLv2 licensors to qualify for the special exception stated in
+ section 3 of GPLv2 (commonly known as the system library
+ exception).
+
+ There is NO WARRANTY for this software, express or implied,
+ including the implied warranties of NON-INFRINGEMENT, TITLE,
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#ifndef WDM_HELPER_H
+#define WDM_HELPER_H
+
+#include "os_dep.h"
+
+typedef ULONG (*PQXLWaitForEvent)(PVOID,PLARGE_INTEGER);
+
+LONG QXLInitializeEvent(PVOID * pEvent);
+void QXLSetEvent(PVOID pEvent);
+void QXLDeleteEvent(PVOID pEvent);
+ULONG QXLWaitForEvent(PVOID pEvent,PLARGE_INTEGER Timeout);
+
+#define VideoPortDeleteEvent(dev,pEvent) QXLDeleteEvent(pEvent)
+#define VideoPortCreateEvent(dev,flag,reserved,ppEvent) QXLInitializeEvent(ppEvent)
+#define VideoPortSetEvent(dev,pEvent) QXLSetEvent(pEvent)
+
+#endif