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.

1621 lines
48 KiB

  1. //***************************************************************************
  2. //
  3. // Module Name:
  4. //
  5. // permdata.c
  6. //
  7. // Abstract:
  8. //
  9. // This module contains all the global data used by the Permedia2 driver.
  10. //
  11. // Environment:
  12. //
  13. // Kernel mode
  14. //
  15. // Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
  16. // Copyright (c) 1995-1999 Microsoft Corporation. All Rights Reserved.
  17. //
  18. //***************************************************************************
  19. #include "permedia.h"
  20. /*
  21. * DATA STRUCTURES
  22. * ===============
  23. */
  24. #if defined(ALLOC_PRAGMA)
  25. #pragma data_seg("PAGED_DATA")
  26. #endif
  27. //
  28. // Permedia2 Legacy Resource List
  29. //
  30. // RangeStart RangeLength
  31. // | | RangeInIoSpace
  32. // | | | RangeVisible
  33. // +-----+-----+ | | | RangeShareable
  34. // | | | | | | RangePassive
  35. // v v v v v v v
  36. VIDEO_ACCESS_RANGE P2LegacyResourceList[] =
  37. {
  38. {0x000C0000, 0x00000000, 0x00010000, 0, 0, 0, 0}, // ROM location
  39. {0x000A0000, 0x00000000, 0x00020000, 0, 0, 1, 0}, // Frame buffer
  40. {0x000003B0, 0x00000000, 0x0000000C, 1, 1, 1, 0}, // VGA regs
  41. {0x000003C0, 0x00000000, 0x00000020, 1, 1, 1, 0} // VGA regs
  42. };
  43. ULONG P2LegacyResourceEntries = sizeof P2LegacyResourceList / sizeof P2LegacyResourceList[0];
  44. // Entries for 3 bpp colors
  45. // Index(0-7) -> Color(0-255)
  46. ULONG bPal8[] = {
  47. 0x00, 0x24, 0x48, 0x6D,
  48. 0x91, 0xB6, 0xDA, 0xFF
  49. };
  50. // Entries for 2 bpp colors
  51. // Index(0-3) -> Color(0-255)
  52. ULONG bPal4[] = {
  53. 0x00, 0x6D, 0xB6, 0xFF
  54. };
  55. ///////////////////////////////////////////////////////////////////////////
  56. // Video mode table - Lists the information about each individual mode.
  57. //
  58. // Note that any new modes should be added here and to the appropriate
  59. // P2_VIDEO_FREQUENCIES tables.
  60. //
  61. P2_VIDEO_MODES P2Modes[] = {
  62. { // 320x200x8bpp
  63. 0, // 'Contiguous' Int 10 mode number (for high-colour)
  64. 0, // 'Noncontiguous' Int 10 mode number
  65. 320, // 'Contiguous' screen stride
  66. {
  67. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  68. 0, // Mode index used in setting the mode
  69. // (filled in later)
  70. 320, // X Resolution, in pixels
  71. 200, // Y Resolution, in pixels
  72. 320, // 'Noncontiguous' screen stride,
  73. // in bytes (distance between the
  74. // start point of two consecutive
  75. // scan lines, in bytes)
  76. 1, // Number of video memory planes
  77. 8, // Number of bits per plane
  78. 1, // Screen Frequency, in Hertz ('1'
  79. // means use hardware default)
  80. 320, // Horizontal size of screen in millimeters
  81. 240, // Vertical size of screen in millimeters
  82. 8, // Number Red pixels in DAC
  83. 8, // Number Green pixels in DAC
  84. 8, // Number Blue pixels in DAC
  85. 0x00000000, // Mask for Red Pixels in non-palette modes
  86. 0x00000000, // Mask for Green Pixels in non-palette modes
  87. 0x00000000, // Mask for Blue Pixels in non-palette modes
  88. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  89. VIDEO_MODE_MANAGED_PALETTE, // Mode description flags.
  90. 0, // Video Memory Bitmap Width (filled
  91. // in later)
  92. 0 // Video Memory Bitmap Height (filled
  93. // in later)
  94. },
  95. },
  96. { // 640x400x8bpp
  97. 0,
  98. 0,
  99. 640,
  100. {
  101. sizeof(VIDEO_MODE_INFORMATION),
  102. 0,
  103. 640,
  104. 400,
  105. 640,
  106. 1,
  107. 8,
  108. 1,
  109. 320,
  110. 240,
  111. 8,
  112. 8,
  113. 8,
  114. 0x00000000,
  115. 0x00000000,
  116. 0x00000000,
  117. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  118. VIDEO_MODE_MANAGED_PALETTE,
  119. }
  120. },
  121. { // 320x200x16bpp
  122. 0,
  123. 0,
  124. 640,
  125. {
  126. sizeof(VIDEO_MODE_INFORMATION),
  127. 0,
  128. 320,
  129. 200,
  130. 640,
  131. 1,
  132. 16,
  133. 1,
  134. 320,
  135. 240,
  136. 8,
  137. 8,
  138. 8,
  139. 0x0000f800, // BGR 5:6:5
  140. 0x000007e0,
  141. 0x0000001f,
  142. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  143. }
  144. },
  145. { // 640x400x16bpp
  146. 0,
  147. 0,
  148. 1280,
  149. {
  150. sizeof(VIDEO_MODE_INFORMATION),
  151. 0,
  152. 640,
  153. 400,
  154. 1280,
  155. 1,
  156. 16,
  157. 1,
  158. 320,
  159. 240,
  160. 8,
  161. 8,
  162. 8,
  163. 0x0000f800, // BGR 5:6:5
  164. 0x000007e0,
  165. 0x0000001f,
  166. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  167. }
  168. },
  169. { // 320x240x8bpp
  170. 0x0201,
  171. 0x0201,
  172. 320,
  173. {
  174. sizeof(VIDEO_MODE_INFORMATION),
  175. 0,
  176. 320,
  177. 240,
  178. 320,
  179. 1,
  180. 8,
  181. 1,
  182. 320,
  183. 240,
  184. 8,
  185. 8,
  186. 8,
  187. 0x00000000,
  188. 0x00000000,
  189. 0x00000000,
  190. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  191. VIDEO_MODE_MANAGED_PALETTE,
  192. }
  193. },
  194. { // 512x384x8bpp
  195. 0x0201,
  196. 0x0201,
  197. 512,
  198. {
  199. sizeof(VIDEO_MODE_INFORMATION),
  200. 0,
  201. 512,
  202. 384,
  203. 512,
  204. 1,
  205. 8,
  206. 1,
  207. 320,
  208. 240,
  209. 8,
  210. 8,
  211. 8,
  212. 0x00000000,
  213. 0x00000000,
  214. 0x00000000,
  215. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  216. VIDEO_MODE_MANAGED_PALETTE,
  217. }
  218. },
  219. { // 640x480x8bpp
  220. 0x0201,
  221. 0x0201,
  222. 640,
  223. {
  224. sizeof(VIDEO_MODE_INFORMATION),
  225. 0,
  226. 640,
  227. 480,
  228. 640,
  229. 1,
  230. 8,
  231. 1,
  232. 320,
  233. 240,
  234. 8,
  235. 8,
  236. 8,
  237. 0x00000000,
  238. 0x00000000,
  239. 0x00000000,
  240. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  241. VIDEO_MODE_MANAGED_PALETTE,
  242. }
  243. },
  244. { // 800x600x8bpp
  245. 0x0103,
  246. 0x0203,
  247. 800,
  248. {
  249. sizeof(VIDEO_MODE_INFORMATION),
  250. 0,
  251. 800,
  252. 600,
  253. 800,
  254. 1,
  255. 8,
  256. 1,
  257. 320,
  258. 240,
  259. 8,
  260. 8,
  261. 8,
  262. 0x00000000,
  263. 0x00000000,
  264. 0x00000000,
  265. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  266. VIDEO_MODE_MANAGED_PALETTE,
  267. }
  268. },
  269. { // 1024x768x8bpp
  270. 0x0205,
  271. 0x0205,
  272. 1024,
  273. {
  274. sizeof(VIDEO_MODE_INFORMATION),
  275. 0,
  276. 1024,
  277. 768,
  278. 1024,
  279. 1,
  280. 8,
  281. 1,
  282. 320,
  283. 240,
  284. 8,
  285. 8,
  286. 8,
  287. 0x00000000,
  288. 0x00000000,
  289. 0x00000000,
  290. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  291. VIDEO_MODE_MANAGED_PALETTE,
  292. }
  293. },
  294. { // 1152x870x8bpp
  295. 0x0207,
  296. 0x0207,
  297. 1152,
  298. {
  299. sizeof(VIDEO_MODE_INFORMATION),
  300. 0,
  301. 1152,
  302. 870,
  303. 1152,
  304. 1,
  305. 8,
  306. 1,
  307. 320,
  308. 240,
  309. 8,
  310. 8,
  311. 8,
  312. 0x00000000,
  313. 0x00000000,
  314. 0x00000000,
  315. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  316. VIDEO_MODE_MANAGED_PALETTE,
  317. }
  318. },
  319. { // 1280x1024x8bpp
  320. 0x0107,
  321. 0x0107,
  322. 1280,
  323. {
  324. sizeof(VIDEO_MODE_INFORMATION),
  325. 0,
  326. 1280,
  327. 1024,
  328. 1280,
  329. 1,
  330. 8,
  331. 1,
  332. 320,
  333. 240,
  334. 8,
  335. 8,
  336. 8,
  337. 0x00000000,
  338. 0x00000000,
  339. 0x00000000,
  340. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  341. VIDEO_MODE_MANAGED_PALETTE,
  342. }
  343. },
  344. { // 1600x1200x8bpp
  345. 0x0120,
  346. 0x0120,
  347. 1600,
  348. {
  349. sizeof(VIDEO_MODE_INFORMATION),
  350. 0,
  351. 1600,
  352. 1200,
  353. 1600,
  354. 1,
  355. 8,
  356. 1,
  357. 320,
  358. 240,
  359. 8,
  360. 8,
  361. 8,
  362. 0x00000000,
  363. 0x00000000,
  364. 0x00000000,
  365. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS | VIDEO_MODE_PALETTE_DRIVEN |
  366. VIDEO_MODE_MANAGED_PALETTE,
  367. }
  368. },
  369. { // 320x240x16bpp
  370. 0x0111,
  371. 0x0211,
  372. 640,
  373. {
  374. sizeof(VIDEO_MODE_INFORMATION),
  375. 0,
  376. 320,
  377. 240,
  378. 640,
  379. 1,
  380. 16,
  381. 1,
  382. 320,
  383. 240,
  384. 8,
  385. 8,
  386. 8,
  387. 0x0000f800, // BGR 5:6:5
  388. 0x000007e0,
  389. 0x0000001f,
  390. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  391. }
  392. },
  393. { // 512x384x16bpp
  394. 0x0111,
  395. 0x0211,
  396. 1024,
  397. {
  398. sizeof(VIDEO_MODE_INFORMATION),
  399. 0,
  400. 512,
  401. 384,
  402. 1024,
  403. 1,
  404. 16,
  405. 1,
  406. 320,
  407. 240,
  408. 8,
  409. 8,
  410. 8,
  411. 0x0000f800, // BGR 5:6:5
  412. 0x000007e0,
  413. 0x0000001f,
  414. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  415. }
  416. },
  417. { // 640x480x16bpp
  418. 0x0111,
  419. 0x0211,
  420. 1280,
  421. {
  422. sizeof(VIDEO_MODE_INFORMATION),
  423. 0,
  424. 640,
  425. 480,
  426. 1280,
  427. 1,
  428. 16,
  429. 1,
  430. 320,
  431. 240,
  432. 8,
  433. 8,
  434. 8,
  435. 0x0000f800, // BGR 5:6:5
  436. 0x000007e0,
  437. 0x0000001f,
  438. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  439. }
  440. },
  441. { // 800x600x16bpp
  442. 0x0114,
  443. 0x0214,
  444. 1600,
  445. {
  446. sizeof(VIDEO_MODE_INFORMATION),
  447. 0,
  448. 800,
  449. 600,
  450. 1600,
  451. 1,
  452. 16,
  453. 1,
  454. 320,
  455. 240,
  456. 8,
  457. 8,
  458. 8,
  459. 0x0000f800, // BGR 5:6:5
  460. 0x000007e0,
  461. 0x0000001f,
  462. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  463. }
  464. },
  465. { // 1024x768x16bpp
  466. 0x0117,
  467. 0x0117,
  468. 2048,
  469. {
  470. sizeof(VIDEO_MODE_INFORMATION),
  471. 0,
  472. 1024,
  473. 768,
  474. 2048,
  475. 1,
  476. 16,
  477. 1,
  478. 320,
  479. 240,
  480. 8,
  481. 8,
  482. 8,
  483. 0x0000f800, // BGR 5:6:5
  484. 0x000007e0,
  485. 0x0000001f,
  486. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  487. }
  488. },
  489. { // 1152x870x16bpp
  490. 0x0118,
  491. 0x0222,
  492. 2304,
  493. {
  494. sizeof(VIDEO_MODE_INFORMATION),
  495. 0,
  496. 1152,
  497. 870,
  498. 2304,
  499. 1,
  500. 16,
  501. 1,
  502. 320,
  503. 240,
  504. 8,
  505. 8,
  506. 8,
  507. 0x0000f800, // BGR 5:6:5
  508. 0x000007e0,
  509. 0x0000001f,
  510. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  511. }
  512. },
  513. { // 1280x1024x16bpp
  514. 0x011A,
  515. 0x021A,
  516. 2560,
  517. {
  518. sizeof(VIDEO_MODE_INFORMATION),
  519. 0,
  520. 1280,
  521. 1024,
  522. 2560,
  523. 1,
  524. 16,
  525. 1,
  526. 320,
  527. 240,
  528. 8,
  529. 8,
  530. 8,
  531. 0x0000f800, // BGR 5:6:5
  532. 0x000007e0,
  533. 0x0000001f,
  534. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  535. }
  536. },
  537. { // 1600x1200x16bpp
  538. 0x0121,
  539. 0x0121,
  540. 3200,
  541. {
  542. sizeof(VIDEO_MODE_INFORMATION),
  543. 0,
  544. 1600,
  545. 1200,
  546. 3200,
  547. 1,
  548. 16,
  549. 1,
  550. 320,
  551. 240,
  552. 8,
  553. 8,
  554. 8,
  555. 0x0000f800, // BGR 5:6:5
  556. 0x000007e0,
  557. 0x0000001f,
  558. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  559. }
  560. },
  561. { // 320x240x15bpp
  562. 0x0111,
  563. 0x0211,
  564. 640,
  565. {
  566. sizeof(VIDEO_MODE_INFORMATION),
  567. 0,
  568. 320,
  569. 240,
  570. 640,
  571. 1,
  572. 15,
  573. 1,
  574. 320,
  575. 240,
  576. 8,
  577. 8,
  578. 8,
  579. 0x00007c00, // BGR 5:5:5
  580. 0x000003e0,
  581. 0x0000001f,
  582. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  583. }
  584. },
  585. { // 512x384x15bpp
  586. 0x0111,
  587. 0x0211,
  588. 1024,
  589. {
  590. sizeof(VIDEO_MODE_INFORMATION),
  591. 0,
  592. 512,
  593. 384,
  594. 1024,
  595. 1,
  596. 15,
  597. 1,
  598. 320,
  599. 240,
  600. 8,
  601. 8,
  602. 8,
  603. 0x00007c00, // BGR 5:5:5
  604. 0x000003e0,
  605. 0x0000001f,
  606. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  607. }
  608. },
  609. { // 640x480x15bpp
  610. 0x0111,
  611. 0x0211,
  612. 1280,
  613. {
  614. sizeof(VIDEO_MODE_INFORMATION),
  615. 0,
  616. 640,
  617. 480,
  618. 1280,
  619. 1,
  620. 15,
  621. 1,
  622. 320,
  623. 240,
  624. 8,
  625. 8,
  626. 8,
  627. 0x00007c00, // BGR 5:5:5
  628. 0x000003e0,
  629. 0x0000001f,
  630. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  631. }
  632. },
  633. { // 800x600x15bpp
  634. 0x0114,
  635. 0x0214,
  636. 1600,
  637. {
  638. sizeof(VIDEO_MODE_INFORMATION),
  639. 0,
  640. 800,
  641. 600,
  642. 1600,
  643. 1,
  644. 15,
  645. 1,
  646. 320,
  647. 240,
  648. 8,
  649. 8,
  650. 8,
  651. 0x00007c00, // BGR 5:5:5
  652. 0x000003e0,
  653. 0x0000001f,
  654. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  655. }
  656. },
  657. { // 1024x768x15bpp
  658. 0x0117,
  659. 0x0117,
  660. 2048,
  661. {
  662. sizeof(VIDEO_MODE_INFORMATION),
  663. 0,
  664. 1024,
  665. 768,
  666. 2048,
  667. 1,
  668. 15,
  669. 1,
  670. 320,
  671. 240,
  672. 8,
  673. 8,
  674. 8,
  675. 0x00007c00, // BGR 5:5:5
  676. 0x000003e0,
  677. 0x0000001f,
  678. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  679. }
  680. },
  681. { // 1152x870x15bpp
  682. 0x0118,
  683. 0x0222,
  684. 2304,
  685. {
  686. sizeof(VIDEO_MODE_INFORMATION),
  687. 0,
  688. 1152,
  689. 870,
  690. 2304,
  691. 1,
  692. 15,
  693. 1,
  694. 320,
  695. 240,
  696. 8,
  697. 8,
  698. 8,
  699. 0x00007c00, // BGR 5:5:5
  700. 0x000003e0,
  701. 0x0000001f,
  702. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  703. }
  704. },
  705. { // 1280x1024x15bpp
  706. 0x011A,
  707. 0x021A,
  708. 2560,
  709. {
  710. sizeof(VIDEO_MODE_INFORMATION),
  711. 0,
  712. 1280,
  713. 1024,
  714. 2560,
  715. 1,
  716. 15,
  717. 1,
  718. 320,
  719. 240,
  720. 8,
  721. 8,
  722. 8,
  723. 0x00007c00, // BGR 5:5:5
  724. 0x000003e0,
  725. 0x0000001f,
  726. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  727. }
  728. },
  729. { // 1600x1200x15bpp
  730. 0x0121,
  731. 0x0121,
  732. 3200,
  733. {
  734. sizeof(VIDEO_MODE_INFORMATION),
  735. 0,
  736. 1600,
  737. 1200,
  738. 3200,
  739. 1,
  740. 15,
  741. 1,
  742. 320,
  743. 240,
  744. 8,
  745. 8,
  746. 8,
  747. 0x00007c00, // BGR 5:5:5
  748. 0x000003e0,
  749. 0x0000001f,
  750. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  751. }
  752. },
  753. { // 640x480x12bpp
  754. 0x0112,
  755. 0x0220,
  756. 2560,
  757. {
  758. sizeof(VIDEO_MODE_INFORMATION),
  759. 0,
  760. 640,
  761. 480,
  762. 2560,
  763. 1,
  764. 12,
  765. 1,
  766. 320,
  767. 240,
  768. 8,
  769. 8,
  770. 8,
  771. 0x000f0000, // BGR 4:4:4
  772. 0x00000f00,
  773. 0x0000000f,
  774. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  775. }
  776. },
  777. { // 800x600x12bpp
  778. 0x0115,
  779. 0x0221,
  780. 3200,
  781. {
  782. sizeof(VIDEO_MODE_INFORMATION),
  783. 0,
  784. 800,
  785. 600,
  786. 3200,
  787. 1,
  788. 12,
  789. 1,
  790. 320,
  791. 240,
  792. 8,
  793. 8,
  794. 8,
  795. 0x000f0000, // BGR 4:4:4
  796. 0x00000f00,
  797. 0x0000000f,
  798. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  799. }
  800. },
  801. { // 1024x768x12bpp
  802. 0x0118,
  803. 0x0222,
  804. 4096,
  805. {
  806. sizeof(VIDEO_MODE_INFORMATION),
  807. 0,
  808. 1024,
  809. 768,
  810. 4096,
  811. 1,
  812. 12,
  813. 1,
  814. 320,
  815. 240,
  816. 8,
  817. 8,
  818. 8,
  819. 0x000f0000, // BGR 4:4:4
  820. 0x00000f00,
  821. 0x0000000f,
  822. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  823. }
  824. },
  825. { // 1152x870x12bpp
  826. 0x0118,
  827. 0x0222,
  828. 4608,
  829. {
  830. sizeof(VIDEO_MODE_INFORMATION),
  831. 0,
  832. 1152,
  833. 870,
  834. 4608,
  835. 1,
  836. 12,
  837. 1,
  838. 320,
  839. 240,
  840. 8,
  841. 8,
  842. 8,
  843. 0x000f0000, // BGR 4:4:4
  844. 0x00000f00,
  845. 0x0000000f,
  846. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  847. }
  848. },
  849. { // 1280x1024x12bpp
  850. 0x011B,
  851. 0x011B,
  852. 5120,
  853. {
  854. sizeof(VIDEO_MODE_INFORMATION),
  855. 0,
  856. 1280,
  857. 1024,
  858. 5120,
  859. 1,
  860. 12,
  861. 1,
  862. 320,
  863. 240,
  864. 8,
  865. 8,
  866. 8,
  867. 0x000f0000, // BGR 4:4:4
  868. 0x00000f00,
  869. 0x0000000f,
  870. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  871. }
  872. },
  873. { // 1600x1200x12bpp
  874. 0x0122,
  875. 0x0122,
  876. 6400,
  877. {
  878. sizeof(VIDEO_MODE_INFORMATION),
  879. 0,
  880. 1600,
  881. 1200,
  882. 6400,
  883. 1,
  884. 12,
  885. 1,
  886. 320,
  887. 240,
  888. 8,
  889. 8,
  890. 8,
  891. 0x000f0000, // BGR 4:4:4
  892. 0x00000f00,
  893. 0x0000000f,
  894. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  895. }
  896. },
  897. { // 320x240x32bpp
  898. 0x0112,
  899. 0x0220,
  900. 1280,
  901. {
  902. sizeof(VIDEO_MODE_INFORMATION),
  903. 0,
  904. 320,
  905. 240,
  906. 1280,
  907. 1,
  908. 32,
  909. 1,
  910. 320,
  911. 240,
  912. 8,
  913. 8,
  914. 8,
  915. 0x00ff0000, // BGR 8:8:8
  916. 0x0000ff00,
  917. 0x000000ff,
  918. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  919. }
  920. },
  921. { // 512x384x32bpp
  922. 0x0112,
  923. 0x0220,
  924. 2048,
  925. {
  926. sizeof(VIDEO_MODE_INFORMATION),
  927. 0,
  928. 512,
  929. 384,
  930. 2048,
  931. 1,
  932. 32,
  933. 1,
  934. 320,
  935. 240,
  936. 8,
  937. 8,
  938. 8,
  939. 0x00ff0000, // BGR 8:8:8
  940. 0x0000ff00,
  941. 0x000000ff,
  942. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  943. }
  944. },
  945. { // 640x480x32bpp
  946. 0x0112,
  947. 0x0220,
  948. 2560,
  949. {
  950. sizeof(VIDEO_MODE_INFORMATION),
  951. 0,
  952. 640,
  953. 480,
  954. 2560,
  955. 1,
  956. 32,
  957. 1,
  958. 320,
  959. 240,
  960. 8,
  961. 8,
  962. 8,
  963. 0x00ff0000, // BGR 8:8:8
  964. 0x0000ff00,
  965. 0x000000ff,
  966. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  967. }
  968. },
  969. { // 800x600x32bpp
  970. 0x0115,
  971. 0x0221,
  972. 3200,
  973. {
  974. sizeof(VIDEO_MODE_INFORMATION),
  975. 0,
  976. 800,
  977. 600,
  978. 3200,
  979. 1,
  980. 32,
  981. 1,
  982. 320,
  983. 240,
  984. 8,
  985. 8,
  986. 8,
  987. 0x00ff0000, // BGR 8:8:8
  988. 0x0000ff00,
  989. 0x000000ff,
  990. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  991. }
  992. },
  993. { // 1024x768x32bpp
  994. 0x0118,
  995. 0x0222,
  996. 4096,
  997. {
  998. sizeof(VIDEO_MODE_INFORMATION),
  999. 0,
  1000. 1024,
  1001. 768,
  1002. 4096,
  1003. 1,
  1004. 32,
  1005. 1,
  1006. 320,
  1007. 240,
  1008. 8,
  1009. 8,
  1010. 8,
  1011. 0x00ff0000, // BGR 8:8:8
  1012. 0x0000ff00,
  1013. 0x000000ff,
  1014. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  1015. }
  1016. },
  1017. { // 1152x870x32bpp
  1018. 0x0118,
  1019. 0x0222,
  1020. 4608,
  1021. {
  1022. sizeof(VIDEO_MODE_INFORMATION),
  1023. 0,
  1024. 1152,
  1025. 870,
  1026. 4608,
  1027. 1,
  1028. 32,
  1029. 1,
  1030. 320,
  1031. 240,
  1032. 8,
  1033. 8,
  1034. 8,
  1035. 0x00ff0000, // BGR 8:8:8
  1036. 0x0000ff00,
  1037. 0x000000ff,
  1038. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  1039. }
  1040. },
  1041. { // 1280x1024x32bpp
  1042. 0x011B,
  1043. 0x011B,
  1044. 5120,
  1045. {
  1046. sizeof(VIDEO_MODE_INFORMATION),
  1047. 0,
  1048. 1280,
  1049. 1024,
  1050. 5120,
  1051. 1,
  1052. 32,
  1053. 1,
  1054. 320,
  1055. 240,
  1056. 8,
  1057. 8,
  1058. 8,
  1059. 0x00ff0000, // BGR 8:8:8
  1060. 0x0000ff00,
  1061. 0x000000ff,
  1062. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  1063. }
  1064. },
  1065. { // 1600x1200x32bpp
  1066. 0x0122,
  1067. 0x0122,
  1068. 6400,
  1069. {
  1070. sizeof(VIDEO_MODE_INFORMATION),
  1071. 0,
  1072. 1600,
  1073. 1200,
  1074. 6400,
  1075. 1,
  1076. 32,
  1077. 1,
  1078. 320,
  1079. 240,
  1080. 8,
  1081. 8,
  1082. 8,
  1083. 0x00ff0000, // BGR 8:8:8
  1084. 0x0000ff00,
  1085. 0x000000ff,
  1086. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS,
  1087. }
  1088. },
  1089. { // 640x480x24bpp
  1090. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1091. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1092. 1920, // 'Contiguous' screen stride (640 by 3 bytes/pixel)
  1093. {
  1094. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1095. 0, // Mode index used in setting the mode
  1096. // (filled in later)
  1097. 640, // X Resolution, in pixels
  1098. 480, // Y Resolution, in pixels
  1099. 1920, // 'Noncontiguous' screen stride,
  1100. // in bytes (distance between the
  1101. // start point of two consecutive
  1102. // scan lines, in bytes)
  1103. 1, // Number of video memory planes
  1104. 24, // Number of bits per plane
  1105. 1, // Screen Frequency, in Hertz ('1'
  1106. // means use hardware default)
  1107. 320, // Horizontal size of screen in millimeters
  1108. 240, // Vertical size of screen in millimeters
  1109. 8, // Number Red pixels in DAC
  1110. 8, // Number Green pixels in DAC
  1111. 8, // Number Blue pixels in DAC
  1112. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1113. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1114. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1115. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1116. },
  1117. },
  1118. { // 800x600x24bpp
  1119. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1120. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1121. 2400, // 'Contiguous' screen stride (800 by 3 bytes/pixel)
  1122. {
  1123. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1124. 0, // Mode index used in setting the mode
  1125. // (filled in later)
  1126. 800, // X Resolution, in pixels
  1127. 600, // Y Resolution, in pixels
  1128. 2400, // 'Noncontiguous' screen stride,
  1129. // in bytes (distance between the
  1130. // start point of two consecutive
  1131. // scan lines, in bytes)
  1132. 1, // Number of video memory planes
  1133. 24, // Number of bits per plane
  1134. 1, // Screen Frequency, in Hertz ('1'
  1135. // means use hardware default)
  1136. 320, // Horizontal size of screen in millimeters
  1137. 240, // Vertical size of screen in millimeters
  1138. 8, // Number Red pixels in DAC
  1139. 8, // Number Green pixels in DAC
  1140. 8, // Number Blue pixels in DAC
  1141. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1142. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1143. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1144. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1145. },
  1146. },
  1147. { // 1024x768x24bpp
  1148. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1149. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1150. 3072, // 'Contiguous' screen stride (1024 by 3 bytes/pixel)
  1151. {
  1152. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1153. 0, // Mode index used in setting the mode
  1154. // (filled in later)
  1155. 1024, // X Resolution, in pixels
  1156. 768, // Y Resolution, in pixels
  1157. 3072, // 'Noncontiguous' screen stride,
  1158. // in bytes (distance between the
  1159. // start point of two consecutive
  1160. // scan lines, in bytes)
  1161. 1, // Number of video memory planes
  1162. 24, // Number of bits per plane
  1163. 1, // Screen Frequency, in Hertz ('1'
  1164. // means use hardware default)
  1165. 320, // Horizontal size of screen in millimeters
  1166. 240, // Vertical size of screen in millimeters
  1167. 8, // Number Red pixels in DAC
  1168. 8, // Number Green pixels in DAC
  1169. 8, // Number Blue pixels in DAC
  1170. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1171. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1172. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1173. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1174. },
  1175. },
  1176. { // 1152x870x24bpp
  1177. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1178. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1179. 3456, // 'Contiguous' screen stride (1152 by 3 bytes/pixel)
  1180. {
  1181. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1182. 0, // Mode index used in setting the mode
  1183. // (filled in later)
  1184. 1152, // X Resolution, in pixels
  1185. 870, // Y Resolution, in pixels
  1186. 3072, // 'Noncontiguous' screen stride,
  1187. // in bytes (distance between the
  1188. // start point of two consecutive
  1189. // scan lines, in bytes)
  1190. 1, // Number of video memory planes
  1191. 24, // Number of bits per plane
  1192. 1, // Screen Frequency, in Hertz ('1'
  1193. // means use hardware default)
  1194. 320, // Horizontal size of screen in millimeters
  1195. 240, // Vertical size of screen in millimeters
  1196. 8, // Number Red pixels in DAC
  1197. 8, // Number Green pixels in DAC
  1198. 8, // Number Blue pixels in DAC
  1199. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1200. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1201. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1202. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1203. },
  1204. },
  1205. { // 1280x1024x24bpp
  1206. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1207. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1208. 3840, // 'Contiguous' screen stride (1280 by 3 bytes/pixel)
  1209. {
  1210. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1211. 0, // Mode index used in setting the mode
  1212. // (filled in later)
  1213. 3840, // X Resolution, in pixels
  1214. 1280, // Y Resolution, in pixels
  1215. 1024, // 'Noncontiguous' screen stride,
  1216. // in bytes (distance between the
  1217. // start point of two consecutive
  1218. // scan lines, in bytes)
  1219. 1, // Number of video memory planes
  1220. 24, // Number of bits per plane
  1221. 1, // Screen Frequency, in Hertz ('1'
  1222. // means use hardware default)
  1223. 320, // Horizontal size of screen in millimeters
  1224. 240, // Vertical size of screen in millimeters
  1225. 8, // Number Red pixels in DAC
  1226. 8, // Number Green pixels in DAC
  1227. 8, // Number Blue pixels in DAC
  1228. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1229. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1230. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1231. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1232. },
  1233. },
  1234. { // 1600x1200x24bpp
  1235. 0, // 'Contiguous' Int 10 mode number (for high-colour) (UNUSED)
  1236. 0, // 'Noncontiguous' Int 10 mode number (UNUSED)
  1237. 4800, // 'Contiguous' screen stride (1600 by 3 bytes/pixel)
  1238. {
  1239. sizeof(VIDEO_MODE_INFORMATION), // Size of the mode informtion structure
  1240. 0, // Mode index used in setting the mode
  1241. // (filled in later)
  1242. 1600, // X Resolution, in pixels
  1243. 1280, // Y Resolution, in pixels
  1244. 4800, // 'Noncontiguous' screen stride,
  1245. // in bytes (distance between the
  1246. // start point of two consecutive
  1247. // scan lines, in bytes)
  1248. 1, // Number of video memory planes
  1249. 24, // Number of bits per plane
  1250. 1, // Screen Frequency, in Hertz ('1'
  1251. // means use hardware default)
  1252. 320, // Horizontal size of screen in millimeters
  1253. 240, // Vertical size of screen in millimeters
  1254. 8, // Number Red pixels in DAC
  1255. 8, // Number Green pixels in DAC
  1256. 8, // Number Blue pixels in DAC
  1257. 0x00ff0000, // Mask for Red Pixels in non-palette modes
  1258. 0x0000ff00, // Mask for Green Pixels in non-palette modes
  1259. 0x000000ff, // Mask for Blue Pixels in non-palette modes
  1260. VIDEO_MODE_COLOR | VIDEO_MODE_GRAPHICS, // Mode description flags.
  1261. },
  1262. },
  1263. };
  1264. ULONG NumP2VideoModes = sizeof(P2Modes) / sizeof(P2Modes[0]);
  1265. /*****************************************************************************
  1266. * Reference Permedia2 hard-wired mode-sets.
  1267. *
  1268. * The order they appear here is the order they appear in the Display Applet.
  1269. *
  1270. ****************************************************************************/
  1271. //
  1272. // We can replace the hard coded list of frequencies with a hard-coded list
  1273. // of pixel depths, which is a lot easier to maintain, and takes less memory.
  1274. // What we then do is for each 'TIMINGS' registry entry and for each timing
  1275. // entry we create 'P2DepthCnt' frequency table entries, one for each pixel
  1276. // depth. Once we have done that then we validate the entries in the frequency
  1277. // list with the 'P2VideoModes' array.
  1278. //
  1279. ULONG P2DepthList [] = { 8, 16, 24, 32 };
  1280. #define P2DepthCnt (sizeof(P2DepthList) / sizeof(P2DepthList[0]))
  1281. //
  1282. // VESA_LIST []
  1283. // ------------
  1284. //
  1285. // This is an array of structures containing the VESA definition
  1286. // for a width, height, frequency combination.
  1287. //
  1288. //
  1289. typedef struct // Extended VESA TIMING structure
  1290. {
  1291. ULONG Width;
  1292. ULONG Height;
  1293. ULONG Frequency;
  1294. VESA_TIMING_STANDARD VESAInfo;
  1295. } VESA_TIMING_STANDARD_EXT;
  1296. VESA_TIMING_STANDARD_EXT VESA_LIST [] =
  1297. {
  1298. //
  1299. // I have commented out the VESA-compliant 640x480@60 and replaced it
  1300. // with a VGA-compliant one. This is because some monitors won't SYNC
  1301. // with the values that we have.
  1302. //
  1303. //640,480,60, {0x064,0x02,0x08,0x0a,0x00,0x1f1,0x01,0x03,0x0d,0x00 },
  1304. 640,480,60, {0x064,0x02,0x0c,0x06,0x00,0x20d,0x0a,0x02,0x21,0x00 },
  1305. 640,480,75, {0x066,0x03,0x08,0x0b,0x00,0x1f6,0x01,0x03,0x12,0x00 },
  1306. 640,480,85, {0x068,0x04,0x08,0x0c,0x00,0x1f9,0x01,0x03,0x15,0x00 },
  1307. 640,480,100, {0x06a,0x05,0x08,0x0d,0x00,0x1fd,0x01,0x03,0x19,0x00 },
  1308. 800,600,60, {0x084,0x05,0x10,0x0b,0x01,0x274,0x01,0x04,0x17,0x01 },
  1309. 800,600,75, {0x084,0x02,0x0a,0x14,0x01,0x271,0x01,0x03,0x15,0x01 },
  1310. 800,600,85, {0x083,0x04,0x08,0x13,0x01,0x277,0x01,0x03,0x1b,0x01 },
  1311. 800,600,100, {0x086,0x06,0x0b,0x11,0x01,0x27c,0x01,0x03,0x20,0x01 },
  1312. 1024,768,60, {0x0a8,0x03,0x11,0x14,0x01,0x326,0x04,0x06,0x1c,0x01 },
  1313. 1024,768,75, {0x0a4,0x02,0x0c,0x16,0x01,0x320,0x01,0x03,0x1c,0x01 },
  1314. 1024,768,85, {0x0ac,0x06,0x0c,0x1a,0x01,0x328,0x01,0x03,0x24,0x01 },
  1315. 1024,768,100, {0x0ae,0x09,0x0e,0x17,0x01,0x32e,0x01,0x03,0x2a,0x01 },
  1316. 1152,870,60, {0x0c8,0x08,0x10,0x20,0x01,0x38a,0x01,0x03,0x20,0x01 },
  1317. 1152,870,75, {0x0c2,0x09,0x10,0x19,0x01,0x38c,0x01,0x03,0x22,0x01 },
  1318. 1152,870,85, {0x0c5,0x08,0x10,0x1d,0x01,0x391,0x01,0x03,0x27,0x01 },
  1319. 1152,870,100, {0x0c4,0x0a,0x10,0x1a,0x01,0x39a,0x01,0x03,0x30,0x01 },
  1320. 1280,1024,60, {0x0d3,0x06,0x0e,0x1f,0x01,0x42a,0x01,0x03,0x26,0x01 },
  1321. 1280,1024,75, {0x0d3,0x02,0x12,0x1f,0x01,0x42a,0x01,0x03,0x26,0x01 },
  1322. 1280,1024,85, {0x0d8,0x06,0x14,0x1e,0x01,0x430,0x01,0x03,0x2c,0x01 },
  1323. 1280,1024,100, {0x0dc,0x0c,0x12,0x1e,0x01,0x43d,0x01,0x03,0x39,0x01 },
  1324. 1600,1200,60, {0x10e,0x08,0x18,0x26,0x01,0x4e2,0x01,0x03,0x2e,0x01 },
  1325. 1600,1200,75, {0x10e,0x08,0x18,0x26,0x01,0x4e2,0x01,0x03,0x2e,0x01 },
  1326. 1600,1200,85, {0x10e,0x08,0x18,0x26,0x01,0x4e2,0x01,0x03,0x2e,0x01 },
  1327. 1600,1200,100, {0x114,0x10,0x16,0x26,0x01,0x4f7,0x01,0x03,0x43,0x01 },
  1328. //320,240,60, {0x032,0x01,0x04,0x05,0x00,0x0f9,0x01,0x03,0x05,0x00 },
  1329. 320,240,75, {0x033,0x02,0x04,0x05,0x00,0x0fb,0x01,0x03,0x07,0x00 },
  1330. 320,240,85, {0x034,0x02,0x04,0x06,0x00,0x0fd,0x01,0x03,0x09,0x00 },
  1331. 320,240,100, {0x034,0x02,0x04,0x06,0x00,0x0ff,0x01,0x03,0x0b,0x00 },
  1332. //
  1333. // TMM: 512x384@60Hz seems to work OK, but some older monitors refuse to
  1334. // SYNC, so I have commented it out.
  1335. //
  1336. //512,384,60, {0x04c,0x00,0x06,0x06,0x00,0x18e,0x01,0x03,0x0a,0x00 },
  1337. 512,384,75, {0x050,0x02,0x06,0x08,0x00,0x192,0x01,0x03,0x0e,0x00 },
  1338. 512,384,85, {0x052,0x02,0x07,0x09,0x00,0x194,0x01,0x03,0x10,0x00 },
  1339. 512,384,100, {0x052,0x02,0x07,0x09,0x00,0x197,0x01,0x03,0x13,0x00 },
  1340. //320,200,60, {0x02a,0x00,0x03,0x01,0x00,0x0d0,0x01,0x03,0x04,0x00 },
  1341. 320,200,75, {0x02c,0x00,0x04,0x02,0x00,0x0d2,0x01,0x03,0x06,0x00 },
  1342. 320,200,85, {0x02e,0x00,0x04,0x03,0x00,0x0d3,0x01,0x03,0x07,0x00 },
  1343. 320,200,100, {0x030,0x00,0x04,0x04,0x00,0x0d5,0x01,0x03,0x09,0x00 },
  1344. //640,400,60, {0x062,0x01,0x08,0x09,0x00,0x19f,0x01,0x03,0x0b,0x01 },
  1345. 640,400,75, {0x064,0x02,0x08,0x0a,0x00,0x1a2,0x01,0x03,0x0e,0x01 },
  1346. 640,400,85, {0x066,0x03,0x08,0x0b,0x00,0x1a5,0x01,0x03,0x11,0x01 },
  1347. 640,400,100, {0x068,0x04,0x08,0x0c,0x00,0x1a8,0x01,0x03,0x14,0x01 }
  1348. };
  1349. #define VESA_CNT (sizeof(VESA_LIST) / sizeof(VESA_LIST [0]))
  1350. VESA_TIMING_STANDARD_EXT VESA_LIST_P2S [] =
  1351. {
  1352. 1280,1024,85, {0x0c6,0x04,0x0b,0x17,0x01,0x41e,0x01,0x03,0x1a,0x01 },
  1353. 1600,1200,60, {0x106,0x0a,0x15,0x1f,0x01,0x4d4,0x01,0x03,0x20,0x01 }
  1354. };
  1355. #define VESA_CNT_P2S (sizeof(VESA_LIST_P2S) / sizeof(VESA_LIST_P2S [0]))
  1356. P2_VIDEO_FREQUENCIES freqList[VESA_CNT * P2DepthCnt + 1];
  1357. #if defined(ALLOC_PRAGMA)
  1358. #pragma data_seg()
  1359. #endif
  1360. /*
  1361. * THE CODE
  1362. * ========
  1363. */
  1364. #if defined(ALLOC_PRAGMA)
  1365. #pragma alloc_text(PAGE,GetVideoTiming)
  1366. #pragma alloc_text(PAGE,BuildFrequencyList)
  1367. #endif
  1368. BOOLEAN
  1369. GetVideoTiming (
  1370. PHW_DEVICE_EXTENSION hwDeviceExtension,
  1371. ULONG xRes,
  1372. ULONG yRes,
  1373. ULONG Freq,
  1374. ULONG Depth,
  1375. VESA_TIMING_STANDARD * VESATimings
  1376. )
  1377. /*++
  1378. Routine Description:
  1379. Given a width, height and frequency this function will return a
  1380. VESA timing information.
  1381. The information is extracted from the timing definitions in the
  1382. registry, if there aren't any in the registry then it looks up
  1383. the values in the VESA_LIST.
  1384. --*/
  1385. {
  1386. ULONG i, j, hackCnt;
  1387. BOOLEAN retVal;
  1388. VESA_TIMING_STANDARD_EXT * hackList = NULL;
  1389. DEBUG_PRINT((2, "GetVideoTiming: xres %d, yres %d, freq %d, Depth\n",
  1390. xRes, yRes, Freq, Depth));
  1391. //
  1392. // Allow us to put hacks in for chips that can't support the proper
  1393. // VESA values
  1394. //
  1395. if ((DEVICE_FAMILY_ID(hwDeviceExtension->deviceInfo.DeviceId) == PERMEDIA_P2S_ID ||
  1396. (DEVICE_FAMILY_ID(hwDeviceExtension->deviceInfo.DeviceId) == PERMEDIA_P2_ID &&
  1397. hwDeviceExtension->deviceInfo.RevisionId == PERMEDIA2A_REV_ID)) &&
  1398. Depth > 16)
  1399. {
  1400. //
  1401. // P2S & P2A can't handle VESA versions of 1600x1200 & 1280x1024, 32BPP
  1402. //
  1403. hackList = VESA_LIST_P2S;
  1404. hackCnt = VESA_CNT_P2S;
  1405. }
  1406. retVal = FALSE; // Nothing found yet
  1407. //
  1408. // If we have a hack list then search through it
  1409. //
  1410. if (hackList != NULL)
  1411. {
  1412. for (i = 0; !retVal && i < hackCnt; i++)
  1413. {
  1414. //
  1415. // Comparewidth, height and frequency
  1416. //
  1417. if (hackList [i].Width == xRes &&
  1418. hackList [i].Height == yRes &&
  1419. hackList [i].Frequency == Freq )
  1420. {
  1421. //
  1422. // We got a match
  1423. //
  1424. *VESATimings = hackList [i].VESAInfo;
  1425. retVal = TRUE;
  1426. DEBUG_PRINT((2, "Found value in hack list\n")) ;
  1427. }
  1428. }
  1429. }
  1430. //
  1431. // Loop through the table looking for a match
  1432. //
  1433. for (i = 0; !retVal && i < VESA_CNT; i++)
  1434. {
  1435. //
  1436. // Comparewidth, height and frequency
  1437. //
  1438. if (VESA_LIST [i].Width == xRes &&
  1439. VESA_LIST [i].Height == yRes &&
  1440. VESA_LIST [i].Frequency == Freq )
  1441. {
  1442. //
  1443. // We got a match
  1444. //
  1445. *VESATimings = VESA_LIST [i].VESAInfo;
  1446. retVal = TRUE;
  1447. }
  1448. }
  1449. return (retVal);
  1450. }
  1451. LONG
  1452. BuildFrequencyList (
  1453. PHW_DEVICE_EXTENSION hwDeviceExtension
  1454. )
  1455. /*++
  1456. Routine Description:
  1457. This function creates a table of P2_VIDEO_FREQENCIES entries
  1458. pointedat by hwDeviceExtension->FrequencyTable.
  1459. The list is created by examining the 'TIMING\xxx,yyy,zzz' registry
  1460. entries, if there aren't any entries then the hard-coded VESA_LIST
  1461. is used.
  1462. --*/
  1463. {
  1464. ULONG i, j, k;
  1465. hwDeviceExtension->FrequencyTable = freqList;
  1466. //
  1467. // loop through the list of VESA resolutions
  1468. //
  1469. for (i = 0, k = 0; i < VESA_CNT; i++)
  1470. {
  1471. //
  1472. // For every supported pixel depth, create a frequency entry
  1473. //
  1474. for (j = 0; j < P2DepthCnt; j++, k++)
  1475. {
  1476. freqList [k].BitsPerPel = P2DepthList [j];
  1477. freqList [k].ScreenWidth = VESA_LIST [i].Width;
  1478. freqList [k].ScreenHeight = VESA_LIST [i].Height;
  1479. freqList [k].ScreenFrequency = VESA_LIST [i].Frequency;
  1480. freqList [k].PixelClock =
  1481. ( (VESA_LIST[i].VESAInfo.HTot *
  1482. VESA_LIST [i].VESAInfo.VTot * 8) / 100 ) *
  1483. VESA_LIST [i].Frequency;
  1484. }
  1485. }
  1486. return (TRUE);
  1487. }