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.

1815 lines
53 KiB

  1. /******************************************************************************\
  2. *
  3. * $Workfile: pointer.c $
  4. *
  5. * Contains the pointer management functions.
  6. *
  7. * Copyright (c) 1992-1995 Microsoft Corporation
  8. * Copyright (c) 1996 Cirrus Logic, Inc.
  9. *
  10. * $Log: S:/projects/drivers/ntsrc/display/pointer.c_v $
  11. *
  12. * Rev 1.5 07 Apr 1997 11:38:16 PLCHU
  13. *
  14. *
  15. * Rev 1.4 Apr 03 1997 15:39:00 unknown
  16. *
  17. *
  18. * Rev 1.3 28 Mar 1997 16:09:20 PLCHU
  19. *
  20. *
  21. * Rev 1.2 12 Aug 1996 16:54:36 frido
  22. * Added NT 3.5x/4.0 auto detection.
  23. * Removed unaccessed local variables.
  24. *
  25. * Rev 1.1 08 Aug 1996 12:54:54 frido
  26. * bank#1 Removed banking in memory mapped I/O which is always linear.
  27. * bank#1 Removed banking in memory mapped I/O which is always linear.
  28. *
  29. * myf0 : 08-19-96 added 85hz supported
  30. * myf1 : 08-20-96 supported panning scrolling
  31. * myf2 : 08-20-96 : fixed hardware save/restore state bug for matterhorn
  32. * myf3 : 09-01-96 : Added IOCTL_CIRRUS_PRIVATE_BIOS_CALL for TV supported
  33. * myf4 : 09-01-96 : patch Viking BIOS bug, PDR #4287, begin
  34. * myf5 : 09-01-96 : Fixed PDR #4365 keep all default refresh rate
  35. * myf6 : 09-17-96 : Merged Desktop SRC1001 & MINI102
  36. * myf7 : 09-19-96 : Fixed exclude 60Hz refresh rate selected
  37. * myf8 :*09-21-96*: May be need change CheckandUpdateDDC2BMonitor --keystring[]
  38. * myf9 : 09-21-96 : 8x6 panel in 6x4x256 mode, cursor can't move to bottom scrn
  39. * ms0809:09-25-96 : fixed dstn panel icon corrupted
  40. * ms923 :09-25-96 : merge MS-923 Disp.zip code
  41. * myf10 :09-26-96 : Fixed DSTN reserved half-frame buffer bug.
  42. * myf11 :09-26-96 : Fixed 755x CE chip HW bug, access ramdac before disable HW
  43. * icons and cursor
  44. * myf12 :10-01-96 : Supported Hot Key switch display
  45. * myf13 :10-02-96 : Fixed Panning scrolling (1280x1024x256) bug y < ppdev->miny
  46. * myf14 :10-15-96 : Fixed PDR#6917, 6x4 panel can't panning scrolling for 754x
  47. * myf15 :10-16-96 : Fixed disable memory mapped IO for 754x, 755x
  48. * myf16 :10-22-96 : Fixed PDR #6933,panel type set different demo board setting
  49. * tao1 : 10-21-96 : Added 7555 flag for Direct Draw support.
  50. * smith :10-22-96 : Disable Timer event, because sometimes creat PAGE_FAULT or
  51. * IRQ level can't handle
  52. * myf17 :11-04-96 : Added special escape code must be use 11/5/96 later NTCTRL,
  53. * and added Matterhorn LF Device ID==0x4C
  54. * myf18 :11-04-96 : Fixed PDR #7075,
  55. * myf19 :11-06-96 : Fixed Vinking can't work problem, because DEVICEID = 0x30
  56. * is different from data book (CR27=0x2C)
  57. * pat04: 12-20-96 : Supported NT3.51 software cursor with panning scrolling
  58. * pat07: : Take care of disappearing hardware cursor during modeset
  59. * myf31 :02-24-97 : Fixed enable HW Video, panning scrolling enable,screen move
  60. * video window have follow moving
  61. * myf33 :03-06-97 : Fixed switch S/W cursor, have 2 cursor shape, PDR#8781,8804
  62. * myf32 :03-13-97 : Fixed panning screen moving strength problem, PDR#8873
  63. * pat08 :04-01-97 : Corrected SWcursor bugs due to code-merge. See also
  64. * PDR #8949 & #8910
  65. *
  66. \******************************************************************************/
  67. #include "precomp.h"
  68. //crus begin
  69. //myf17 #define PANNING_SCROLL //myf1
  70. #define LCD_type 1 //myf12
  71. #define CRT_type 2 //myf12
  72. #define SIM_type 3 //myf12
  73. #if (_WIN32_WINNT >= 0x0400)
  74. VOID PanOverlay7555 (PDEV *,LONG ,LONG); //myf33
  75. #endif
  76. //crus end
  77. ULONG SetMonoHwPointerShape(
  78. SURFOBJ *pso,
  79. SURFOBJ *psoMask,
  80. SURFOBJ *psoColor,
  81. XLATEOBJ *pxlo,
  82. LONG xHot,
  83. LONG yHot,
  84. LONG x,
  85. LONG y,
  86. RECTL *prcl,
  87. FLONG fl);
  88. VOID vSetPointerBits(
  89. PPDEV ppdev,
  90. LONG xAdj,
  91. LONG yAdj)
  92. {
  93. volatile PULONG pulXfer;
  94. volatile PULONG pul;
  95. //ms923 LONG lDelta = ppdev->lDeltaPointer;
  96. LONG lDelta = 4;
  97. BYTE ajAndMask[32][4];
  98. BYTE ajXorMask[32][4];
  99. BYTE ajHwPointer[256];
  100. PBYTE pjAndMask;
  101. PBYTE pjXorMask;
  102. LONG cx;
  103. LONG cy;
  104. LONG cxInBytes;
  105. LONG ix;
  106. LONG iy;
  107. LONG i;
  108. LONG j;
  109. #if BANKING //bank#1
  110. ppdev->pfnBankMap(ppdev, ppdev->lXferBank);
  111. #endif
  112. // Clear the buffers that will hold the shifted masks.
  113. DISPDBG((2,"vSetPointerBits\n "));
  114. memset(ajAndMask, 0xff, 128);
  115. memset(ajXorMask, 0, 128);
  116. cx = ppdev->sizlPointer.cx;
  117. cy = ppdev->sizlPointer.cy - yAdj;
  118. cxInBytes = cx / 8;
  119. // Copy the AND Mask into the shifted bits AND buffer.
  120. // Copy the XOR Mask into the shifted bits XOR buffer.
  121. yAdj *= lDelta;
  122. pjAndMask = (ppdev->pjPointerAndMask + yAdj);
  123. pjXorMask = (ppdev->pjPointerXorMask + yAdj);
  124. for (iy = 0; iy < cy; iy++)
  125. {
  126. // Copy over a line of the masks.
  127. for (ix = 0; ix < cxInBytes; ix++)
  128. {
  129. ajAndMask[iy][ix] = pjAndMask[ix];
  130. ajXorMask[iy][ix] = pjXorMask[ix];
  131. }
  132. // point to the next line of the masks.
  133. pjAndMask += lDelta;
  134. pjXorMask += lDelta;
  135. }
  136. // At this point, the pointer is guaranteed to be a single
  137. // dword wide.
  138. if (xAdj != 0)
  139. {
  140. ULONG ulAndFillBits;
  141. ULONG ulXorFillBits;
  142. ulXorFillBits = 0xffffffff << xAdj;
  143. ulAndFillBits = ~ulXorFillBits;
  144. //
  145. // Shift the pattern to the left (in place)
  146. //
  147. DISPDBG((2, "xAdj(%d)", xAdj));
  148. for (iy = 0; iy < cy; iy++)
  149. {
  150. ULONG ulTmpAnd = *((PULONG) (&ajAndMask[iy][0]));
  151. ULONG ulTmpXor = *((PULONG) (&ajXorMask[iy][0]));
  152. BSWAP(ulTmpAnd);
  153. BSWAP(ulTmpXor);
  154. ulTmpAnd <<= xAdj;
  155. ulTmpXor <<= xAdj;
  156. ulTmpAnd |= ulAndFillBits;
  157. ulTmpXor &= ulXorFillBits;
  158. BSWAP(ulTmpAnd);
  159. BSWAP(ulTmpXor);
  160. *((PULONG) (&ajAndMask[iy][0])) = ulTmpAnd;
  161. *((PULONG) (&ajXorMask[iy][0])) = ulTmpXor;
  162. }
  163. }
  164. //
  165. // Convert the masks to the hardware pointer format
  166. //
  167. i = 0; // AND mask
  168. j = 128; // XOR mask
  169. for (iy = 0; iy < 32; iy++)
  170. {
  171. for (ix = 0; ix < 4; ix++)
  172. {
  173. ajHwPointer[j++] = ~ajAndMask[iy][ix];
  174. ajHwPointer[i++] = ajXorMask[iy][ix];
  175. }
  176. }
  177. //
  178. // Download the pointer
  179. //
  180. if (ppdev->flCaps & CAPS_MM_IO)
  181. {
  182. BYTE * pjBase = ppdev->pjBase;
  183. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  184. CP_MM_DST_Y_OFFSET(ppdev, pjBase, 4);
  185. //pat04, begin
  186. //#if 0
  187. #if (_WIN32_WINNT < 0x0400)
  188. #ifdef PANNING_SCROLL
  189. if ((ppdev->ulChipID == CL7541_ID) || (ppdev->ulChipID == CL7543_ID) ||
  190. (ppdev->ulChipID == CL7542_ID) || (ppdev->ulChipID == CL7548_ID) ||
  191. (ppdev->ulChipID == CL7555_ID) || (ppdev->ulChipID == CL7556_ID))
  192. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  193. #endif
  194. #endif
  195. //#endif //0
  196. //pat04, end
  197. CP_MM_XCNT(ppdev, pjBase, (4 - 1));
  198. CP_MM_YCNT(ppdev, pjBase, (64 - 1));
  199. CP_MM_BLT_MODE(ppdev, pjBase, SRC_CPU_DATA);
  200. CP_MM_ROP(ppdev, pjBase, CL_SRC_COPY);
  201. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->cjPointerOffset);
  202. CP_MM_START_BLT(ppdev, pjBase);
  203. }
  204. else
  205. {
  206. BYTE * pjPorts = ppdev->pjPorts;
  207. #if BANKING //bank#1
  208. ppdev->pfnBankMap(ppdev, ppdev->lXferBank);
  209. #endif
  210. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  211. CP_IO_DST_Y_OFFSET(ppdev, pjPorts, 4);
  212. CP_IO_XCNT(ppdev, pjPorts, (4 - 1));
  213. CP_IO_YCNT(ppdev, pjPorts, (64 - 1));
  214. CP_IO_BLT_MODE(ppdev, pjPorts, SRC_CPU_DATA);
  215. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  216. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->cjPointerOffset);
  217. CP_IO_START_BLT(ppdev, pjPorts);
  218. }
  219. pulXfer = ppdev->pulXfer;
  220. pul = (PULONG) ajHwPointer;
  221. //
  222. // Disable the pointer (harmless if it already is)
  223. //
  224. for (i = 0; i < 64; i++)
  225. {
  226. CP_MEMORY_BARRIER();
  227. WRITE_REGISTER_ULONG(pulXfer, *pul); // [ALPHA - sparse]
  228. pulXfer++;
  229. pul++;
  230. //*pulXfer++ = *pul++;
  231. }
  232. CP_EIEIO();
  233. }
  234. //crus begin
  235. /***********************************************************\
  236. * CirrusPanning
  237. *
  238. * caculate x, y
  239. \************************************************************/
  240. //myf1, begin
  241. #ifdef PANNING_SCROLL
  242. VOID CirrusPanning(
  243. SURFOBJ* pso,
  244. LONG x,
  245. LONG y,
  246. RECTL* prcl)
  247. {
  248. PPDEV ppdev = (PPDEV) pso->dhpdev;
  249. PBYTE pjPorts = ppdev->pjPorts;
  250. UCHAR CR13, CR1B, CR1D, CR17;
  251. UCHAR Sflag = FALSE; //myf31
  252. ULONG Mem_addr;
  253. USHORT h_pitch, X_shift;
  254. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x13);
  255. CR13 = CP_IN_BYTE(pjPorts, CRTC_DATA);
  256. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x1B);
  257. CR1B = CP_IN_BYTE(pjPorts, CRTC_DATA);
  258. //myf32 : fixed PDR #8873, panning enable, move mouse across max_Yscreen,
  259. // screen moving is strength
  260. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x17); //myf32
  261. CR17 = CP_IN_BYTE(pjPorts, CRTC_DATA) & 0x40; //myf32
  262. h_pitch = (USHORT)((((CR1B & 0x10) << 4) + CR13)); //myf32
  263. // if (CR17 == 0)
  264. h_pitch <<= 1;
  265. if (ppdev->cBitsPerPixel == 8)
  266. X_shift = 2; // (div 4)
  267. else if (ppdev->cBitsPerPixel == 16)
  268. X_shift = 1; // (div 2)
  269. else if (ppdev->cBitsPerPixel == 24)
  270. X_shift = 4; // (div 16)
  271. else if (ppdev->cBitsPerPixel == 32)
  272. X_shift = 0; // (div 1)
  273. if ((y > ppdev->max_Yscreen))
  274. {
  275. Sflag = TRUE; //myf31
  276. ppdev->min_Yscreen = y - (ppdev->Vres - 1);
  277. ppdev->max_Yscreen = y;
  278. if (x < ppdev->min_Xscreen)
  279. {
  280. ppdev->min_Xscreen = x;
  281. ppdev->max_Xscreen = x + (ppdev->Hres - 1);
  282. }
  283. if (x > ppdev->max_Xscreen)
  284. {
  285. ppdev->min_Xscreen = x - (ppdev->Hres - 1);
  286. ppdev->max_Xscreen = x;
  287. }
  288. DISPDBG((4,"CURSOR DOWN : (%x, %x),\t %x, %x, %x, %x\n",
  289. x, y, ppdev->min_Xscreen, ppdev->max_Xscreen,
  290. ppdev->min_Yscreen, ppdev->max_Yscreen));
  291. }
  292. else if ((y < ppdev->min_Yscreen))
  293. {
  294. Sflag = TRUE; //myf31
  295. ppdev->min_Yscreen = y;
  296. //myf13 ppdev->max_Yscreen = (ppdev->Vres - 1) - y;
  297. ppdev->max_Yscreen = (ppdev->Vres - 1) + y; //myf13
  298. if (x < ppdev->min_Xscreen) //left
  299. {
  300. ppdev->min_Xscreen = x;
  301. ppdev->max_Xscreen = x + (ppdev->Hres - 1);
  302. }
  303. if (x > ppdev->max_Xscreen)
  304. {
  305. ppdev->min_Xscreen = x - (ppdev->Hres - 1);
  306. ppdev->max_Xscreen = x;
  307. }
  308. DISPDBG((4,"CURSOR DOWN : (%x, %x),\t %x, %x, %x, %x\n",
  309. x, y, ppdev->min_Xscreen, ppdev->max_Xscreen,
  310. ppdev->min_Yscreen, ppdev->max_Yscreen));
  311. }
  312. else if ((y >= ppdev->min_Yscreen) && (y <= ppdev->max_Yscreen))
  313. {
  314. if (x < ppdev->min_Xscreen)
  315. {
  316. ppdev->min_Xscreen = x;
  317. ppdev->max_Xscreen = x + (ppdev->Hres - 1);
  318. Sflag = TRUE; //myf31
  319. }
  320. if (x > ppdev->max_Xscreen)
  321. {
  322. ppdev->min_Xscreen = x - (ppdev->Hres - 1);
  323. ppdev->max_Xscreen = x;
  324. Sflag = TRUE; //myf31
  325. }
  326. }
  327. DISPDBG((4,"CURSOR DOWN : (%x, %x),\t %x, %x, %x, %x\n",
  328. x, y, ppdev->min_Xscreen, ppdev->max_Xscreen,
  329. ppdev->min_Yscreen, ppdev->max_Yscreen));
  330. if (ppdev->cBitsPerPixel == 24)
  331. {
  332. Mem_addr = ((ULONG)(h_pitch * ppdev->min_Yscreen)) +
  333. (((ULONG)(ppdev->min_Xscreen >> X_shift)) * 12);
  334. }
  335. else
  336. {
  337. Mem_addr = ((ULONG)(h_pitch * ppdev->min_Yscreen)) +
  338. (ULONG)(ppdev->min_Xscreen >> X_shift);
  339. }
  340. CR13 = (UCHAR)((Mem_addr >> 16) & 0x00FF);
  341. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x1D);
  342. CR1D = CP_IN_BYTE(pjPorts, CRTC_DATA) & 0x7F;
  343. CR1D |= ((CR13 << 4) & 0x80);
  344. CR1B &= 0xF2;
  345. CR13 &= 0x07;
  346. CR1B |= (CR13 & 0x01);
  347. CR1B |= ((CR13 << 1) & 0x0C);
  348. //myf32 for visibile bug, change the output reg sequence
  349. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x1B);
  350. CP_OUT_BYTE(pjPorts, CRTC_DATA, (UCHAR)(CR1B));
  351. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x1D);
  352. CP_OUT_BYTE(pjPorts, CRTC_DATA, (UCHAR)(CR1D));
  353. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x0C);
  354. CP_OUT_BYTE(pjPorts, CRTC_DATA, (UCHAR)(Mem_addr >> 8));
  355. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x0D);
  356. CP_OUT_BYTE(pjPorts, CRTC_DATA, (UCHAR)(Mem_addr & 0xFF));
  357. x -= ppdev->min_Xscreen;
  358. y -= ppdev->min_Yscreen;
  359. #if (_WIN32_WINNT >= 0x0400)
  360. if (Sflag) //myf31
  361. PanOverlay7555(ppdev,x,y); //myf31
  362. #endif
  363. }
  364. #endif //ifdef PANNING_SCROLL
  365. //myf1, end
  366. //crus end
  367. //pat04, begin
  368. // Set Color Pointer Bits
  369. //#if 0 //0, pat04
  370. #if (_WIN32_WINNT < 0x0400)
  371. #ifdef PANNING_SCROLL
  372. // #if ((ppdev->ulChipID == CL7541_ID) || (ppdev->ulChipID == CL7543_ID) ||
  373. // (ppdev->ulChipID == CL7542_ID) || (ppdev->ulChipID == CL7548_ID) ||
  374. // (ppdev->ulChipID == CL7555_ID) || (ppdev->ulChipID == CL7556_ID)) )
  375. VOID vSetCPointerBits(
  376. PPDEV ppdev,
  377. LONG xAdj,
  378. LONG yAdj)
  379. {
  380. volatile PULONG pulXfer;
  381. volatile PULONG pul;
  382. LONG lDelta = 4;
  383. BYTE ajAndMask[32][4];
  384. BYTE ajXorMask[32][4];
  385. BYTE ajHwPointer[256];
  386. PBYTE pjAndMask;
  387. PBYTE pjXorMask;
  388. LONG cx;
  389. LONG cy;
  390. LONG cxInBytes;
  391. LONG ix;
  392. LONG iy;
  393. LONG i;
  394. LONG j;
  395. BYTE * pjPorts = ppdev->pjPorts; //ppp
  396. // Clear the buffers that will hold the shifted masks.
  397. DISPDBG((2,"vSetCPointerBits\n "));
  398. memset(ajAndMask, 0xff, 128);
  399. cx = ppdev->sizlPointer.cx;
  400. cy = ppdev->sizlPointer.cy - yAdj;
  401. cxInBytes = cx / 8;
  402. // Copy the AND Mask into the shifted bits AND buffer.
  403. yAdj *= lDelta;
  404. pjAndMask = (ppdev->pjPointerAndMask + yAdj);
  405. pjXorMask = (ppdev->pjPointerXorMask + yAdj);
  406. for (iy = 0; iy < cy; iy++)
  407. {
  408. // Copy over a line of the masks.
  409. for (ix = 0; ix < cxInBytes; ix++)
  410. ajAndMask[iy][ix] = pjAndMask[ix];
  411. pjAndMask += lDelta;
  412. }
  413. // At this point, the pointer is guaranteed to be a single
  414. // dword wide.
  415. //
  416. // Convert the masks to the hardware pointer format
  417. //
  418. j = 0;
  419. for (iy = 0; iy < 32; iy++)
  420. {
  421. for (ix = 0; ix < 4; ix++)
  422. ajHwPointer[j++] = ~ajAndMask[iy][ix];
  423. }
  424. //
  425. // Download the pointer
  426. //
  427. if (ppdev->flCaps & CAPS_MM_IO) {
  428. BYTE * pjBase = ppdev->pjBase;
  429. // if !24bit. 24bit color expand requires 2 pass (for 7555)
  430. if (ppdev->cBpp != 3) {
  431. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  432. CP_MM_FG_COLOR(ppdev, pjBase, 0x00000000);
  433. CP_MM_BG_COLOR(ppdev, pjBase, 0xFFFFFFFF);
  434. CP_MM_DST_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  435. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  436. CP_MM_YCNT(ppdev, pjBase, 31);
  437. CP_MM_BLT_MODE(ppdev, pjBase, SRC_CPU_DATA | DIR_TBLR | ENABLE_COLOR_EXPAND | ppdev->jModeColor);
  438. CP_MM_ROP(ppdev, pjBase, CL_SRC_COPY);
  439. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjPointerAndCMask->xy);
  440. CP_MM_START_BLT(ppdev, pjBase);
  441. } // if (ppdev->cBpp != 3)
  442. else { // 24bit stuff
  443. // Save 1 pass, since we are generating monocrome masks.
  444. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  445. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  446. CP_MM_ROP(ppdev,pjBase, CL_WHITENESS);
  447. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  448. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  449. CP_MM_YCNT(ppdev, pjBase, 31);
  450. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjPointerAndCMask->xy);
  451. CP_MM_START_BLT(ppdev, pjBase);
  452. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  453. CP_MM_FG_COLOR(ppdev, pjBase, 0x00000000);
  454. CP_MM_BG_COLOR(ppdev, pjBase, 0xFFFFFFFF);
  455. CP_MM_DST_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  456. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  457. CP_MM_YCNT(ppdev, pjBase, 31);
  458. CP_MM_BLT_MODE(ppdev, pjBase, SRC_CPU_DATA | DIR_TBLR | ENABLE_COLOR_EXPAND | ppdev->jModeColor | ENABLE_TRANSPARENCY_COMPARE);
  459. CP_MM_ROP(ppdev, pjBase, CL_SRC_COPY);
  460. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjPointerAndCMask->xy);
  461. CP_MM_START_BLT(ppdev, pjBase);
  462. } // else
  463. pulXfer = ppdev->pulXfer;
  464. pul = (PULONG) ajHwPointer;
  465. for (i = 0; i < 32; i++)
  466. {
  467. CP_MEMORY_BARRIER();
  468. WRITE_REGISTER_ULONG(pulXfer, *pul);
  469. pulXfer++;
  470. pul++;
  471. }
  472. CP_EIEIO();
  473. } // if MMIO
  474. else { // IO stuff (754x stuff)
  475. // 7548 HW BUG ?
  476. // system->screen with color expand will sometimes cause
  477. // the system to hang. Break it into 2 pass, and the problem
  478. // went away
  479. ppdev->pfnBankMap(ppdev, ppdev->lXferBank);
  480. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  481. CP_IO_DST_Y_OFFSET(ppdev, pjPorts, 4);
  482. CP_IO_XCNT(ppdev, pjPorts, (4 - 1));
  483. CP_IO_YCNT(ppdev, pjPorts, (32 - 1));
  484. CP_IO_BLT_MODE(ppdev, pjPorts, SRC_CPU_DATA);
  485. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  486. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->cjPointerOffset);
  487. CP_IO_START_BLT(ppdev, pjPorts);
  488. pulXfer = ppdev->pulXfer;
  489. pul = (PULONG) ajHwPointer;
  490. for (i = 0; i < 32; i++) {
  491. CP_MEMORY_BARRIER();
  492. WRITE_REGISTER_ULONG(pulXfer, *pul); // [ALPHA - sparse]
  493. pulXfer++;
  494. pul++;
  495. }
  496. CP_EIEIO();
  497. // Color Expand monocrome data into x-y DBB.
  498. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  499. CP_IO_FG_COLOR(ppdev, pjPorts, 0x00000000);
  500. CP_IO_BG_COLOR(ppdev, pjPorts, 0xFFFFFFFF);
  501. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, 4); //
  502. CP_IO_DST_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine);
  503. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  504. CP_IO_YCNT(ppdev, pjPorts, 31);
  505. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  506. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR | ENABLE_COLOR_EXPAND | ppdev->jModeColor);
  507. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->cjPointerOffset);
  508. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->pjPointerAndCMask->xy);
  509. CP_IO_START_BLT(ppdev, pjPorts);
  510. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  511. } // else
  512. } // vSetCPointerBits( )
  513. #endif
  514. #endif
  515. //#endif //0
  516. //pat04, end
  517. /******************************Public*Routine******************************\
  518. * DrvMovePointer
  519. *
  520. * Move the HW pointer to a new location on the screen.
  521. \**************************************************************************/
  522. VOID DrvMovePointer(
  523. SURFOBJ* pso,
  524. LONG x,
  525. LONG y,
  526. RECTL* prcl)
  527. {
  528. PPDEV ppdev = (PPDEV) pso->dhpdev;
  529. PBYTE pjPorts = ppdev->pjPorts;
  530. FLONG fl;
  531. LONG xAdj = 0;
  532. LONG yAdj = 0;
  533. //crus
  534. LONG deltaX; //myf15
  535. LONG deltaY; //myf15
  536. //pat04, begin
  537. //#if 0
  538. #if (_WIN32_WINNT < 0x0400)
  539. #ifdef PANNING_SCROLL
  540. BYTE * pjBase = ppdev->pjBase;
  541. static specialcase = 0;
  542. LONG tmpaddress;
  543. LONG clipping ;
  544. LONG clippingy ;
  545. UCHAR ChipID;
  546. #endif
  547. #endif
  548. //#endif //0
  549. //pat04, end
  550. DISPDBG((4,"DrvMovePointer to (%d,%d)", x, y));
  551. //crus
  552. #if 0
  553. BYTE SR0A, SR14, savSEQidx; //myf12
  554. SHORT Displaytype; //myf12
  555. if (!(ppdev->bBlockSwitch)) //not block switch
  556. {
  557. savSEQidx = CP_IN_BYTE(pjPorts, SR_INDEX);
  558. CP_OUT_BYTE(pjPorts, SR_INDEX, 0x14);
  559. SR14 = CP_IN_BYTE(pjPorts, SR_DATA);
  560. CP_OUT_BYTE(pjPorts, SR_INDEX, (SR14 | 0x04));
  561. CP_OUT_BYTE(pjPorts, SR_INDEX, 0x09);
  562. SR0A = CP_IN_BYTE(pjPorts, SR_DATA);
  563. Displaytype = ((SR14 & 0x02) | (SR0A & 0x01));
  564. if (Displaytype == 0)
  565. Displaytype = LCD_type;
  566. else if (Displaytype == 1)
  567. Displaytype = CRT_type;
  568. else if (Displaytype == 3)
  569. Displaytype = SIM_type;
  570. if (ppdev->bDisplaytype != Displaytype)
  571. {
  572. ppdev->bDisplaytype = Displaytype;
  573. // SwitchDisplayDevice();
  574. /*
  575. savCRTidx = CP_IN_BYTE(pjPorts, CRTC_INDEX);
  576. if (ppdev->ulChipID & CL754x)
  577. {
  578. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x20);
  579. lcd = CP_IN_BYTE(pjPorts, CRTC_DATA);
  580. }
  581. else if (ppdev->ulChipID & CL755x)
  582. {
  583. CP_OUT_BYTE(pjPorts, CRTC_INDEX, 0x80);
  584. lcd = CP_IN_BYTE(pjPorts, CRTC_DATA);
  585. }
  586. CP_OUT_BYTE(pjPorts, CRTC_INDEX, savCRTidx);
  587. */
  588. }
  589. CP_OUT_BYTE(pjPorts, SR_INDEX, savSEQidx);
  590. }
  591. #endif
  592. //pat04, begin
  593. //#if 0 //0
  594. #if (_WIN32_WINNT < 0x0400)
  595. #ifdef PANNING_SCROLL
  596. //if ((ppdev->ulChipID == CL7541_ID) || (ppdev->ulChipID == CL7543_ID) ||
  597. // (ppdev->ulChipID == CL7542_ID) || (ppdev->ulChipID == CL7548_ID) ||
  598. // (ppdev->ulChipID == CL7555_ID) || (ppdev->ulChipID == CL7556_ID))
  599. if (ppdev->flCaps & CAPS_SW_POINTER) {
  600. y -= ppdev->yPointerHot;
  601. if (y < 0) y = 0;
  602. // Get Chip ID
  603. CP_OUT_BYTE(ppdev->pjPorts, CRTC_INDEX, 0x27);
  604. ChipID = (CP_IN_BYTE(ppdev->pjPorts, CRTC_DATA) & 0xFC) >> 2;
  605. // If x == -1 (invisible cursor)
  606. if (x < 0 ) {
  607. specialcase = 1;
  608. x = 0;
  609. y = 0;
  610. // if old coordinate is not negative ...
  611. if (ppdev->oldx >= 0) {
  612. if (ppdev->flCaps & CAPS_MM_IO) {
  613. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  614. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  615. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  616. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  617. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount );
  618. CP_MM_YCNT(ppdev, pjBase, 31);
  619. CP_MM_SRC_ADDR(ppdev, pjBase, ppdev->pjCBackground->xy);
  620. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ((ppdev->oldy * ppdev->cxScreen * ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  621. CP_MM_START_BLT(ppdev, pjBase);
  622. } // if (ppdev->flCaps & CAPS_MM_IO)
  623. else {
  624. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  625. CP_IO_BLT_MODE(ppdev,pjPorts, DIR_TBLR);
  626. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  627. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine );
  628. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  629. CP_IO_YCNT(ppdev, pjPorts, 31);
  630. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->pjCBackground->xy);
  631. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ((ppdev->oldy * ppdev->cxScreen * ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  632. CP_IO_START_BLT(ppdev, pjPorts);
  633. } // else
  634. }
  635. return;
  636. }
  637. x -= ppdev->xPointerHot;
  638. // cheap clipping ....
  639. if (x < 0) x = 0;
  640. clippingy = 31;
  641. if ((y + 32) > ppdev->cyScreen) {
  642. clippingy += (ppdev->cyScreen - y - 32);
  643. }
  644. clipping = 31;
  645. if ((x + 32) > ppdev->cxScreen)
  646. {
  647. clipping += (ppdev->cxScreen - x - 32); // negative value
  648. }
  649. clipping *= ppdev->cBpp;
  650. if (!specialcase) {
  651. if (ppdev->flCaps & CAPS_MM_IO) {
  652. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  653. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  654. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  655. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  656. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  657. CP_MM_YCNT(ppdev, pjBase, 31);
  658. CP_MM_SRC_ADDR(ppdev, pjBase, ppdev->pjCBackground->xy);
  659. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ((ppdev->oldy * ppdev->cxScreen * ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  660. CP_MM_START_BLT(ppdev, pjBase);
  661. }
  662. else {
  663. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  664. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  665. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  666. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine );
  667. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  668. CP_IO_YCNT(ppdev, pjPorts, 31);
  669. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->pjCBackground->xy);
  670. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ((ppdev->oldy * ppdev->cxScreen * ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  671. CP_IO_START_BLT(ppdev, pjPorts);
  672. } // else
  673. } // specialcase
  674. specialcase = 0; // no specialcase
  675. tmpaddress = (y * ppdev->cxScreen * ppdev->cBpp) + (x * ppdev->cBpp);
  676. ppdev->oldy = y;
  677. ppdev->oldx = x;
  678. if (ppdev->flCaps & CAPS_MM_IO) {
  679. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  680. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  681. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  682. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  683. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  684. CP_MM_YCNT(ppdev, pjBase, 31);
  685. CP_MM_SRC_ADDR(ppdev, pjBase, tmpaddress);
  686. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjCBackground->xy);
  687. CP_MM_START_BLT(ppdev, pjBase);
  688. } // MMIO
  689. else {
  690. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  691. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  692. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine );
  693. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  694. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  695. CP_IO_YCNT(ppdev, pjPorts, 31);
  696. CP_IO_SRC_ADDR(ppdev, pjPorts, tmpaddress);
  697. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->pjCBackground->xy);
  698. CP_IO_START_BLT(ppdev, pjPorts);
  699. }
  700. if (clipping > 0) {
  701. if (ppdev->flCaps & CAPS_MM_IO) {
  702. // And AND MASK
  703. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  704. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  705. CP_MM_XCNT(ppdev, pjBase, clipping );
  706. CP_MM_YCNT(ppdev, pjBase, clippingy );
  707. //CP_MM_YCNT(ppdev, pjBase, 31);
  708. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  709. CP_MM_ROP(ppdev, pjBase, CL_SRC_AND);
  710. CP_MM_SRC_ADDR(ppdev, pjBase, ppdev->pjPointerAndCMask->xy);
  711. CP_MM_DST_ADDR_ABS(ppdev, pjBase, tmpaddress );
  712. CP_MM_START_BLT(ppdev, pjBase);
  713. // OR COLOR MASK
  714. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  715. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  716. CP_MM_ROP(ppdev,pjBase, CL_SRC_PAINT);
  717. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  718. CP_MM_XCNT(ppdev, pjBase, clipping );
  719. CP_MM_YCNT(ppdev, pjBase, clippingy );
  720. //CP_MM_YCNT(ppdev, pjBase, 31);
  721. CP_MM_SRC_ADDR(ppdev, pjBase, ppdev->pjPointerCBitmap->xy);
  722. CP_MM_DST_ADDR_ABS(ppdev, pjBase, tmpaddress );
  723. CP_MM_START_BLT(ppdev, pjBase);
  724. }
  725. else {
  726. // AND AND MASK
  727. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  728. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine );
  729. CP_IO_XCNT(ppdev, pjPorts, clipping );
  730. CP_IO_YCNT(ppdev, pjPorts, clippingy);
  731. //CP_IO_YCNT(ppdev, pjPorts, 31);
  732. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  733. CP_IO_ROP(ppdev, pjPorts, CL_SRC_AND);
  734. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->pjPointerAndCMask->xy);
  735. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, tmpaddress );
  736. CP_IO_START_BLT(ppdev, pjPorts);
  737. // OR COLOR MASK
  738. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  739. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  740. CP_IO_ROP(ppdev, pjPorts, CL_SRC_PAINT);
  741. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine);
  742. CP_IO_XCNT(ppdev, pjPorts, clipping );
  743. CP_IO_YCNT(ppdev, pjPorts, clippingy);
  744. //CP_IO_YCNT(ppdev, pjPorts, 31);
  745. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->pjPointerCBitmap->xy);
  746. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, tmpaddress );
  747. CP_IO_START_BLT(ppdev, pjPorts);
  748. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  749. } // else
  750. } // if clipping
  751. // Bounding rectangle for software cursor
  752. prcl->left = x;
  753. prcl->right = x + 32;
  754. prcl->top = y;
  755. prcl->bottom = y + 32;
  756. if ((ppdev->ulChipID == 0x38) || (ppdev->ulChipID == 0x2C) ||
  757. (ppdev->ulChipID == 0x30) || (ppdev->ulChipID == 0x34) || //myf19
  758. (ppdev->ulChipID == 0x40) || (ppdev->ulChipID == 0x4C)) //myf17
  759. {
  760. CirrusPanning(pso, x, y, prcl);
  761. x -= ppdev->min_Xscreen;
  762. y -= ppdev->min_Yscreen;
  763. }
  764. return;
  765. }
  766. //} //if chipID == laptop chip
  767. #endif //PANNING_SCROLL
  768. #endif //_WIN32_WINNT < 0400
  769. //#endif //0
  770. //pat04, end
  771. //
  772. // If x is -1 then take down the cursor.
  773. //
  774. if (x == -1)
  775. {
  776. // Move the hardware pointer off-screen so that when it gets
  777. // turned back on, it won't flash in the old position:
  778. CP_PTR_DISABLE(ppdev, pjPorts);
  779. return;
  780. }
  781. //crus begin
  782. //myf1, begin
  783. #ifdef PANNING_SCROLL
  784. // if (ppdev->flCaps & CAPS_PANNING)
  785. if (y < 0)
  786. y = y + pso->sizlBitmap.cy;
  787. // DISPDBG((2,"DrvMovePointer to (%d,%d)", x, y));
  788. // else
  789. // y = -y;
  790. if ((ppdev->ulChipID == 0x38) || (ppdev->ulChipID == 0x2C) ||
  791. (ppdev->ulChipID == 0x30) || (ppdev->ulChipID == 0x34) || //myf19
  792. (ppdev->ulChipID == 0x40) || (ppdev->ulChipID == 0x4C)) //myf17
  793. {
  794. CirrusPanning(pso, x, y, prcl);
  795. x -= ppdev->min_Xscreen;
  796. y -= ppdev->min_Yscreen;
  797. }
  798. #endif //ifdef PANNING_SCROLL
  799. //myf1, end
  800. //crus end
  801. //myf33 begin
  802. #if (_WIN32_WINNT >= 0x0400)
  803. #ifdef PANNING_SCROLL
  804. // set CAPS_PANNING flag so must be check ppdev->flCaps flag,
  805. // disable display both shape(S/W & H/W)
  806. if (ppdev->flCaps & CAPS_SW_POINTER)
  807. {
  808. CP_PTR_DISABLE(ppdev, pjPorts);
  809. return;
  810. }
  811. #endif
  812. #endif
  813. //myf33 end
  814. // Adjust the actual pointer position depending upon
  815. // the hot spot.
  816. x -= ppdev->xPointerHot;
  817. y -= ppdev->yPointerHot;
  818. fl = 0;
  819. if (x < 0)
  820. {
  821. xAdj = -x;
  822. x = 0;
  823. fl |= POINTER_X_SHIFT;
  824. }
  825. if (y < 0)
  826. {
  827. yAdj = -y;
  828. y = 0;
  829. fl |= POINTER_Y_SHIFT;
  830. }
  831. if ((fl == 0) && (ppdev->flPointer & (POINTER_Y_SHIFT | POINTER_X_SHIFT)))
  832. {
  833. fl |= POINTER_SHAPE_RESET;
  834. }
  835. CP_PTR_XY_POS(ppdev, pjPorts, x, y);
  836. if (fl != 0)
  837. {
  838. vSetPointerBits(ppdev, xAdj, yAdj);
  839. }
  840. CP_PTR_ENABLE(ppdev, pjPorts);
  841. // record the flags.
  842. ppdev->flPointer = fl;
  843. return;
  844. }
  845. #if (_WIN32_WINNT < 0x0400) //pat04
  846. //if ((ppdev->ulChipID == CL7541_ID) || (ppdev->ulChipID == CL7543_ID) ||
  847. // (ppdev->ulChipID == CL7542_ID) || (ppdev->ulChipID == CL7548_ID) ||
  848. // (ppdev->ulChipID == CL7555_ID) || (ppdev->ulChipID == CL7556_ID))
  849. /******************************Public*Routine******************************\
  850. * DrvSetPointerShape
  851. *
  852. * Sets the new pointer shape.
  853. \**************************************************************************/
  854. ULONG DrvSetPointerShape(
  855. SURFOBJ *pso,
  856. SURFOBJ *psoMask,
  857. SURFOBJ *psoColor,
  858. XLATEOBJ *pxlo,
  859. LONG xHot,
  860. LONG yHot,
  861. LONG x,
  862. LONG y,
  863. RECTL *prcl,
  864. FLONG fl)
  865. {
  866. PPDEV ppdev = (PPDEV) pso->dhpdev;
  867. PBYTE pjPorts = ppdev->pjPorts;
  868. ULONG ulRet = SPS_DECLINE;
  869. LONG cx;
  870. LONG cy;
  871. BYTE * pjBase = ppdev->pjBase;
  872. static poh = 0;
  873. volatile PULONG pul;
  874. ULONG counter = 0;
  875. DSURF* pdsurfColor; //myf32
  876. DISPDBG((2,"DrvSetPointerShape : (%x, %x)---%x\n", x, y,ppdev->flCaps));
  877. // Is the cursor a color cursor ?
  878. #ifdef PANNING_SCROLL
  879. if (psoColor != NULL) {
  880. // Let GDI handle color cursor at these resolutions
  881. if ((ppdev->cxScreen == 640) ||
  882. ((ppdev->cxScreen == 800) & (ppdev->cBpp == 3)) ) {
  883. // CP_PTR_DISABLE(ppdev, pjPorts);
  884. // goto ReturnStatus;
  885. goto DisablePointer; //myf33
  886. }
  887. // if the 3 permenent spaces cannot be allocated ...
  888. if ( (ppdev->pjPointerAndCMask == NULL) || (ppdev->pjCBackground == NULL)
  889. || (ppdev->pjPointerCBitmap == NULL) ) {
  890. // CP_PTR_DISABLE(ppdev, pjPorts);
  891. // goto ReturnStatus;
  892. goto DisablePointer; //myf33
  893. }
  894. ppdev->xPointerHot = xHot;
  895. ppdev->yPointerHot = yHot;
  896. ppdev->ppScanLine = ppdev->cxScreen * ppdev->cBpp;
  897. ppdev->xcount = 31 * ppdev->cBpp;
  898. if (!(ppdev->flCaps & CAPS_SW_POINTER)) {
  899. ppdev->flCaps |= CAPS_SW_POINTER; //myfxx
  900. CP_PTR_DISABLE(ppdev, pjPorts);
  901. }
  902. // specialcase to init for first time
  903. if ((poh == 0) || (ppdev->globdat == 0)) {
  904. // if (poh == 0) {
  905. if (x >= 0) {
  906. poh = 0;
  907. ppdev->oldx = x;
  908. ppdev->oldy = y;
  909. ppdev->globdat = 1;
  910. // Save background in xy DBB format
  911. if (ppdev->flCaps & CAPS_MM_IO) {
  912. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  913. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  914. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  915. CP_MM_DST_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  916. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  917. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  918. CP_MM_YCNT(ppdev, pjBase, 31);
  919. CP_MM_SRC_ADDR(ppdev, pjBase, ((y * ppdev->cxScreen * ppdev->cBpp) + (x * ppdev->cBpp)) );
  920. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjCBackground->xy);
  921. CP_MM_START_BLT(ppdev, pjBase);
  922. } // if MMIO
  923. else {
  924. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  925. CP_IO_FG_COLOR(ppdev, pjPorts, 0);
  926. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  927. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine);
  928. CP_IO_DST_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine);
  929. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  930. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  931. CP_IO_YCNT(ppdev, pjPorts, 31);
  932. CP_IO_SRC_ADDR(ppdev, pjPorts, ((y * ppdev->cxScreen * ppdev->cBpp) + (x * ppdev->cBpp)) );
  933. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->pjCBackground->xy);
  934. CP_IO_START_BLT(ppdev, pjPorts);
  935. } // ELSE
  936. }
  937. } // if poh == 0
  938. SetMonoHwPointerShape(pso, psoMask, psoColor, pxlo,
  939. xHot, yHot, x, y, prcl, fl);
  940. //myf32 added
  941. pdsurfColor = (DSURF*)psoColor->dhsurf;
  942. // if color bitmap resides in system memory, bring it into offscreen
  943. if ((pdsurfColor != NULL) && (pdsurfColor->poh->ofl == 0)) {
  944. bMoveDibToOffscreenDfbIfRoom(ppdev, pdsurfColor);
  945. } // OH resides as DIB
  946. //myf32 end
  947. // Get the color bitmap and save it, since it will be destroyed later
  948. if (ppdev->flCaps & CAPS_MM_IO) {
  949. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  950. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  951. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine);
  952. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  953. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  954. CP_MM_YCNT(ppdev, pjBase, 31);
  955. CP_MM_SRC_ADDR(ppdev, pjBase, ((DSURF *) (psoColor->dhsurf))->poh->xy);
  956. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ppdev->pjPointerCBitmap->xy);
  957. CP_MM_START_BLT(ppdev, pjBase);
  958. } // if MMIO
  959. else {
  960. // if no space in offscreen, and color bitmap still resides in
  961. // system memory, then blt directly to the preallocated
  962. // permanent buffer
  963. //myf32 if ( ((DSURF *) (psoColor->dhsurf))->poh->ofl != 0) {
  964. if ((pdsurfColor != NULL) && (pdsurfColor->poh->ofl != 0)) {
  965. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  966. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  967. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine);
  968. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  969. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  970. CP_IO_YCNT(ppdev, pjPorts, 31);
  971. CP_IO_SRC_ADDR(ppdev, pjPorts, ((DSURF *) (psoColor->dhsurf))->poh->xy);
  972. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ppdev->pjPointerCBitmap->xy);
  973. CP_IO_START_BLT(ppdev, pjPorts);
  974. }
  975. else { // not enough offscreen memory. so directly blt to video
  976. RECTL rclDst;
  977. POINTL ptlSrc;
  978. rclDst.left = ppdev->pjPointerCBitmap->x;
  979. rclDst.top = ppdev->pjPointerCBitmap->y;
  980. rclDst.right = rclDst.left + ppdev->xcount;
  981. rclDst.bottom = rclDst.top + 32;
  982. ptlSrc.x = 0;
  983. ptlSrc.y = 0;
  984. ppdev->pfnPutBits(ppdev, ((DSURF *) (psoColor->dhsurf))->pso, &rclDst, &ptlSrc);
  985. }
  986. } // else
  987. prcl->left = x;
  988. prcl->right = x + 32;
  989. prcl->top = y;
  990. prcl->bottom = y + 32;
  991. DrvMovePointer(pso, x, y, NULL);
  992. if (poh == 0) {
  993. poh = 1;
  994. vAssertModeBrushCache(ppdev, TRUE);
  995. }
  996. ulRet = SPS_ACCEPT_EXCLUDE;
  997. // HW BUG ....
  998. //
  999. // hardware (bootup) -> hardware -> software will mess the brush
  1000. // cache. Something to do with the BLTer. Marked off all the system
  1001. // -> video BLTS (in vSetCPointer()), but problem still exists.
  1002. // so I just restore them back. Only happens during bootup ...
  1003. goto ReturnStatus;
  1004. };
  1005. if ((ppdev->flCaps & CAPS_SW_POINTER) && (ppdev->cxScreen == 640)) {
  1006. goto ReturnStatus;
  1007. }; //ppp //if monocrome + software pointer
  1008. if (ppdev->flCaps & CAPS_SW_POINTER)
  1009. {
  1010. ppdev->flCaps &= ~CAPS_SW_POINTER;
  1011. ppdev->globdat = 0;
  1012. // repaint stuff back on screen !
  1013. if (ppdev->flCaps & CAPS_MM_IO)
  1014. {
  1015. CP_MM_WAIT_FOR_BLT_COMPLETE(ppdev, pjBase);
  1016. CP_MM_BLT_MODE(ppdev,pjBase, DIR_TBLR);
  1017. CP_MM_ROP(ppdev,pjBase, CL_SRC_COPY);
  1018. CP_MM_SRC_Y_OFFSET(ppdev, pjBase, ppdev->ppScanLine );
  1019. CP_MM_XCNT(ppdev, pjBase, ppdev->xcount);
  1020. CP_MM_YCNT(ppdev, pjBase, 31);
  1021. CP_MM_SRC_ADDR(ppdev, pjBase, ppdev->pjCBackground->xy);
  1022. CP_MM_DST_ADDR_ABS(ppdev, pjBase, ((ppdev->oldy * ppdev->cxScreen *
  1023. ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  1024. CP_MM_START_BLT(ppdev, pjBase);
  1025. }
  1026. else {
  1027. CP_IO_WAIT_FOR_BLT_COMPLETE(ppdev, pjPorts);
  1028. CP_IO_BLT_MODE(ppdev, pjPorts, DIR_TBLR);
  1029. CP_IO_ROP(ppdev, pjPorts, CL_SRC_COPY);
  1030. CP_IO_SRC_Y_OFFSET(ppdev, pjPorts, ppdev->ppScanLine );
  1031. CP_IO_XCNT(ppdev, pjPorts, ppdev->xcount);
  1032. CP_IO_YCNT(ppdev, pjPorts, 31);
  1033. CP_IO_SRC_ADDR(ppdev, pjPorts, ppdev->pjCBackground->xy);
  1034. CP_IO_DST_ADDR_ABS(ppdev, pjPorts, ((ppdev->oldy * ppdev->cxScreen *
  1035. ppdev->cBpp) + (ppdev->oldx * ppdev->cBpp)) );
  1036. CP_IO_START_BLT(ppdev, pjPorts);
  1037. } // else
  1038. // #pat07
  1039. bEnablePointer(ppdev); // #pat07
  1040. CP_PTR_ENABLE(ppdev, pjPorts); // #pat07
  1041. }
  1042. #endif
  1043. cx = psoMask->sizlBitmap.cx;
  1044. cy = psoMask->sizlBitmap.cy / 2;
  1045. DISPDBG((2,"DrvSetPtrShape %dx%d at (%d,%d), flags: %x, psoColor: %x",
  1046. cx, cy, x, y, fl, psoColor)); //4
  1047. if ((cx > 32) ||
  1048. (cy > 32) ||
  1049. (psoColor != NULL))
  1050. {
  1051. //
  1052. // We only handle monochrome pointers that are 32x32 or less
  1053. //
  1054. goto DisablePointer;
  1055. }
  1056. #if 0 //bank#1
  1057. ppdev->pfnBankMap(ppdev, ppdev->lXferBank);
  1058. #endif
  1059. //
  1060. // Save the hot spot and dimensions of the cursor in the PDEV
  1061. //
  1062. ppdev->xPointerHot = xHot;
  1063. ppdev->yPointerHot = yHot;
  1064. ulRet = SetMonoHwPointerShape(pso, psoMask, psoColor, pxlo,
  1065. xHot, yHot, x, y, prcl, fl);
  1066. if (ulRet != SPS_DECLINE)
  1067. {
  1068. goto ReturnStatus;
  1069. }
  1070. DisablePointer:
  1071. CP_PTR_DISABLE(ppdev, pjPorts);
  1072. ReturnStatus:
  1073. return (ulRet);
  1074. }
  1075. #else //pat04
  1076. /******************************Public*Routine******************************\
  1077. * DrvSetPointerShape
  1078. *
  1079. * Sets the new pointer shape.
  1080. \**************************************************************************/
  1081. ULONG DrvSetPointerShape(
  1082. SURFOBJ *pso,
  1083. SURFOBJ *psoMask,
  1084. SURFOBJ *psoColor,
  1085. XLATEOBJ *pxlo,
  1086. LONG xHot,
  1087. LONG yHot,
  1088. LONG x,
  1089. LONG y,
  1090. RECTL *prcl,
  1091. FLONG fl)
  1092. {
  1093. PPDEV ppdev = (PPDEV) pso->dhpdev;
  1094. PBYTE pjPorts = ppdev->pjPorts;
  1095. ULONG ulRet = SPS_DECLINE;
  1096. LONG cx;
  1097. LONG cy;
  1098. DISPDBG((2,"DrvSetPointerShape : (%x, %x)\n", x, y));
  1099. if (ppdev->flCaps & CAPS_SW_POINTER)
  1100. {
  1101. goto DisablePointer; //myf33
  1102. // goto ReturnStatus;
  1103. }
  1104. cx = psoMask->sizlBitmap.cx;
  1105. cy = psoMask->sizlBitmap.cy / 2;
  1106. DISPDBG((2,"DrvSetPtrShape %dx%d at (%d,%d), flags: %x, psoColor: %x",
  1107. cx, cy, x, y, fl, psoColor)); //4
  1108. if ((cx > 32) ||
  1109. (cy > 32) ||
  1110. (psoColor != NULL))
  1111. {
  1112. //
  1113. // We only handle monochrome pointers that are 32x32 or less
  1114. //
  1115. ppdev->flCaps |= CAPS_SW_POINTER; //myf33,
  1116. DISPDBG((2, "It is a 64 x 64 cursor"));
  1117. goto DisablePointer;
  1118. }
  1119. #if BANKING //bank#1
  1120. ppdev->pfnBankMap(ppdev, ppdev->lXferBank);
  1121. #endif
  1122. //
  1123. // Save the hot spot and dimensions of the cursor in the PDEV
  1124. //
  1125. ppdev->xPointerHot = xHot;
  1126. ppdev->yPointerHot = yHot;
  1127. ulRet = SetMonoHwPointerShape(pso, psoMask, psoColor, pxlo,
  1128. xHot, yHot, x, y, prcl, fl);
  1129. if (ulRet != SPS_DECLINE)
  1130. {
  1131. goto ReturnStatus;
  1132. }
  1133. DisablePointer:
  1134. CP_PTR_DISABLE(ppdev, pjPorts);
  1135. ReturnStatus:
  1136. return (ulRet);
  1137. }
  1138. #endif //pat04
  1139. /****************************************************************************\
  1140. * SetMonoHwPointerShape
  1141. *
  1142. * Truth Table
  1143. *
  1144. * MS Cirrus
  1145. * ----|---- ----|----
  1146. * AND | XOR P0 | P1
  1147. * 0 | 0 Black 0 | 1
  1148. * 0 | 1 White 1 | 1
  1149. * 1 | 0 Transparent 0 | 0
  1150. * 1 | 1 Inverse 1 | 0
  1151. *
  1152. * So, in order to translate from the MS convention to the Cirrus convention
  1153. * we had to invert the AND mask, then down load the XOR as plane 0 and the
  1154. * the AND mask as plane 1.
  1155. \****************************************************************************/
  1156. ULONG SetMonoHwPointerShape(
  1157. SURFOBJ *pso,
  1158. SURFOBJ *psoMask,
  1159. SURFOBJ *psoColor,
  1160. XLATEOBJ *pxlo,
  1161. LONG xHot,
  1162. LONG yHot,
  1163. LONG x,
  1164. LONG y,
  1165. RECTL *prcl,
  1166. FLONG fl)
  1167. {
  1168. INT i,
  1169. j,
  1170. cxMask,
  1171. cyMask,
  1172. cy,
  1173. cx;
  1174. PBYTE pjAND,
  1175. pjXOR;
  1176. INT lDelta;
  1177. PPDEV ppdev = (PPDEV) pso->dhpdev;
  1178. PBYTE pjPorts = ppdev->pjPorts;
  1179. PBYTE pjAndMask;
  1180. PBYTE pjXorMask;
  1181. // Init the AND and XOR masks, for the cirrus chip
  1182. DISPDBG((2,"SetMonoHWPointerShape\n "));
  1183. pjAndMask = ppdev->pjPointerAndMask;
  1184. pjXorMask = ppdev->pjPointerXorMask;
  1185. memset (pjAndMask, 0, 128);
  1186. memset (pjXorMask, 0, 128);
  1187. // Get the bitmap dimensions.
  1188. cxMask = psoMask->sizlBitmap.cx;
  1189. cyMask = psoMask->sizlBitmap.cy;
  1190. cy = cyMask / 2;
  1191. cx = cxMask / 8;
  1192. // Set up pointers to the AND and XOR masks.
  1193. lDelta = psoMask->lDelta;
  1194. pjAND = psoMask->pvScan0;
  1195. pjXOR = pjAND + (cy * lDelta);
  1196. //ms923 ppdev->lDeltaPointer = lDelta;
  1197. ppdev->sizlPointer.cx = cxMask;
  1198. ppdev->sizlPointer.cy = cyMask / 2;
  1199. // Copy the masks
  1200. for (i = 0; i < cy; i++)
  1201. {
  1202. for (j = 0; j < cx; j++)
  1203. {
  1204. pjAndMask[(i*4)+j] = pjAND[j];
  1205. pjXorMask[(i*4)+j] = pjXOR[j];
  1206. }
  1207. // point to the next line of the AND mask.
  1208. pjAND += lDelta;
  1209. pjXOR += lDelta;
  1210. }
  1211. //pat04, begin
  1212. //#if 0 //0
  1213. #if (_WIN32_WINNT < 0x0400)
  1214. #ifdef PANNING_SCROLL
  1215. if (psoColor != NULL) {
  1216. vSetCPointerBits(ppdev, 0, 0);
  1217. return (SPS_ACCEPT_EXCLUDE); //ppp
  1218. }
  1219. #endif
  1220. #endif
  1221. //#endif //0
  1222. //pat04, end
  1223. vSetPointerBits(ppdev, 0, 0);
  1224. // The previous call left the pointer disabled (at our request). If we
  1225. // were told to disable the pointer, then set the flag and exit.
  1226. // Otherwise, turn it back on.
  1227. if (x != -1)
  1228. {
  1229. CP_PTR_ENABLE(ppdev, pjPorts);
  1230. DrvMovePointer(pso, x, y, NULL);
  1231. }
  1232. else
  1233. {
  1234. CP_PTR_DISABLE(ppdev, pjPorts);
  1235. }
  1236. return (SPS_ACCEPT_NOEXCLUDE);
  1237. }
  1238. /******************************Public*Routine******************************\
  1239. * VOID vDisablePointer
  1240. *
  1241. \**************************************************************************/
  1242. VOID vDisablePointer(
  1243. PDEV* ppdev)
  1244. {
  1245. DISPDBG((2,"vDisablePointer\n "));
  1246. FREE(ppdev->pjPointerAndMask);
  1247. FREE(ppdev->pjPointerXorMask);
  1248. }
  1249. //crus begin
  1250. //myf11, begin fixed M1 H/W bug
  1251. /******************************Public*Routine******************************\
  1252. * BOOL vAsserthwiconcurorsor
  1253. *
  1254. \**************************************************************************/
  1255. VOID vAssertHWiconcursor(
  1256. PDEV* ppdev,
  1257. BOOL Access_flag)
  1258. {
  1259. PBYTE pjPorts = ppdev->pjPorts;
  1260. UCHAR savSEQidx;
  1261. savSEQidx = CP_IN_BYTE(pjPorts, SR_INDEX);
  1262. if (Access_flag) //enable HW cursor, icons
  1263. {
  1264. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X12);
  1265. CP_OUT_BYTE(pjPorts, SR_DATA, HWcur);
  1266. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2A);
  1267. CP_OUT_BYTE(pjPorts, SR_DATA, HWicon0);
  1268. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2B);
  1269. CP_OUT_BYTE(pjPorts, SR_DATA, HWicon1);
  1270. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2C);
  1271. CP_OUT_BYTE(pjPorts, SR_DATA, HWicon2);
  1272. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2D);
  1273. CP_OUT_BYTE(pjPorts, SR_DATA, HWicon3);
  1274. }
  1275. else //disable HW cursor, icons
  1276. {
  1277. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X12);
  1278. HWcur = CP_IN_BYTE(pjPorts, SR_DATA);
  1279. CP_OUT_BYTE(pjPorts, SR_DATA, (HWcur & 0xFE));
  1280. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2A);
  1281. HWicon0 = CP_IN_BYTE(pjPorts, SR_DATA);
  1282. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon0 & 0xFE));
  1283. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2B);
  1284. HWicon1 = CP_IN_BYTE(pjPorts, SR_DATA);
  1285. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon1 & 0xFE));
  1286. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2C);
  1287. HWicon2 = CP_IN_BYTE(pjPorts, SR_DATA);
  1288. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon2 & 0xFE));
  1289. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2D);
  1290. HWicon3 = CP_IN_BYTE(pjPorts, SR_DATA);
  1291. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon3 & 0xFE));
  1292. }
  1293. CP_OUT_BYTE(pjPorts, SR_INDEX, savSEQidx);
  1294. }
  1295. //myf11, end
  1296. //crus end
  1297. /******************************Public*Routine******************************\
  1298. * VOID vAssertModePointer
  1299. *
  1300. \**************************************************************************/
  1301. VOID vAssertModePointer(
  1302. PDEV* ppdev,
  1303. BOOL bEnable)
  1304. {
  1305. PBYTE pjPorts = ppdev->pjPorts;
  1306. //crus
  1307. UCHAR savSEQidx; //myf11
  1308. DISPDBG((2,"vAssertModePointer\n"));
  1309. if (DRIVER_PUNT_ALL ||
  1310. DRIVER_PUNT_PTR ||
  1311. (ppdev->pulXfer == NULL) ||
  1312. (ppdev->pjPointerAndMask == NULL) ||
  1313. (ppdev->pjPointerXorMask == NULL))
  1314. {
  1315. //
  1316. // Force SW cursor
  1317. //
  1318. ppdev->flCaps |= CAPS_SW_POINTER;
  1319. }
  1320. if (ppdev->flCaps & CAPS_SW_POINTER)
  1321. {
  1322. goto Leave;
  1323. }
  1324. if (bEnable)
  1325. {
  1326. BYTE jSavedDac_0_0;
  1327. BYTE jSavedDac_0_1;
  1328. BYTE jSavedDac_0_2;
  1329. BYTE jSavedDac_F_0;
  1330. BYTE jSavedDac_F_1;
  1331. BYTE jSavedDac_F_2;
  1332. // Enable access to the extended DAC colors.
  1333. //crus
  1334. // vAsserthwiconcursor(ppdev, 0); //myf11
  1335. /* {
  1336. savSEQidx = CP_IN_BYTE(pjPorts, SR_INDEX);
  1337. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X12);
  1338. HWcur = CP_IN_BYTE(pjPorts, SR_DATA);
  1339. CP_OUT_BYTE(pjPorts, SR_DATA, (HWcur & 0xFE));
  1340. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2A);
  1341. HWicon0 = CP_IN_BYTE(pjPorts, SR_DATA);
  1342. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon0 & 0xFE));
  1343. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2B);
  1344. HWicon1 = CP_IN_BYTE(pjPorts, SR_DATA);
  1345. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon1 & 0xFE));
  1346. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2C);
  1347. HWicon2 = CP_IN_BYTE(pjPorts, SR_DATA);
  1348. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon2 & 0xFE));
  1349. CP_OUT_BYTE(pjPorts, SR_INDEX, 0X2D);
  1350. HWicon3 = CP_IN_BYTE(pjPorts, SR_DATA);
  1351. CP_OUT_BYTE(pjPorts, SR_DATA, (HWicon3 & 0xFE));
  1352. CP_OUT_BYTE(pjPorts, SR_INDEX, savSEQidx);
  1353. }
  1354. */
  1355. CP_PTR_SET_FLAGS(ppdev, pjPorts, 0);
  1356. CP_OUT_BYTE(pjPorts, DAC_PEL_READ_ADDR, 0);
  1357. jSavedDac_0_0 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1358. jSavedDac_0_1 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1359. jSavedDac_0_2 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1360. CP_OUT_BYTE(pjPorts, DAC_PEL_READ_ADDR, 0xf);
  1361. jSavedDac_F_0 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1362. jSavedDac_F_1 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1363. jSavedDac_F_2 = CP_IN_BYTE(pjPorts, DAC_PEL_DATA);
  1364. //
  1365. // The following code maps DAC locations 256 and 257 to locations
  1366. // 0 and 15 respectively, and then initializes them. They are
  1367. // used by the cursor.
  1368. //
  1369. CP_PTR_SET_FLAGS(ppdev, pjPorts, ALLOW_DAC_ACCESS_TO_EXT_COLORS);
  1370. CP_OUT_BYTE(pjPorts, DAC_PEL_WRITE_ADDR, 0);
  1371. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0);
  1372. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0);
  1373. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0);
  1374. CP_OUT_BYTE(pjPorts, DAC_PEL_WRITE_ADDR, 0xf);
  1375. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0xff);
  1376. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0xff);
  1377. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, 0xff);
  1378. // Disable access to the extended DAC registers.
  1379. // We are using a 32 X 32 pointer in last position in video memory.
  1380. CP_PTR_SET_FLAGS(ppdev, pjPorts, 0);
  1381. //
  1382. // The following code restores the data at DAC locations 0 and 15
  1383. // because it looks like the previous writes destroyed them.
  1384. // That is a bug in the chip.
  1385. //
  1386. CP_OUT_BYTE(pjPorts, DAC_PEL_WRITE_ADDR, 0);
  1387. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_0_0);
  1388. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_0_1);
  1389. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_0_2);
  1390. CP_OUT_BYTE(pjPorts, DAC_PEL_WRITE_ADDR, 0xf);
  1391. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_F_0);
  1392. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_F_1);
  1393. CP_OUT_BYTE(pjPorts, DAC_PEL_DATA, jSavedDac_F_2);
  1394. //
  1395. // Set HW pointer to use last HW pattern location
  1396. //
  1397. CP_PTR_ADDR(ppdev, ppdev->pjPorts, 0x3f);
  1398. //crus
  1399. // vAsserthwiconcursor(ppdev, 1); //myf11
  1400. }
  1401. else
  1402. {
  1403. CP_PTR_DISABLE(ppdev, pjPorts);
  1404. }
  1405. Leave:
  1406. return;
  1407. }
  1408. /******************************Public*Routine******************************\
  1409. * BOOL bEnablePointer
  1410. *
  1411. \**************************************************************************/
  1412. BOOL bEnablePointer(
  1413. PDEV* ppdev)
  1414. {
  1415. PBYTE pjPorts = ppdev->pjPorts;
  1416. DISPDBG((2,"bEnablePointer\n "));
  1417. ///////////////////////////////////////////////////////////////////////
  1418. // Note: flCaps is overwritten during an vAsserModeHardware. So, any
  1419. // failures that disable the pointer need to be re-checked during
  1420. // vAssertModePointer so that we can re-set the CAPS_SW_POINTER flag.
  1421. if (DRIVER_PUNT_ALL || DRIVER_PUNT_PTR || (ppdev->pulXfer == NULL))
  1422. {
  1423. //
  1424. // Force SW cursor
  1425. //
  1426. ppdev->flCaps |= CAPS_SW_POINTER;
  1427. }
  1428. if (ppdev->flCaps & CAPS_SW_POINTER)
  1429. {
  1430. goto ReturnSuccess;
  1431. }
  1432. ppdev->pjPointerAndMask = ALLOC(128);
  1433. if (ppdev->pjPointerAndMask == NULL)
  1434. {
  1435. DISPDBG((0, "bEnablePointer: Failed - EngAllocMem (pjAndMask)"));
  1436. ppdev->flCaps |= CAPS_SW_POINTER;
  1437. goto ReturnSuccess;
  1438. }
  1439. ppdev->pjPointerXorMask = ALLOC(128);
  1440. if (ppdev->pjPointerXorMask == NULL)
  1441. {
  1442. DISPDBG((0, "bEnablePointer: Failed - EngAllocMem (pjXorMask)"));
  1443. ppdev->flCaps |= CAPS_SW_POINTER;
  1444. goto ReturnSuccess;
  1445. }
  1446. ppdev->flPointer = POINTER_DISABLED;
  1447. vAssertModePointer(ppdev, TRUE);
  1448. ReturnSuccess:
  1449. if (ppdev->flCaps & CAPS_SW_POINTER)
  1450. {
  1451. DISPDBG((2, "Using software pointer"));
  1452. }
  1453. else
  1454. {
  1455. DISPDBG((2, "Using hardware pointer"));
  1456. }
  1457. return(TRUE);
  1458. }
  1459.