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.

1044 lines
48 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. * !! !!
  5. * !! WARNING: NOT DDK SAMPLE CODE !!
  6. * !! !!
  7. * !! This source code is provided for completeness only and should not be !!
  8. * !! used as sample code for display driver development. Only those sources !!
  9. * !! marked as sample code for a given driver component should be used for !!
  10. * !! development purposes. !!
  11. * !! !!
  12. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  13. *
  14. * Module Name: driver.h
  15. *
  16. * Content: Contains prototypes for the display driver.
  17. *
  18. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  19. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  20. \*****************************************************************************/
  21. #define ENABLE_DXMANAGED_LINEAR_HEAP (_WIN32_WINNT >= 0x500 && WNT_DDRAW)
  22. //////////////////////////////////////////////////////////////////////
  23. // Put all the conditional-compile constants here. There had better
  24. // not be many!
  25. #define SYNCHRONIZEACCESS_WORKS 1
  26. // Useful for visualizing the 2-d heap:
  27. #define DEBUG_HEAP 0
  28. typedef struct _PDEV PDEV; // Handy forward declaration
  29. #define ALLOC_TAG_DX(id) MAKEFOURCC('P','3','D',#@ id)
  30. #define ALLOC_TAG_GDI(id) MAKEFOURCC('P','3','G',#@ id)
  31. //////////////////////////////////////////////////////////////////////
  32. // Miscellaneous shared stuff
  33. #define DLL_NAME L"perm3dd" // Name of the DLL in UNICODE
  34. #define CLIP_LIMIT 50 // We'll be taking 800 bytes of stack space
  35. #define DRIVER_EXTRA_SIZE 0 // Size of the DriverExtra information in the
  36. // DEVMODE structure
  37. #define TMP_BUFFER_SIZE 16384 // Size in bytes of 'pvTmpBuffer'. Has to
  38. // be at least enough to store an entire
  39. // scan line (i.e. 8192 for 2048x????x32).
  40. typedef struct _CLIPENUM {
  41. LONG c;
  42. RECTL arcl[CLIP_LIMIT]; // Space for enumerating complex clipping
  43. } CLIPENUM; /* ce, pce */
  44. //////////////////////////////////////////////////////////////////////
  45. // Text stuff
  46. typedef struct _XLATECOLORS { // Specifies foreground and background
  47. ULONG iBackColor; // colours for faking a 1bpp XLATEOBJ
  48. ULONG iForeColor;
  49. } XLATECOLORS; /* xlc, pxlc */
  50. //////////////////////////////////////////////////////////////////////
  51. // Dither stuff
  52. // Describes a single colour tetrahedron vertex for dithering:
  53. typedef struct _VERTEX_DATA {
  54. ULONG ulCount; // Number of pixels in this vertex
  55. ULONG ulVertex; // Vertex number
  56. } VERTEX_DATA; /* vd, pv */
  57. VERTEX_DATA* vComputeSubspaces(ULONG, VERTEX_DATA*);
  58. VOID vDitherColor(ULONG*, VERTEX_DATA*, VERTEX_DATA*, ULONG);
  59. //////////////////////////////////////////////////////////////////////
  60. // Brush stuff
  61. // 'Slow' brushes are used when we don't have hardware pattern capability,
  62. // and we have to handle patterns using screen-to-screen blts:
  63. #define SLOW_BRUSH_CACHE_DIM_X 8
  64. #define SLOW_BRUSH_CACHE_DIM_Y 1 // Controls the number of brushes cached
  65. // in off-screen memory, when we don't
  66. // have the S3 hardware pattern support.
  67. // We allocate 3 x 3 brushes, so we can
  68. // cache a total of 9 brushes:
  69. #define SLOW_BRUSH_COUNT (SLOW_BRUSH_CACHE_DIM_X * SLOW_BRUSH_CACHE_DIM_Y)
  70. #define SLOW_BRUSH_DIMENSION 40 // After alignment is taken care of,
  71. // every off-screen brush cache entry
  72. // will be 48 pels in both dimensions
  73. #define SLOW_BRUSH_ALLOCATION (SLOW_BRUSH_DIMENSION + 8)
  74. // Actually allocate 72x72 pels for each
  75. // pattern, using the 8 extra for brush
  76. // alignment
  77. // 'Fast' brushes are used when we have hardware pattern capability:
  78. #define FAST_BRUSH_COUNT 16 // Total number of non-hardware brushes
  79. // cached off-screen
  80. #define FAST_BRUSH_DIMENSION 8 // Every off-screen brush cache entry
  81. // is 8 pels in both dimensions
  82. #define FAST_BRUSH_ALLOCATION 8 // We have to align ourselves, so this is
  83. // the dimension of each brush allocation
  84. // Common to both implementations:
  85. #define RBRUSH_2COLOR 1 // For RBRUSH flags
  86. #define TOTAL_BRUSH_COUNT max(FAST_BRUSH_COUNT, SLOW_BRUSH_COUNT)
  87. // This is the maximum number of brushes
  88. // we can possibly have cached off-screen
  89. #define TOTAL_BRUSH_SIZE 64 // We'll only ever handle 8x8 patterns,
  90. // and this is the number of pels
  91. // For now assume that all brushes are 64 entries (8x8 @ 32bpp):
  92. // At 16bpp we should be able to handle 8 brushes, no idea what happens at 8bpp!
  93. #define MAX_P3_BRUSHES 4
  94. typedef struct _BRUSHENTRY BRUSHENTRY;
  95. // NOTE: Changes to the RBRUSH or BRUSHENTRY structures must be reflected
  96. // in strucs.inc!
  97. typedef struct _RBRUSH {
  98. ULONG iUniq; // our own unique brush ID
  99. FLONG fl; // Type flags
  100. DWORD areaStippleMode;// area stipple mode if 1bpp.
  101. /*** get rid of bTransparent later. We need it now so everything compiles OK ***/
  102. BOOL bTransparent; // TRUE if brush was realized for a transparent
  103. // blt (meaning colours are white and black),
  104. // FALSE if not (meaning it's already been
  105. // colour-expanded to the correct colours).
  106. // Value is undefined if the brush isn't
  107. // 2 colour.
  108. ULONG ulForeColor; // Foreground colour if 1bpp
  109. ULONG ulBackColor; // Background colour if 1bpp
  110. ULONG patternBase; // Position of brush in LUT (colour P3 only)
  111. POINTL ptlBrushOrg; // Brush origin of cached pattern. Initial
  112. // value should be -1
  113. BRUSHENTRY* apbe; // Points to brush-entry that keeps track
  114. // of the cached off-screen brush bits
  115. ULONG aulPattern[1]; // Open-ended array for keeping copy of the
  116. // Don't put anything // actual pattern bits in case the brush
  117. // after here, or // origin changes, or someone else steals
  118. // you'll be sorry! // our brush entry (declared as a ULONG
  119. // for proper dword alignment)
  120. } RBRUSH; /* rb, prb */
  121. typedef struct _BRUSHENTRY {
  122. RBRUSH* prbVerify; // We never dereference this pointer to
  123. // find a brush realization; it is only
  124. // ever used in a compare to verify
  125. // that for a given realized brush, our
  126. // off-screen brush entry is still valid.
  127. LONG x; // x-position of cached pattern
  128. LONG y; // y-position of cached pattern
  129. } BRUSHENTRY; /* be, pbe */
  130. typedef union _RBRUSH_COLOR {
  131. RBRUSH* prb;
  132. ULONG iSolidColor;
  133. } RBRUSH_COLOR; /* rbc, prbc */
  134. // 2D display driver DMA buffer definitions
  135. typedef struct DMABuffer
  136. {
  137. LARGE_INTEGER pphysStart;
  138. PULONG pulStart;
  139. PULONG pulEnd;
  140. PULONG pulCurrent;
  141. ULONG cb;
  142. }
  143. DMA_BUFFER;
  144. #define DD_DMA_BUFFER_SIZE (ppdev->DMABuffer.cb)
  145. #define QUERY_DD_DMA_FREE_ULONGS(c) \
  146. c = ((ULONG)(1 + ppdev->DMABuffer.pulEnd - ppdev->DMABuffer.pulCurrent))
  147. #define QUERY_DD_DMA_FREE_TAGDATA_PAIRS(cFree) \
  148. QUERY_DD_DMA_FREE_ULONGS(cFree) >> 1
  149. #define WRITE_DD_DMA_ULONG(ul) \
  150. *ppdev->DMABuffer.pulCurrent++ = ul
  151. #define WRITE_DD_DMA_TAGDATA(Tag, Data) \
  152. { \
  153. WRITE_DD_DMA_ULONG(Tag); \
  154. WRITE_DD_DMA_ULONG(Data); \
  155. }
  156. #define DD_DMA_XFER_IN_PROGRESS (!(ppdev->g_GlintBoardStatus & GLINT_DMA_COMPLETE))
  157. #define WAIT_DD_DMA_COMPLETE \
  158. { \
  159. WAIT_IMMEDIATE_DMA_COMPLETE; \
  160. ppdev->g_GlintBoardStatus |= GLINT_DMA_COMPLETE; \
  161. ppdev->DMABuffer.pulCurrent = ppdev->DMABuffer.pulStart; \
  162. }
  163. /////////////////////////////////////////////////////////////////////////
  164. // Heap stuff
  165. // forward declaration, rather than include the DX headers here
  166. typedef struct tagLinearAllocatorInfo LinearAllocatorInfo, *pLinearAllocatorInfo;
  167. typedef enum {
  168. OH_FREE = 0, // The off-screen allocation is available for use
  169. OH_DISCARDABLE, // The allocation is occupied by a discardable bitmap
  170. // that may be moved out of off-screen memory
  171. OH_PERMANENT, // The allocation is occupied by a permanent bitmap
  172. // that cannot be moved out of off-screen memory
  173. } OHSTATE;
  174. typedef struct _DSURF DSURF;
  175. typedef struct _OH OH;
  176. typedef struct _OH
  177. {
  178. OHSTATE ohState; // State of off-screen allocation
  179. LONG x; // x-coordinate of left edge of allocation
  180. LONG y; // y-coordinate of top edge of allocation
  181. LONG cx; // Width in pixels of allocation
  182. LONG cy; // Height in pixels of allocation
  183. LONG pixOffset; // Offset in pixels to origin of bitmap
  184. LONG lPixDelta; // always == ppdev->cxMemory for rectangular bitmaps, otherwise == bitmap stride
  185. LONG cxReserved; // Dimensions of original reserved rectangle;
  186. LONG cyReserved; // zero if rectangle is not 'reserved'
  187. OH* pohNext; // When OH_FREE or OH_RESERVE, points to the next
  188. // free node, in ascending cxcy value. This is
  189. // kept as a circular doubly-linked list with a
  190. // sentinel at the end.
  191. // When OH_DISCARDABLE, points to the next most
  192. // recently created allocation. This is kept as
  193. // a circular doubly-linked list.
  194. OH* pohPrev; // Opposite of 'pohNext'
  195. ULONG cxcy; // Width and height in a dword for searching
  196. OH* pohLeft; // Rectangular heap: Adjacent allocation when in-use or available
  197. OH* pohUp;
  198. OH* pohRight;
  199. OH* pohDown;
  200. DSURF* pdsurf; // Points to our DSURF structure
  201. VOID* pvScan0; // Points to start of first scan-line
  202. BOOL bOffScreen;
  203. BOOL bDXManaged; // TRUE if this is linear DFB, FALSE if it's rectangular
  204. #if (_WIN32_WINNT >= 0x500)
  205. LinearAllocatorInfo *pvmHeap; // if (bLinear) this points to the heap from which the DFB was allocated
  206. FLATPTR fpMem; // if (bLinear) this pointers to the DFB bitmap in the heap
  207. #endif
  208. }; /* oh, poh */
  209. // This is the smallest structure used for memory allocations:
  210. typedef struct _OHALLOC OHALLOC;
  211. typedef struct _OHALLOC
  212. {
  213. OHALLOC* pohaNext;
  214. OH aoh[1];
  215. } OHALLOC; /* oha, poha */
  216. typedef struct _HEAP
  217. {
  218. LONG cxMax; // Largest possible free space by area
  219. LONG cyMax;
  220. LONG cxBounds; // Largest possible bounding rectangle
  221. LONG cyBounds;
  222. OH ohFree; // Head of the free list, containing those
  223. // rectangles in off-screen memory that are
  224. // available for use. pohNext points to
  225. // hte smallest available rectangle, and pohPrev
  226. // points to the largest available rectangle,
  227. // sorted by cxcy.
  228. OH ohDiscardable; // Head of the discardable list that contains all
  229. // bitmaps located in offscreen memory that
  230. // are eligible to be tossed out of the heap.
  231. // It is kept in order of creation: pohNext
  232. // points to the most recently created; pohPrev
  233. // points to the least recently created.
  234. OH ohPermanent; // List of permanently allocated rectangles
  235. OH* pohFreeList; // List of OH node data structures available
  236. OHALLOC* pohaChain; // Chain of allocations
  237. ULONG DDrawOffscreenStart;
  238. #if (_WIN32_WINNT >= 0x500)
  239. LinearAllocatorInfo *pvmLinearHeap;
  240. ULONG cLinearHeaps;
  241. #endif
  242. } HEAP; /* heap, pheap */
  243. typedef enum {
  244. DT_SCREEN = 0x1, // Surface is kept in screen memory
  245. DT_DIB = 0x2, // Surface is kept as a DIB
  246. DT_DIRECTDRAW = 0x4, // Surface is derived from ddraw surface
  247. } DSURFTYPE; /* dt, pdt */
  248. typedef struct _DSURF
  249. {
  250. DSURFTYPE dt; // DSURF status (whether off-screen or in a DIB)
  251. BOOL bOffScreen; // DFB (off-screen) driver surface, not the on-screen surface
  252. SIZEL sizl; // Size of the original bitmap (could be smaller
  253. // than poh->sizl)
  254. PDEV* ppdev; // Need this for deleting the bitmap
  255. // If the bitmap is in the heap we can still keep a GDI accessible bitmap
  256. // for it because the screen is fully and linearly mapped. When we kick
  257. // the bitmap off the heap we delete this bitmap and create a real
  258. // memory bitmap. So when DT_SCREEN, we use both pointers. Hence not a
  259. // union. 0I'm not convinced it's valid to change the public entries in a
  260. // SURFOBJ to turn one surface into another (i.e. create a bitmap to point
  261. // to the screen and later change it to point to memory) so I'm not doing
  262. // it. Hence, we delete and recreate the screen bitmap surface when
  263. // changing between DT_SCREEN and DT_DIB. Remember when we move the DIB
  264. // back onto the screen it generally won't be in the same place so the
  265. // base pointer has to change.
  266. OH* poh; // If DT_SCREEN, points to off-screen heap node.
  267. SURFOBJ* pso; // If DT_SCREEN, points to GDI accessible surface for the bitmap
  268. // else if DT_DIB, points to locked GDI surface
  269. // The following are used for DT_DIB only...
  270. ULONG cBlt; // Counts down the number of blts necessary at
  271. // the current uniqueness before we'll consider
  272. // putting the DIB back into off-screen memory
  273. ULONG iUniq; // Tells us whether there have been any heap
  274. // 'free's since the last time we looked at
  275. // this DIB
  276. } DSURF; /* dsurf, pdsurf */
  277. // Number of blts necessary before we'll consider putting a DIB DFB back
  278. // into off-screen memory:
  279. #define HEAP_COUNT_DOWN 6
  280. // Flags for 'pohAllocate':
  281. typedef enum {
  282. FLOH_ONLY_IF_ROOM = 0x00000001, // Don't kick stuff out of off-
  283. FLOH_MAKE_PERMANENT = 0x00000002, // Allocate a permanent entry
  284. FLOH_RESERVE = 0x00000004, // Allocate an off-screen entry,
  285. } FLOH;
  286. BOOL bEnableOffscreenHeap(PDEV*);
  287. VOID vDisableOffscreenHeap(PDEV*);
  288. VOID vEnable2DOffscreenMemory(PDEV *);
  289. BOOL bDisable2DOffscreenMemory(PDEV *);
  290. BOOL bAssertModeOffscreenHeap(PDEV*, BOOL);
  291. OH* pohAllocate(PDEV*, POINTL*, LONG, LONG, FLOH);
  292. VOID vSurfUsed(SURFOBJ*);
  293. OH* pohFree(PDEV*, OH*);
  294. OH* pohMoveOffscreenDfbToDib(PDEV*, OH*);
  295. BOOL bMoveDibToOffscreenDfbIfRoom(PDEV*, DSURF*);
  296. BOOL bCreateScreenDIBForOH(PDEV*, OH*, ULONG);
  297. VOID vDeleteScreenDIBFromOH(OH *);
  298. /////////////////////////////////////////////////////////////////////////
  299. // Bank manager stuff
  300. #define BANK_DATA_SIZE 80 // Number of bytes to allocate for the
  301. // miniport down-loaded bank code working
  302. // space
  303. typedef struct _BANK
  304. {
  305. // Private data:
  306. RECTL rclDraw; // Rectangle describing the remaining undrawn
  307. // portion of the drawing operation
  308. RECTL rclSaveBounds; // Saved from original CLIPOBJ for restoration
  309. BYTE iSaveDComplexity; // Saved from original CLIPOBJ for restoration
  310. BYTE fjSaveOptions; // Saved from original CLIPOBJ for restoration
  311. LONG iBank; // Current bank
  312. PDEV* ppdev; // Saved copy
  313. // Public data:
  314. SURFOBJ* pso; // Surface wrapped around the bank. Has to be
  315. // passed as the surface in any banked call-
  316. // back.
  317. CLIPOBJ* pco; // Clip object that is the intersection of the
  318. // original clip object with the bounds of the
  319. // current bank. Has to be passed as the clip
  320. // object in any banked call-back.
  321. } BANK; /* bnk, pbnk */
  322. typedef enum {
  323. BANK_OFF = 0, // We've finished using the memory aperture
  324. BANK_ON, // We're about to use the memory aperture
  325. BANK_DISABLE, // We're about to enter full-screen; shut down banking
  326. BANK_ENABLE, // We've exited full-screen; re-enable banking
  327. } BANK_MODE; /* bankm, pbankm */
  328. typedef VOID (FNBANKMAP)(VOID*, LONG);
  329. typedef VOID (FNBANKSELECTMODE)(VOID*, BANK_MODE);
  330. typedef VOID (FNBANKINITIALIZE)(VOID*, BOOL);
  331. typedef BOOL (FNBANKCOMPUTE)(PDEV*, RECTL*, RECTL*, LONG*, LONG*);
  332. VOID vBankStart(PDEV*, RECTL*, CLIPOBJ*, BANK*);
  333. BOOL bBankEnum(BANK*);
  334. FNBANKCOMPUTE bBankComputeNonPower2;
  335. FNBANKCOMPUTE bBankComputePower2;
  336. BOOL bEnableBanking(PDEV*);
  337. VOID vDisableBanking(PDEV*);
  338. VOID vAssertModeBanking(PDEV*, BOOL);
  339. /////////////////////////////////////////////////////////////////////////
  340. // Pointer stuff
  341. #define POINTER_DATA_SIZE 128 // Number of bytes to allocate for the
  342. // miniport down-loaded pointer code
  343. // working space
  344. #define HW_INVISIBLE_OFFSET 2 // Offset from 'ppdev->yPointerBuffer'
  345. // to the invisible pointer
  346. #define HW_POINTER_DIMENSION 64 // Maximum dimension of default
  347. // (built-in) hardware pointer
  348. #define HW_POINTER_TOTAL_SIZE 1024 // Total size in bytes required
  349. // to define the hardware pointer
  350. typedef enum {
  351. PTR_HW_ACTIVE = 1, // The hardware pointer is active and visible
  352. // on screen
  353. PTR_SW_ACTIVE = 2, // The software pointer is active
  354. } PTRFLAGS;
  355. BOOL bEnablePointer(PDEV*);
  356. VOID vDisablePointer(PDEV*);
  357. VOID vAssertModePointer(PDEV*, BOOL);
  358. /////////////////////////////////////////////////////////////////////////
  359. // 64 x 64 Hardware Pointer Caching data structures
  360. #define SMALL_POINTER_MEM (32 * 4 * 2) // Bytes reqd for 32x32 cursor
  361. #define LARGE_POINTER_MEM (SMALL_POINTER_MEM * 4) // Bytes reqd for 64x64 cursor
  362. #define SMALL_POINTER_MAX 4 // No of cursors in cache
  363. #define HWPTRCACHE_INVALIDENTRY (SMALL_POINTER_MAX + 1) // Well-known value
  364. // Pointer cache item data structure, there is one of these for every
  365. // cached pointer
  366. typedef struct {
  367. ULONG ptrCacheTimeStamp; // Timestamp used for LRU cache ageing
  368. ULONG ptrCacheCX; // width of cursor
  369. ULONG ptrCacheCY; // height of cursor
  370. LONG ptrCacheLDelta; // Line delta
  371. } HWPointerCacheItemEntry;
  372. // The complete cache looks like this
  373. typedef struct {
  374. BYTE ptrCacheIsLargePtr; // TRUE if we have one 64x64 cursor, FALSE if we
  375. // have multiple 32x32 cursors
  376. BYTE ptrCacheInUseCount; // The no. of cache items used
  377. ULONG ptrCacheCurTimeStamp; // The date stamp used for LRU stuff
  378. ULONG ptrCacheData [LARGE_POINTER_MEM / 4]; // The cached pointer data
  379. HWPointerCacheItemEntry ptrCacheItemList [SMALL_POINTER_MAX]; // The cache item list
  380. } HWPointerCache;
  381. /////////////////////////////////////////////////////////////////////////
  382. // Palette stuff
  383. BOOL bEnablePalette(PDEV*);
  384. VOID vDisablePalette();
  385. VOID vAssertModePalette(PDEV*, BOOL);
  386. BOOL bInitializePalette(PDEV*, DEVINFO*);
  387. VOID vUninitializePalette(PDEV*);
  388. #define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
  389. #if WNT_DDRAW
  390. /////////////////////////////////////////////////////////////////////////
  391. // DirectDraw stuff
  392. // Sync with 2D driver
  393. VOID vNTSyncWith2DDriver(PDEV *ppdev);
  394. // Set up off-screen video memory for DirectDraw
  395. BOOL bSetupOffscreenForDDraw (BOOL enableFlag, PDEV *ppdev, volatile ULONG ** VBlankAddress, volatile ULONG **bOverlayEnabled,
  396. volatile ULONG **VBLANKUpdateOverlay, volatile ULONG **VBLANKUpdateOverlayWidth,
  397. volatile ULONG **VBLANKUpdateOverlayHeight);
  398. // Get framebuffer/Localbuffer info for DirectDraw
  399. void GetFBLBInfoForDDraw (PDEV * ppdev,
  400. void ** fbPtr, // Framebuffer pointer
  401. void ** lbPtr, // Localbuffer pointer
  402. DWORD * fbSizeInBytes, // Size of framebuffer
  403. DWORD * lbSizeInBytes, // Size of localbuffer
  404. DWORD * fbOffsetInBytes, // Offset to 1st 'free' byte in framebuffer
  405. BOOL * bSDRAM); // TRUE if SDRAM (i.e. no h/w writemask)
  406. // Get chip info for DirectDraw
  407. void GetChipInfoForDDraw (PDEV* ppdev,
  408. DWORD* pdwChipID,
  409. DWORD* pdwChipRev,
  410. DWORD* pdwChipFamily,
  411. DWORD *pdwGammaRev);
  412. LONG DDSendDMAData(PDEV* ppdev, ULONG PhysAddr, ULONG_PTR VirtAddr, LONG nDataEntries);
  413. LONG DDGetFreeDMABuffer(DWORD *physAddr, ULONG_PTR *virtAddr, DWORD *bufferSize);
  414. void DDFreeDMABuffer(void* dwPhysAddress);
  415. LONG DDWaitDMAComplete(PDEV* ppdev);
  416. #define ROUND_UP_TO_64K(x) (((ULONG)(x) + 0x10000 - 1) & ~(0x10000 - 1))
  417. BOOL _DD_DDE_bEnableDirectDraw(PDEV*);
  418. VOID _DD_DDE_vDisableDirectDraw(PDEV*);
  419. VOID _DD_DDE_vAssertModeDirectDraw(PDEV*, BOOL);
  420. BOOL _DD_DDE_CreatePPDEV(PDEV* ppdev);
  421. void _DD_DDE_DestroyPPDEV(PDEV* ppdev);
  422. void _DD_DDE_ResetPPDEV(PDEV* ppdevOld, PDEV* ppdevNew);
  423. VOID vAssertModeGlintExt(PDEV* ppdev, BOOL bEnable);
  424. #endif // WNT_DDRAW
  425. //////////////////////////////////////////////////////////////////////
  426. // Low-level blt function prototypes
  427. typedef VOID (GFNCOPY)(PDEV*, RECTL*, LONG, DWORD, POINTL*, RECTL*);
  428. typedef VOID (GFNFILL)(PDEV*, LONG, RECTL *, ULONG, ULONG, RBRUSH_COLOR,
  429. POINTL*);
  430. typedef VOID (GFNXFER)(PDEV*, RECTL*, LONG, ULONG, ULONG, SURFOBJ*, POINTL*,
  431. RECTL*, XLATEOBJ*);
  432. typedef VOID (GFNMCPY)(PDEV*, RECTL*, LONG, SURFOBJ*, POINTL*, ULONG, ULONG,
  433. POINTL*, RECTL*);
  434. typedef BOOL (GFNPOLY)(PDEV*, LONG, POINTFIX*, ULONG, ULONG, DWORD, CLIPOBJ*,
  435. RBRUSH*, POINTL*);
  436. typedef BOOL (GFNLINE)(PDEV*, LONG, LONG, LONG, LONG);
  437. typedef VOID (GFNPATR)(PDEV*, RBRUSH*, POINTL*);
  438. typedef VOID (GFNMONO)(PDEV*, RBRUSH*, POINTL*);
  439. typedef BOOL (GFNINIS)(PDEV*, ULONG, DWORD, RECTL*);
  440. typedef VOID (GFNRSTS)(PDEV*);
  441. typedef VOID (GFNREPN)(PDEV*, RECTL*, CLIPOBJ*);
  442. typedef VOID (GFNUPLD)(PDEV*, LONG, RECTL*, SURFOBJ*, POINTL*, RECTL*);
  443. typedef VOID (SWAPCSBUFL)(PDEV**, LONG);
  444. typedef VOID (GFN3DEXCL)(PDEV *, BOOL);
  445. typedef VOID (GFNCOPYD)(PDEV *, SURFOBJ *, POINTL *, RECTL *, RECTL *, LONG);
  446. typedef VOID (GFNXCOPYD)(PDEV *, SURFOBJ *, POINTL *, RECTL *, RECTL *, LONG, XLATEOBJ *);
  447. #if (_WIN32_WINNT >= 0x500)
  448. typedef BOOL (GFNGRADRECT)(PDEV *, TRIVERTEX *, ULONG, GRADIENT_RECT *, ULONG, ULONG, RECTL *, LONG);
  449. typedef BOOL (GFNTRANSBLT)(PDEV *, RECTL *, POINTL *, ULONG, RECTL *, LONG);
  450. typedef BOOL (GFNALPHABLT)(PDEV *, RECTL *, POINTL *, BLENDOBJ *, RECTL *, LONG);
  451. #endif
  452. typedef VOID (PTRENABLE)(PDEV *);
  453. typedef VOID (PTRDISABLE)(PDEV *);
  454. typedef BOOL (PTRSETSHAPE)(PDEV *, SURFOBJ *, SURFOBJ *, XLATEOBJ *, LONG, LONG, LONG, LONG);
  455. typedef VOID (PTRMOVE)(PDEV *, LONG, LONG);
  456. typedef VOID (PTRSHOW)(PDEV *, BOOL);
  457. typedef struct _STRIP STRIP; // Actually in lines.h
  458. typedef struct _LINESTATE LINESTATE; // Actually in lines.h
  459. typedef VOID (* GAPFNstripFunc)(PDEV*, STRIP*, LINESTATE*);
  460. // PXRX 2D DMA functions:
  461. typedef struct _glint_data *GlintDataPtr; // Actually in Glint.h
  462. typedef struct _PDEV *PPDEV; // Actually in Glint.h
  463. typedef void (* SendPXRXdma )( PPDEV ppdev, GlintDataPtr glintInfo );
  464. typedef void (* SwitchPXRXdmaBuffer )( PPDEV ppdev, GlintDataPtr glintInfo );
  465. typedef void (* WaitPXRXdmaCompletedBuffer)( PPDEV ppdev, GlintDataPtr glintInfo );
  466. ////////////////////////////////////////////////////////////////////////
  467. // Capabilities flags
  468. //
  469. // These are private flags passed to us from the GLINT miniport. They
  470. // come from the high word of the 'AttributeFlags' field of the
  471. // 'VIDEO_MODE_INFORMATION' structure (found in 'ntddvdeo.h') passed
  472. // to us via an 'VIDEO_QUERY_AVAIL_MODES' or 'VIDEO_QUERY_CURRENT_MODE'
  473. // IOCTL.
  474. //
  475. // NOTE: These definitions must match those in the GLINT miniport's 'glint.h'!
  476. typedef enum {
  477. // NT4 uses the DeviceSpecificAttributes field so the low word is available
  478. CAPS_ZOOM_X_BY2 = 0x00000001, // Hardware has zoomed by 2 in X
  479. CAPS_ZOOM_Y_BY2 = 0x00000002, // Hardware has zoomed by 2 in Y
  480. CAPS_SPARSE_SPACE = 0x00000004, // Framebuffer is sparsely mapped
  481. // (don't allow direct access). The machine
  482. // is probably an Alpha.
  483. CAPS_QUEUED_DMA = 0x00000008, // DMA address/count via the FIFO
  484. CAPS_LOGICAL_DMA = 0x00000010, // DMA through logical address table
  485. CAPS_USE_AGP_DMA = 0x00000020, // AGP DMA can be used.
  486. CAPS_P3RD_POINTER = 0x00000040, // Use the 3Dlabs P3RD RAMDAC
  487. CAPS_STEREO = 0x00000080, // Stereo mode enabled.
  488. CAPS_SW_POINTER = 0x00010000, // No hardware pointer; use software
  489. // simulation
  490. CAPS_GLYPH_EXPAND = 0x00020000, // Use glyph-expand method to draw
  491. // text.
  492. CAPS_RGB525_POINTER = 0x00040000, // Use IBM RGB525 cursor
  493. CAPS_FAST_FILL_BUG = 0x00080000, // Chip fast fill bug exists
  494. CAPS_INTERRUPTS = 0x00100000, // interrupts available
  495. CAPS_DMA_AVAILABLE = 0x00200000, // DMA is supported
  496. CAPS_DISABLE_OVERLAY = 0x00400000, // Chip do not support overlay
  497. CAPS_8BPP_RGB = 0x00800000, // Use RGB in 8bpp mode
  498. CAPS_RGB640_POINTER = 0x01000000, // Use IBM RGB640 cursor
  499. CAPS_DUAL_GLINT = 0x02000000, // Dual board (currently dual TX or MX)
  500. CAPS_GLINT2_RAMDAC = 0x04000000, // Second of dual glint attached to the RAMDAC
  501. CAPS_ENHANCED_TX = 0x08000000, // TX is in enhanced mode
  502. CAPS_ACCEL_HW_PRESENT = 0x10000000, // Accel Graphics Hardware
  503. CAPS_TVP4020_POINTER = 0x20000000, // Use Permedia2 builtin pointer
  504. CAPS_SPLIT_FRAMEBUFFER = 0x40000000, // Dual-GLINT with a split framebuffer
  505. CAPS_P2RD_POINTER = 0x80000000 // Use the 3Dlabs P2RD RAMDAC
  506. } CAPS;
  507. ////////////////////////////////////////////////////////////////////////
  508. // Status flags
  509. typedef enum {
  510. // STAT_* indicates that the resource actually exists
  511. STAT_GLYPH_CACHE = 0x00000001, // Glyph cache successfully allocated
  512. STAT_BRUSH_CACHE = 0x00000002, // Brush cache successfully allocated
  513. STAT_DEV_BITMAPS = 0x00000004, // Device Bitmaps are allowed
  514. STAT_POINTER_CACHE = 0x00000008, // Software cursor support configured
  515. STAT_LINEAR_HEAP = 0x00000010, // Linear heap configured
  516. // ENABLE_* indicates whether resource is currently available
  517. ENABLE_GLYPH_CACHE = 0x00010000, // Glyph cache enabled
  518. ENABLE_BRUSH_CACHE = 0x00020000, // Brush cache enabled
  519. ENABLE_DEV_BITMAPS = 0x00040000, // Device Bitmaps enabled
  520. ENABLE_POINTER_CACHE = 0x00080000, // Software cursor support enabled
  521. ENABLE_LINEAR_HEAP = 0x00100000, // linear heap support is available
  522. #if WNT_DDRAW
  523. STAT_DIRECTDRAW = 0x80000000, // DirectDraw is enabled
  524. #endif WNT_DDRAW
  525. } STATUS;
  526. // Texel LUT Cache types and additional cache info
  527. typedef enum
  528. {
  529. LUTCACHE_INVALID, LUTCACHE_XLATE, LUTCACHE_BRUSH
  530. }
  531. LUTCACHE;
  532. typedef struct _glint_ctxt_table GlintCtxtTable;
  533. ////////////////////////////////////////////////////////////////////////
  534. // The Physical Device data structure
  535. typedef struct _PDEV
  536. {
  537. DWORD cFlags; // The cache flags
  538. LONG xOffset;
  539. LONG DstPixelOrigin; // pixel offset to the current destination DFB
  540. LONG SrcPixelOrigin; // pixel offset to the current source DFB
  541. ULONG xyOffsetDst; // x & y offset to the current destination DFB
  542. ULONG xyOffsetSrc; // x & y offset to the current source DFB
  543. LONG DstPixelDelta;
  544. LONG SrcPixelDelta;
  545. BOOL bDstOffScreen;
  546. BYTE* pjScreen; // Points to base screen address
  547. ULONG iBitmapFormat; // BMF_8BPP or BMF_16BPP or BMF_32BPP
  548. // (our current colour depth)
  549. CAPS flCaps; // Capabilities flags
  550. STATUS flStatus; // Status flags
  551. BOOL bEnabled; // In graphics mode (not full-screen)
  552. HANDLE hDriver; // Handle to \Device\Screen
  553. HDEV hdevEng; // Engine's handle to PDEV
  554. HSURF hsurfScreen; // Engine's handle to screen surface
  555. DSURF* pdsurfScreen; // Our private DSURF for the screen
  556. DSURF* pdsurfOffScreen; // Our private DSURF for the back buffer
  557. LONG cxScreen; // Visible screen width
  558. LONG cyScreen; // Visible screen height
  559. LONG cxMemory; // Width of Video RAM
  560. LONG cyMemory; // Height of Video RAM
  561. ULONG ulMode; // Mode the mini-port driver is in.
  562. LONG lDelta; // Distance from one scan to the next.
  563. ULONG Vrefresh; // Screen refresh frequency in Hz
  564. FLONG flHooks; // What we're hooking from GDI
  565. LONG cjPelSize; // Number of bytes per pel, according
  566. // to GDI
  567. LONG cPelSize; // 0 if 8bpp, 1 if 16bpp, 2 if 32bpp
  568. ULONG ulWhite; // 0xff if 8bpp, 0xffff if 16bpp,
  569. // 0xffffffff if 32bpp
  570. ULONG* pulCtrlBase[3]; // Mapped control registers for this PDEV
  571. // 2 entries to support Dual-TX
  572. // 1 entry for dense alpha mapping
  573. ULONG* pulRamdacBase; // Mapped control registers for the RAMDAC
  574. VOID* pvTmpBuffer; // General purpose temporary buffer,
  575. // TMP_BUFFER_SIZE bytes in size
  576. // (Remember to synchronize if you
  577. // use this for device bitmaps or
  578. // async pointers)
  579. DMA_BUFFER DMABuffer; // DMA buffer used by the 2D driver
  580. // (currently this is the same buffer as
  581. // the line buffer in glintInfo)
  582. ////////// Palette stuff:
  583. PALETTEENTRY* pPal; // The palette if palette managed
  584. HPALETTE hpalDefault; // GDI handle to the default palette.
  585. FLONG flRed; // Red mask for 16/32bpp bitfields
  586. FLONG flGreen; // Green mask for 16/32bpp bitfields
  587. FLONG flBlue; // Blue mask for 16/32bpp bitfields
  588. ULONG iPalUniq; // P2 TexelLUT palette tracker
  589. ULONG cPalLUTInvalidEntries; // P2 TexelLUT invalidation tracker
  590. LUTCACHE PalLUTType; // P2 TexelLUT cached object type
  591. ////////// Heap stuff:
  592. HEAP heap; // All our off-screen heap data
  593. ULONG iHeapUniq; // Incremented every time room is freed
  594. // in the off-screen heap
  595. SURFOBJ* psoPunt; // Wrapper surface for having GDI draw
  596. // on off-screen bitmaps
  597. SURFOBJ* psoPunt2; // Another one for off-screen to off-
  598. // screen blts
  599. OH* pohScreen; // Off-screen heap structure for the
  600. // visible screen
  601. ////////// Banking stuff:
  602. LONG cjBank; // Size of a bank, in bytes
  603. LONG cPower2ScansPerBank; // Used by 'bBankComputePower2'
  604. LONG cPower2BankSizeInBytes; // Used by 'bBankComputePower2'
  605. CLIPOBJ* pcoBank; // Clip object for banked call backs
  606. SURFOBJ* psoBank; // Surface object for banked call backs
  607. VOID* pvBankData; // Points to aulBankData[0]
  608. ULONG aulBankData[BANK_DATA_SIZE / 4];
  609. // Private work area for downloaded
  610. // miniport banking code
  611. FNBANKMAP* pfnBankMap;
  612. FNBANKSELECTMODE* pfnBankSelectMode;
  613. FNBANKCOMPUTE* pfnBankCompute;
  614. ////////// Pointer stuff:
  615. BOOL bPointerEnabled;
  616. LONG xPointerHot; // xHot of current hardware pointer
  617. LONG yPointerHot; // yHot of current hardware pointer
  618. LONG yPointerBuffer; // Start of off-screen pointer buffer
  619. LONG dyPointerCurrent; // y offset in buffer to current pointer
  620. // (either 0 or 1)
  621. ULONG ulHwGraphicsCursorModeRegister_45;
  622. // Default value for index 45
  623. PTRFLAGS flPointer; // Pointer state flags
  624. VOID* pvPointerData; // Points to ajPointerData[0]
  625. BYTE ajPointerData[POINTER_DATA_SIZE];
  626. // Private work area for downloaded
  627. // miniport pointer code
  628. ////////// Brush stuff:
  629. BOOL bRealizeTransparent; // Hint to DrvRealizeBrush for whether
  630. // the brush should be realized as
  631. // transparent or not
  632. LONG cPatterns; // Count of bitmap patterns created
  633. LONG iBrushCache; // Index for next brush to be allocated
  634. LONG cBrushCache; // Total number of brushes cached
  635. ULONG iBrushCacheP3; // Index for next LUT brush to be allocated
  636. BRUSHENTRY abeMono; // Keeps track of area stipple brush
  637. BRUSHENTRY abeP3[MAX_P3_BRUSHES]; // Keeps track of LUT brushes
  638. BRUSHENTRY abe[TOTAL_BRUSH_COUNT]; // Keeps track of brush cache
  639. HBITMAP ahbmPat[HS_DDI_MAX]; // Engine handles to standard patterns
  640. /////////// Image download scratch area
  641. OH *pohImageDownloadArea;
  642. ULONG cbImageDownloadArea;
  643. ////////// Hardware pointer cache stuff:
  644. HWPointerCache HWPtrCache; // The cache data structure itself
  645. LONG HWPtrLastCursor; // The index of the last cursor that we drew
  646. LONG HWPtrPos_X; // The last X position of the cursor
  647. LONG HWPtrPos_Y; // The last Y position of the cursor
  648. PVOID glintInfo; // info about the interface to GLINT
  649. LONG currentCtxt; // id of the context currently loaded
  650. GlintCtxtTable* pGContextTable; // pointer to contexts table
  651. ULONG g_GlintBoardStatus; // indicate whether DMA has completed,
  652. // the GLINT is synced etc
  653. LONG FrameBufferLength; // Length of framebuffer in bytes
  654. LONG Disable2DCount;
  655. // pointers to low level routines
  656. GFNCOPY *pgfnCopyBlt;
  657. GFNCOPY *pgfnCopyBltNative; //azn unused
  658. GFNCOPY *pgfnCopyBltCopyROP;
  659. GFNFILL *pgfnFillSolid;
  660. GFNFILL *pgfnFillPatMono;
  661. GFNFILL *pgfnFillPatColor;
  662. GFNXFER *pgfnXfer1bpp;
  663. GFNXFER *pgfnXfer4bpp;
  664. GFNXFER *pgfnXfer8bpp;
  665. GFNXFER *pgfnXferImage;
  666. GFNXFER *pgfnXferNative; //azn unused
  667. GFNMCPY *pgfnMaskCopyBlt;
  668. GFNPATR *pgfnPatRealize;
  669. GFNMONO *pgfnMonoOffset;
  670. GFNPOLY *pgfnFillPolygon;
  671. GFNLINE *pgfnDrawLine;
  672. GFNLINE *pgfnIntegerLine;
  673. GFNLINE *pgfnContinueLine;
  674. GFNINIS *pgfnInitStrips;
  675. GFNRSTS *pgfnResetStrips;
  676. GFNREPN *pgfnRepNibbles; //azn unused
  677. GFNUPLD *pgfnUpload;
  678. GFNCOPYD *pgfnCopyXferImage;
  679. GFNCOPYD *pgfnCopyXfer16bpp; //azn unused
  680. GFNCOPYD *pgfnCopyXfer24bpp;
  681. GFNXCOPYD *pgfnCopyXfer8bppLge;
  682. GFNXCOPYD *pgfnCopyXfer8bpp;
  683. GFNXCOPYD *pgfnCopyXfer4bpp;
  684. #if (_WIN32_WINNT >= 0x500)
  685. GFNGRADRECT *pgfnGradientFillRect;
  686. GFNTRANSBLT *pgfnTransparentBlt;
  687. GFNALPHABLT *pgfnAlphaBlend;
  688. #endif
  689. GAPFNstripFunc *gapfnStrip; // Line drawing functions
  690. // PXRX 2D stuff:
  691. SendPXRXdma sendPXRXdmaForce; // Will not return until the DMA has been started
  692. SendPXRXdma sendPXRXdmaQuery; // Will send if there is FIFO space
  693. SendPXRXdma sendPXRXdmaBatch; // Will only batch the data up
  694. SwitchPXRXdmaBuffer switchPXRXdmaBuffer;
  695. WaitPXRXdmaCompletedBuffer waitPXRXdmaCompletedBuffer;
  696. #if WNT_DDRAW
  697. void * thunkData; // Opaque pointer to DDRAWs global data
  698. LONG DDContextID; // DDRAW contextID
  699. LONG DDContextRefCount;
  700. DWORD oldIntEnableFlags; // Interrupt enable flags when DDRAW started
  701. #endif // WNT_DDRAW
  702. } PDEV, *PPDEV;
  703. // azn -take out???
  704. #define REMOVE_SWPOINTER(surface)
  705. /////////////////////////////////////////////////////////////////////////
  706. // Miscellaneous prototypes:
  707. BOOL bIntersect(RECTL*, RECTL*, RECTL*);
  708. LONG cIntersect(RECTL*, RECTL*, LONG);
  709. BOOL bFastFill(PDEV*, LONG, POINTFIX*, ULONG, ULONG, ULONG, RBRUSH*);
  710. DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION*, DWORD*);
  711. BOOL bInitializeModeFields(PDEV*, GDIINFO*, DEVINFO*, DEVMODEW*);
  712. BOOL bEnableHardware(PDEV*);
  713. VOID vDisableHardware(PDEV*);
  714. BOOL bAssertModeHardware(PDEV*, BOOL);
  715. /////////////////////////////////////////////////////////////////////////
  716. // The x86 C compiler insists on making a divide and modulus operation
  717. // into two DIVs, when it can in fact be done in one. So we use this
  718. // macro.
  719. //
  720. // Note: QUOTIENT_REMAINDER implicitly takes unsigned arguments.
  721. #if defined(i386)
  722. #define QUOTIENT_REMAINDER(ulNumerator, ulDenominator, ulQuotient, ulRemainder) \
  723. { \
  724. __asm mov eax, ulNumerator \
  725. __asm sub edx, edx \
  726. __asm div ulDenominator \
  727. __asm mov ulQuotient, eax \
  728. __asm mov ulRemainder, edx \
  729. }
  730. #else
  731. #define QUOTIENT_REMAINDER(ulNumerator, ulDenominator, ulQuotient, ulRemainder) \
  732. { \
  733. ulQuotient = (ULONG) ulNumerator / (ULONG) ulDenominator; \
  734. ulRemainder = (ULONG) ulNumerator % (ULONG) ulDenominator; \
  735. }
  736. #endif
  737. /////////////////////////////////////////////////////////////////////////
  738. // OVERLAP - Returns TRUE if the same-size lower-right exclusive
  739. // rectangles defined by 'pptl' and 'prcl' overlap:
  740. #define OVERLAP(prcl, pptl) \
  741. (((prcl)->right > (pptl)->x) && \
  742. ((prcl)->bottom > (pptl)->y) && \
  743. ((prcl)->left < ((pptl)->x + (prcl)->right - (prcl)->left)) && \
  744. ((prcl)->top < ((pptl)->y + (prcl)->bottom - (prcl)->top)))
  745. //
  746. // Work out the pixel offset for a DFB. We calculate this for Y only. Because
  747. // we have to support dual-screen on Permedia we need to subtract X from the
  748. // rasterised coordinates to prevent the rasteriser X registers from overflow.
  749. //
  750. #define POH_SET_RECTANGULAR_PIXEL_OFFSET(ppdev, poh) \
  751. { \
  752. (poh)->pixOffset = 0; \
  753. }
  754. //
  755. // Convert a pixel offset suitable for a render through the core into
  756. // an offset that can be used to access the frame buffer directly.
  757. // This is trivial when we don't have a Gamma Geo twin. We assume
  758. // that the value is a whole number of scan lines.
  759. //
  760. #define RENDER_PIXOFFSET_TO_FB_PIXOFFSET(pixoff) (pixoff)
  761. //////////////////////////////////////////////////////////////////////
  762. // Cache flag manipulation
  763. #define cFlagFBReadDefault 0x01 // Cache flag definitions
  764. #define cFlagLogicalOpDisabled 0x02
  765. #define cFlagConstantFBWrite 0x04
  766. #define cFlagScreenToScreenCopy 0x08
  767. //@@BEGIN_DDKSPLIT
  768. #define VERIFY_SETFLAGS 0
  769. #define VERIFY_CHECKFLAGS 0
  770. #if DBG && (VERIFY_SETFLAGS || VERIFY_CHECKFLAGS)
  771. // The following Macros are debug versions. They aren't included in the normal
  772. // debug build because they do a sync and, hence, slow things down.
  773. #if VERIFY_CHECKFLAGS
  774. extern void __CheckFlags(PDEV *p, ULONG x);
  775. #define CHECK_CACHEFLAGS(p,x) (__CheckFlags(p, (ULONG)x), (p)->cFlags & (x))
  776. #else
  777. #define CHECK_CACHEFLAGS(p,x)((p)->cFlags & (x)) // Cache flag macros
  778. #endif //VERIFY_CHECKFLAGS
  779. #if VERIFY_SETFLAGS
  780. #define SET_CACHEFLAGS(p,x) \
  781. { \
  782. ULONG lop, fbr, cFlags = (p)->cFlags = (x); \
  783. SYNC_WITH_GLINT; \
  784. READ_GLINT_FIFO_REG (__GlintTagLogicalOpMode, lop); \
  785. READ_GLINT_FIFO_REG (__GlintTagFBReadMode, fbr); \
  786. READ_GLINT_FIFO_REG (__GlintTagLogicalOpMode, lop); \
  787. ASSERTDD ((cFlags & cFlagFBReadDefault) == 0 || ((cFlags & cFlagFBReadDefault) && fbr == glintInfo->FBReadMode), \
  788. "SCF: Bad set fbread cache flag"); \
  789. /* ASSERTDD (((cFlags & cFlagFBReadDefault) == 0 && fbr != glintInfo->FBReadMode), */ \
  790. /* "SCF: Bad clear fbread cache flag"); */ \
  791. ASSERTDD ((cFlags & cFlagLogicalOpDisabled) == 0 || ((cFlags & cFlagLogicalOpDisabled) && (lop & 0x1) == 0x0), \
  792. "SCF: Bad set logicop cache flag"); \
  793. /* ASSERTDD (((cFlags & cFlagLogicalOpDisabled) == 0 && (lop & 0x1)), */ \
  794. /* "SCF: Bad clear logicop cache flag"); */ \
  795. ASSERTDD ((cFlags & cFlagConstantFBWrite) == 0 || ((cFlags & cFlagConstantFBWrite) && (lop & (1<<5))), \
  796. "SCF: Bad set const fbwrite cache flag"); \
  797. /* ASSERTDD (((cFlags & cFlagConstantFBWrite) == 0 && (lop & (1<<5)) == 0x0), */ \
  798. /* "SCF: Bad clear const fbwrite cache flag"); */ \
  799. }
  800. #else
  801. #define SET_CACHEFLAGS(p,x)((p)->cFlags = (x))
  802. #endif //VERIFY_SETFLAGS
  803. #define ADD_CACHEFLAGS(p,x) ((p)->cFlags |= (x))
  804. #else
  805. // Non-debug version of the cacheflags macros
  806. //@@END_DDKSPLIT
  807. #define CHECK_CACHEFLAGS(p,x)((p)->cFlags & (x)) // Cache flag macros
  808. #define SET_CACHEFLAGS(p,x)((p)->cFlags = (x))
  809. #define ADD_CACHEFLAGS(p,x) ((p)->cFlags |= (x))
  810. //@@BEGIN_DDKSPLIT
  811. #endif // DBG && 0
  812. //@@END_DDKSPLIT
  813. // These Dbg prototypes are thunks for debugging:
  814. VOID DbgDisableDriver(VOID);
  815. ULONG DbgGetModes(HANDLE, ULONG, DEVMODEW*);
  816. DHPDEV DbgEnablePDEV(DEVMODEW*, PWSTR, ULONG, HSURF*, ULONG, ULONG*,
  817. ULONG, DEVINFO*, HDEV, PWSTR, HANDLE);
  818. VOID DbgCompletePDEV(DHPDEV, HDEV);
  819. HSURF DbgEnableSurface(DHPDEV);
  820. BOOL DbgStrokePath(SURFOBJ*, PATHOBJ*, CLIPOBJ*, XFORMOBJ*, BRUSHOBJ*,
  821. POINTL*, LINEATTRS*, MIX);
  822. BOOL DbgLineTo(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, LONG, LONG, LONG,
  823. LONG, RECTL*, MIX);
  824. BOOL DbgFillPath(SURFOBJ*, PATHOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*,
  825. MIX, FLONG);
  826. BOOL DbgBitBlt(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*,
  827. RECTL*, POINTL*, POINTL*, BRUSHOBJ*, POINTL*, ROP4);
  828. VOID DbgDisablePDEV(DHPDEV);
  829. VOID DbgSynchronize(DHPDEV, RECTL*);
  830. VOID DbgDisableSurface(DHPDEV);
  831. BOOL DbgAssertMode(DHPDEV, BOOL);
  832. VOID DbgMovePointer(SURFOBJ*, LONG, LONG, RECTL*);
  833. ULONG DbgSetPointerShape(SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*, LONG,
  834. LONG, LONG, LONG, RECTL*, FLONG);
  835. ULONG DbgDitherColor(DHPDEV, ULONG, ULONG, ULONG*);
  836. BOOL DbgSetPalette(DHPDEV, PALOBJ*, FLONG, ULONG, ULONG);
  837. BOOL DbgCopyBits(SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*, RECTL*, POINTL*);
  838. BOOL DbgTextOut(SURFOBJ*, STROBJ*, FONTOBJ*, CLIPOBJ*, RECTL*, RECTL*,
  839. BRUSHOBJ*, BRUSHOBJ*, POINTL*, MIX);
  840. VOID DbgDestroyFont(FONTOBJ*);
  841. BOOL DbgPaint(SURFOBJ*, CLIPOBJ*, BRUSHOBJ*, POINTL*, MIX);
  842. BOOL DbgRealizeBrush(BRUSHOBJ*, SURFOBJ*, SURFOBJ*, SURFOBJ*, XLATEOBJ*,
  843. ULONG);
  844. HBITMAP DbgCreateDeviceBitmap(DHPDEV, SIZEL, ULONG);
  845. VOID DbgDeleteDeviceBitmap(DHSURF);
  846. BOOL DbgStretchBlt(SURFOBJ*, SURFOBJ*, SURFOBJ*, CLIPOBJ*, XLATEOBJ*,
  847. COLORADJUSTMENT*, POINTL*, RECTL*, RECTL*, POINTL*,
  848. ULONG);
  849. ULONG DbgDrawEscape(SURFOBJ *, ULONG, CLIPOBJ *, RECTL *, ULONG, VOID *);
  850. ULONG DbgEscape(SURFOBJ *, ULONG, ULONG, VOID *, ULONG, VOID *);
  851. BOOL DbgResetPDEV(DHPDEV, DHPDEV);
  852. #if WNT_DDRAW
  853. BOOL DbgGetDirectDrawInfo(DHPDEV, DD_HALINFO*, DWORD*, VIDEOMEMORY*,
  854. DWORD*, DWORD*);
  855. BOOL DbgEnableDirectDraw(DHPDEV, DD_CALLBACKS*, DD_SURFACECALLBACKS*,
  856. DD_PALETTECALLBACKS*);
  857. VOID DbgDisableDirectDraw(DHPDEV);
  858. #endif // WNT_DDRAW
  859. #if (_WIN32_WINNT >= 0x500)
  860. BOOL DbgIcmSetDeviceGammaRamp(DHPDEV dhpdev, ULONG iFormat, LPVOID lpRamp);
  861. BOOL DbgGradientFill(SURFOBJ *, CLIPOBJ *, XLATEOBJ *, TRIVERTEX *, ULONG, PVOID, ULONG, RECTL *,
  862. POINTL *, ULONG);
  863. BOOL DbgAlphaBlend(SURFOBJ *, SURFOBJ *, CLIPOBJ *, XLATEOBJ *, RECTL *, RECTL *, BLENDOBJ *);
  864. BOOL DbgTransparentBlt(SURFOBJ *, SURFOBJ *, CLIPOBJ *, XLATEOBJ *, RECTL *, RECTL *, ULONG, ULONG);
  865. VOID DbgNotify(IN SURFOBJ *, IN ULONG, IN PVOID);
  866. #endif