Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
7.9 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: pointer.h
  8. *
  9. * This module contains all the definitions for pointer related stuff
  10. *
  11. * Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
  13. \**************************************************************************/
  14. #ifndef __POINTER__H__
  15. #define __POINTER__H__
  16. //
  17. // Some size definition
  18. //
  19. #define POINTER_DATA_SIZE 128 // Number of bytes to allocate for the
  20. // miniport down-loaded pointer code
  21. // working space
  22. #define HW_INVISIBLE_OFFSET 2 // Offset from 'ppdev->yPointerBuffer'
  23. // to the invisible pointer
  24. #define HW_POINTER_DIMENSION 64 // Maximum dimension of default
  25. // (built-in) hardware pointer
  26. #define HW_POINTER_TOTAL_SIZE 1024 // Total size in bytes required
  27. // to define the hardware pointer
  28. typedef enum
  29. {
  30. PTR_HW_ACTIVE = 1, // The hardware pointer is active and
  31. // visible
  32. PTR_SW_ACTIVE = 2, // The software pointer is active
  33. } ;
  34. typedef int PtrFlags;
  35. typedef struct _PDev PDev;
  36. //
  37. // 64 x 64 Hardware Pointer Caching data structures
  38. //
  39. #define SMALL_POINTER_MEM (32 * 4 * 2) // Bytes read for 32x32 cursor
  40. #define LARGE_POINTER_MEM (SMALL_POINTER_MEM * 4)
  41. // Bytes read for 64x64 cursor
  42. // Hardware workaround. We have had to stop using the hardware pointer
  43. // cache due to problems with changing pointer shape. Occasionaly it
  44. // caused the pointer to jump around on the screen. We don't currently
  45. // have time to work with 3Dlabs to find out how we can stop this jumpyness
  46. // so instead we will just not use the hardware pointer cache for the time
  47. // being.
  48. //#define SMALL_POINTER_MAX 4 // No. of cursors in cache
  49. #define SMALL_POINTER_MAX 1 // Hardware pointer cache workaround
  50. #define HWPTRCACHE_INVALIDENTRY (SMALL_POINTER_MAX + 1)
  51. // Well-known value
  52. //
  53. // Pointer cache item data structure, there is one of these for every cached
  54. // pointer
  55. //
  56. typedef struct
  57. {
  58. ULONG ptrCacheTimeStamp; // Timestamp used for LRU cache ageing
  59. ULONG ulKey; // iUniq value of pointer mask surface
  60. HSURF hsurf; // hsurf of the pointer mask surface
  61. } HWPointerCacheItemEntry;
  62. //
  63. // The complete cache looks like this
  64. //
  65. typedef struct
  66. {
  67. BYTE cPtrCacheInUseCount; // The no. of cache items used
  68. ULONG ptrCacheCurTimeStamp; // The date stamp used for LRU stuff
  69. ULONG ptrCacheData[LARGE_POINTER_MEM / 4];
  70. // The cached pointer data
  71. HWPointerCacheItemEntry ptrCacheItemList [SMALL_POINTER_MAX];
  72. // The cache item list
  73. } HWPointerCache;
  74. //
  75. // Capabilities flags
  76. //
  77. // These are private flags passed to us from the Permedia2 miniport. They
  78. // come from the high word of the 'AttributeFlags' field of the
  79. // 'VIDEO_MODE_INFORMATION' structure (found in 'ntddvdeo.h') passed
  80. // to us via an 'VIDEO_QUERY_AVAIL_MODES' or 'VIDEO_QUERY_CURRENT_MODE'
  81. // IOCTL.
  82. //
  83. // NOTE: These definitions must match those in the Permedia2 miniport's
  84. // 'permedia.h'!
  85. //
  86. typedef enum
  87. {
  88. //
  89. // NT4 uses the DeviceSpecificAttributes field so the low word is available
  90. //
  91. CAPS_ZOOM_X_BY2 = 0x00000001, // Hardware has zoomed by 2 in X
  92. CAPS_ZOOM_Y_BY2 = 0x00000002, // Hardware has zoomed by 2 in Y
  93. CAPS_SPARSE_SPACE = 0x00000004, // Framebuffer is sparsely mapped
  94. // (don't allow direct access).
  95. // The machine is probably an Alpha
  96. CAPS_SW_POINTER = 0x00010000, // No hardware pointer; use
  97. // software simulation
  98. CAPS_TVP4020_POINTER = 0x20000000, // Use Permedia2 builtin pointer
  99. CAPS_P2RD_POINTER = 0x80000000 // Use the 3Dlabs P2RD RAMDAC
  100. } /*CAPS*/;
  101. typedef int CAPS;
  102. //
  103. // Initializes hardware pointer or software pointer
  104. //
  105. BOOL bEnablePointer(PDev* ppdev);
  106. //
  107. // Determine whether we can do color space double buffering in the current mode
  108. //
  109. BOOL bP2RDCheckCSBuffering(PDev* ppdev);
  110. //
  111. // Use the pixel read mask to perform color space double buffering
  112. //
  113. BOOL bP2RDSwapCSBuffers(PDev* ppdev, LONG bufNo);
  114. //
  115. // Stores the 15-color cursor in the RAMDAC
  116. //
  117. BOOL bSet15ColorPointerShapeP2RD(PDev* ppdev, SURFOBJ* psoMask,
  118. SURFOBJ* psoColor,
  119. LONG x,
  120. LONG y,
  121. LONG xHot,
  122. LONG yHot);
  123. //
  124. // Stores the 3-color cursor in the RAMDAC
  125. //
  126. BOOL bSet3ColorPointerShapeP2RD(PDev* ppdev,
  127. SURFOBJ* psoMask,
  128. SURFOBJ* psoColor,
  129. LONG x,
  130. LONG y,
  131. LONG xHot,
  132. LONG yHot);
  133. //
  134. // Set pointer shape for P2RD
  135. //
  136. BOOL bSetPointerShapeP2RD(PDev* ppdev,
  137. SURFOBJ* pso,
  138. SURFOBJ* psoColor,
  139. XLATEOBJ* pxlo,
  140. LONG x,
  141. LONG y,
  142. LONG xHot,
  143. LONG yHot);
  144. //
  145. // Set the TI TVP4020 hardware pointer shape
  146. //
  147. BOOL bSetPointerShapeTVP4020(PDev* ppdev,
  148. SURFOBJ* pso,
  149. SURFOBJ* psoColor,
  150. LONG x,
  151. LONG y,
  152. LONG xHot,
  153. LONG yHot);
  154. //
  155. // Determine whether we can do color space double buffering in the current mode
  156. //
  157. BOOL bTVP4020CheckCSBuffering(PDev* ppdev);
  158. //
  159. // Set cache index
  160. //
  161. LONG HWPointerCacheCheckAndAdd(HWPointerCache* ptrCache,
  162. HSURF hsurf,
  163. ULONG ulKey,
  164. BOOL* isCached);
  165. //
  166. // Initialise the hardware pointer cache.
  167. //
  168. VOID HWPointerCacheInit(HWPointerCache* ptrCache);
  169. //
  170. // Hardware pointer caching functions/macros.
  171. //
  172. #define HWPointerCacheInvalidate(ptrCache) (ptrCache)->cPtrCacheInUseCount = 0
  173. //
  174. // Enable everything but hide the pointer
  175. //
  176. VOID vAssertModePointer(PDev* ppdev, BOOL bEnable);
  177. //
  178. // Get the hardware ready to use the 3Dlabs P2RD hardware pointer.
  179. //
  180. VOID vEnablePointerP2RD(PDev* ppdev);
  181. //
  182. // Get the hardware ready to use the TI TVP4020 hardware pointer.
  183. //
  184. VOID vEnablePointerTVP4020(PDev* ppdev);
  185. //
  186. // Move the 3Dlabs P2RD hardware pointer.
  187. //
  188. VOID vMovePointerP2RD(PDev* ppdev, LONG x, LONG y);
  189. //
  190. // Move the TI TVP4020 hardware pointer.
  191. //
  192. VOID vMovePointerTVP4020(PDev* ppdev, LONG x, LONG y);
  193. //
  194. // Show or hide the 3Dlabs P2RD hardware pointer.
  195. //
  196. VOID vShowPointerP2RD(PDev* ppdev, BOOL bShow);
  197. //
  198. // Show or hide the TI TVP4020 hardware pointer.
  199. //
  200. VOID vShowPointerTVP4020(PDev* ppdev, BOOL bShow);
  201. #endif