Index: trunk/src/ddraw/SVGADEFS.H
===================================================================
--- trunk/src/ddraw/SVGADEFS.H	(revision 5330)
+++ trunk/src/ddraw/SVGADEFS.H	(revision 5330)
@@ -0,0 +1,785 @@
+/*****************************************************************************
+ *
+ * SOURCE FILE NAME = SVGADEFS.H
+ *
+ * DESCRIPTIVE NAME =
+ *
+ * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
+ *             Copyright Microsoft Corporation, 1990
+ *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
+ *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
+ *             RESTRICTED MATERIALS OF IBM
+ *             IBM CONFIDENTIAL
+ *
+ * VERSION = V2.0
+ *
+ * DATE
+ *
+ * DESCRIPTION  Contains SVGA definitions.
+ *
+ * FUNCTIONS
+ *
+ * NOTES        When included into VVID sources, #ifdef SVGA
+ *              must be used before #include!
+ *
+ * STRUCTURES
+ *
+ * EXTERNAL REFERENCES
+ *
+ * EXTERNAL FUNCTIONS
+ *
+ * CHANGE ACTIVITY =
+ *   DATE      FLAG        APAR   CHANGE DESCRIPTION
+ *   --------  ----------  -----  --------------------------------------
+ *   mm/dd/yy  @Vr.mpppxx   xxxxx xxxxxxx
+ *   12/29/92  @V2.0SEN00         Created.
+ *   03/12/93  @V2.0SEN01         OEMINFO structure changed.
+ *   08/31/93  @V2.1YEE02         Recognize Cirrus Logic GD5428 chip
+ *   10/28/93  @V2.1MNH00         Recognize Additional Adapters
+ *   12/06/93  @V2.1YEE05 D 76476 Add ID for Chips & Technologies
+ *   12/15/93  @V2.1YEE06 D 76685 Add Artist Graphics manufacturer
+ *   02/21/94  @V2.1MNH01 D 79562 Recognize Additional Adapters/Chips
+ *   04/14/94  @V2.1MNH05 D 81883 WD90C24 allow more unlocks
+ *   04/26/94  @V2.1MNH08 D 82003 WD90C24 preserve locks for BIOS setmodes
+ *   05/12/94  @V2.1YEE08         Add more Cirrus chipsets
+ *   05/13/94  @V2.1MNH13 F 74819 ATI Mach8/32 check in files
+ *   05/18/94  @V2.1MNH14         WD90C33 Parse new style PMI
+ *   06/22/94  @V2.1JWK02 D 87347 Define Tseng Chip Names for consistant use
+ *   07/25/94  @V2.1JWK03 D 89911 Define Tseng W32xD Revisions
+ *   07/28/94  @V2.1YEE09 D 88172 Define a Chips and Technologies chiptype
+ *   08/02/94  @V2.1MNH25 D 91551 Fix various DAC programming problems
+ *   08/19/94  @V2.1MNH37 D 94209 Add more DAC detection
+ *   09/01/94  @V2.1YEE10 D 89853 Add support for S3864 with ICD2061 clock chip
+ *   09/10/94  @V2.2TSU00 D 86373 Weitek: PCI screen01 incorrect
+ *   09/15/94  @V2.1YEE11         Identify DAC as RGB (blue first) or BGR (red first)
+ *   09/17/94  @V2.2DAI01 D 92593 Adding monitor configuration enhancements.
+ *   09/26/94  @V2.2SEN05 D 97637 Changing Music DAC 4910 from BGR to RGB.
+ *   10/05/94  @V2.1MNH51 D101610 Increase size of CLEANDATA for MACH32
+ *   10/25/94  @V2.2JWK23 D103192 TSENG Rev D wont install
+ *   11/30/94  @V3.0YEE01 D105950 Support S3 964
+ *   01/20/95  @V3.0YEE02 D 99391 Support TBird-Enhanced (800x600 flat panel)
+ *   01/16/95  @V3.0YEE03 D114992 Add new chip manufacturers
+ *   01/24/95  @V3.0ITO01         ThinkPad 230 Support (IBM-J local)
+ *   04/19/95  @V3.0DAI01 D119247 Add DevEscape functions and structures for extra capability support
+ *   04/28/95  @V3.0YEE04 D120303 Treat ICS5342 unique from ICS5341
+ *   05/17/95  @V3.0JWK04 D113889 Add Toshiba manufacturer and models
+ *   05/30/95  @V3.0JWK11 D123835 allow displayless machines to init.  Requires
+ *                                /nodisplay on device driver statement in config.sys
+ *   07/25/95  @IBMJ-S3GEN   D386 More S3 chips support
+ *   07/27/95  @V3.0JWK18 D131213 fix AT&T 408/409/499 DAC programming
+ *   08/02/95  @V3.0JWK21 D131829 Identify and Support ATI MACH64 version 'CT'
+ *   09/11/95  @V3.2SEN01 D133791 Adding real mode software interrupt support to
+ *                                VIDEOPMI.
+ *   09/14/95  @V3.0JWK25 D126118 NEC C24 prevent 800x600x64k.  Add NEC Manufacturer and model
+ *   11/10/95  @V3.2JWK09 D143505 provide compatability with new VIDEO_ADAPTER structures
+ *   12/15/95  @V3.0TSU00         Make videopmi backward compatible
+ *   02/12/96  @V3.1MNH01 D148203 Merge DBCS-J source w/SBCS source
+ *   02/14/96  @V3.2TSU00 D148283 Merlin PBE, support linear aperture
+ *   02/16/96  @V3.0YEE06 D148329 APM support
+ *   05/14/96  @V3.1MNH10 D151513 S3 Trio Chips Identification
+ *****************************************************************************/
+
+/* NOINC */
+
+#include <svgapmi.h>
+
+/* INC */
+
+#define INCL_DOSERRORS
+#define MAX_LOCKUNLOCKCMD       40                              /*@V2.1MNH08*/
+#define MAX_CLEANDATA          200      /* Includes DACs */     /*@V3.0YEE01*/
+#define MAX_SETBANK_CMD         25                              /*@V2.1MNH14*/
+#define MAX_GETBANK_CMD         20                              /*@V2.1MNH14*/
+#define MAX_MODESET_CMD         84                              /*@V2.1MNH14*/
+
+
+#define DEFAULT_ADAPTER       (-1)
+#define UNKNOWN_ADAPTER         0
+#define VIDEO7_ADAPTER          1       /* bugbug line up with cleanups! */
+#define TRIDENT_ADAPTER         2
+#define TSENG_ADAPTER           3
+#define WESTERNDIG_ADAPTER      4
+#define ATI_ADAPTER             5
+#define IBM_ADAPTER             6
+#define CIRRUS_ADAPTER          7
+#define S3_ADAPTER              8
+#define CHIPS_ADAPTER           9                      /* @V2.1YEE05 */
+#define WEITEK_ADAPTER          10                     /* @V2.1MNH00 */
+#define NUMBER9_ADAPTER         11                     /* @V2.1YEE10 */
+#define GENERIC_PCISVGA_ADAPTER 12                      //@senja
+#define OAK_ADAPTER             13                     /* @V3.0YEE03 */
+#define MATROX_ADAPTER          14                     /* @V3.0YEE03 */
+#define BROOKTREE_ADAPTER       15                     /* @V3.0YEE03 */
+#define NVIDIA_ADAPTER          16                     /* @V3.0YEE03 */
+#define ALLIANCE_ADAPTER        17                     /* @V3.0YEE03 */
+#define AVANCE_ADAPTER          18                     /* @V3.0YEE03 */
+#define MEDIAVISION_ADAPTER     19                     /* @V3.0YEE03 */
+#define ARKLOGIC_ADAPTER        20                     /* @V3.0YEE03 */
+#define RADIUS_ADAPTER          21                     /* @V3.0YEE03 */
+#define THREE_D_LABS_ADAPTER    22                     /* @V3.0YEE03 */
+#define NCR_ADAPTER             23                     /* @V3.0YEE03 */
+#define IIT_ADAPTER             24                     /* @V3.0YEE03 */
+#define APPIAN_ADAPTER          25                     /* @V3.0YEE03 */
+#define SIERRA_ADAPTER          26                     /* @V3.0YEE03 */
+#define CORNERSTONE_ADAPTER     27                     /* @V3.0YEE03 */
+#define DIGITAL_ADAPTER         28                     /* @V3.0YEE03 */
+#define COMPAQ_ADAPTER          29                     /* @V3.0YEE03 */
+#define INFOTRONIC_ADAPTER      30                     /* @V3.0YEE03 */
+#define OPTI_ADAPTER            31                     /* @V3.0YEE03 */
+#define NULL_ADAPTER            32                     /* @V3.0JWK11 */
+ /* remember to update SVGA_LASTADAPTER when adding new adapter support */
+
+#define SVGA_FIRSTADAPTER       VIDEO7_ADAPTER         /* @V2.1YEE03 */
+#define SVGA_LASTADAPTER        NULL_ADAPTER           /* @V3.0JWK11 */
+
+/* @V2.1MNH13 start */
+#ifdef FAMILY2
+  #define ORCHID_MC_ADAPTER     2       /* @V2.0SEN06 */
+  #define ORCHID_MC_ID          0x86    /* @V2.0SEN06 */
+#endif
+
+/*
+** DAC types
+*/
+
+#define VGA_DAC           0                                     /*@V2.1MNH23*/
+#define DEFAULT_DAC       VGA_DAC                               /*@V2.1MNH23*/
+#define HICOLOR_DAC       1      /* Unidentified */             /*@V2.1MNH17*/
+#define WINBOND_DAC       HICOLOR_DAC                           /*@V2.1MNH23*/
+#define BT485_DAC         2      /* Brooktree 485 */            /*@V2.1MNH20*/
+#define Weitek_BT485DAC   3      /* BT485 used by Weitek      */
+#define SC15025_DAC       4      /* SC15025                   */
+#define SierraDAC         SC15025_DAC /* Use more specific name! */
+#define ATT490_DAC        5
+#define ATTDAC            ATT490_DAC /* Use more specific name! */
+#define MU9C1880_DAC      6      /* MU9C4870, MU9C1880, SS2410*/
+#define MU9C4870_DAC      MU9C1880_DAC                          /*@V2.1MNH23*/
+
+#define TRUECOLOR_DAC     7                                     /*@V2.1MNH17*/
+#define IMSG173_DAC       8      /*These DACS identified, but not programmed*/
+#define InmosDAC          IMSG173_DAC /* Use more specific name! */
+#define CH8398_DAC        9
+#define ChrontelDAC       CH8398_DAC /* Use more specific name! */
+#define CIRRUS_DAC       10
+#define ICS5341_DAC      11
+#define SGS1702_DAC      12
+#define SGSThomsonDAC16  SGS1702_DAC /* Use more specific name! */
+#define SGS1703_DAC      13                                     /*@V2.1MNH23*/
+#define MU9C4910_DAC     14      /* MU9C4910 (blue byte first) */
+                                 /*  note that the MU9C1880 is also true color, but */
+                                 /*       it does not need to be identified because */
+                                 /*       behaves like the others in its group      */
+#define MusicDAC16RGB    MU9C4910_DAC /* Use more specific name! */
+#define ATI68830_DAC     15      /* ATI 68830 & compatible  @V2.1MNH29  */
+#define S3SDAC_DAC       16      /* S3 SDAC                 @V2.1MNH29  */
+#define ATT498_DAC       17      /* AT&T 498 CLOCKDAC ID=$98 no programmable clocks      @V2.1MNH29  */
+#define SGS1700_DAC      18      /* SGS 1700 DAC            @V2.1MNH29  */
+#define TLC34075_DAC     19      /* Texas Instruments TLC34075*/
+#define ATI68875_DAC     TLC34075_DAC
+#define BT476_DAC        20      /* Brooktree 476/478       @V2.1MNH29  */
+#define BT478_DAC        BT476_DAC
+#define BT481_DAC        21      /* Brooktree 481/482       @V2.1MNH29  */
+#define BT482_DAC        BT481_DAC
+#define ATI68860_DAC     22      /* ATI 68860/68880         @V2.1MNH29  */
+#define MU9CBUG_DAC      23
+#define CH8391_DAC       24
+#define W82C490_DAC      25
+#define ATT491_DAC       26
+#define ATT492_DAC       27
+#define ATT493_DAC       28
+#define ATT497_DAC       29
+#define WD90C24_DAC      30
+#define MU9C9910_DAC     31      /* (blue byte first) */
+#define ATT409_DAC       32          //ID=$09 16 bit pixel I/O
+#define ATT499_DAC       33          //ID=$99 24 bit Pixel I/0  /*@V3.0YEE03*/
+#define TI3025_DAC       34      /* TI Viewpoint 3025 CLOCKDAC*//*@V3.0YEE01*/
+#define TI3020_DAC       35      /* TI Viewpoint 3020 CLOCKDAC*//*@V3.0YEE03*/
+#define ICS5342_DAC      36                                     /*@V3.0YEE04*/
+#define ATT408_DAC       ATT409_DAC  //ID=$09 HW pinouts diff   /*@V3.0JWK18*/
+#define NULL_DAC         37                                     /*@V3.0JWK11*/
+#define IMBEDDED_DAC     38      //ATI MACH64 'CT'              /*@V3.0JWK21*/
+#define S3TRIO_DAC       39      /* S3 TRIO DAC               *//*@V3.0YEE05*/
+#define MAX_DAC          40                                     /*@V3.0JWK21*/
+
+#define VGADAC_NAME     "VGA_RGB"                               /*@V2.1MNH23*/
+#define HICOLOR_NAME    "HICOLOR_RGB"                           /*@V2.1MNH17*/
+#define BT485_NAME      "BT485_RGB"                             /*@V2.1MNH20*/
+#define VIPER_NAME      "BT485_RGB"
+#define SC15025_NAME    "SC15025_RGB"
+#define ATT490_NAME     "ATT20C490_RGB"                         /*@V2.1MNH29*/
+#define MU9C1880_NAME   "MU9C1880_BGR"
+#define TRUECOLOR_NAME  "TRUECOLOR_RGB"                         /*@V2.1MNH17*/
+#define IMSG173_NAME    "IMSG173_RGB"
+#define CH8398_NAME     "CH8398_RGB"
+#define CIRRUS_NAME     "CIRRUS_RGB"
+#define ICS5341_NAME    "ICS5341_RGB"
+#define SGS1702_NAME    "SGS1702_RGB"
+#define SGS1703_NAME    "SGS1703_RGB"                           /*@V2.1MNH23*/
+#define MU9C4910_NAME   "MU9C4910_RGB"  /* was BGR */           /*@V2.2SEN05*/
+#define ATI68830_NAME   "ATI68830_RGB"                          /*@V2.1MNH20*/
+#define S3SDAC_NAME     "S3SDAC_RGB"                            /*@V2.1YEE02*/
+#define ATT498_NAME     "ATT20C498_RGB"                         /*@V2.1MNH29*/
+#define SGS1700_NAME    "SGS1700_RGB"                           /*@V2.1YEE02*/
+#define TLC34075_NAME   "TLC34075_RGB"                          /*@V2.1MNH20*/
+#define ATI68875_NAME   "ATI68875_RGB"                          /*@V2.1MNH20*/
+#define BT476_NAME      "BT476_RGB"                             /*@V2.1MNH20*/
+#define BT481_NAME      "BT481_RGB"                             /*@V2.1MNH20*/
+#define ATI68860_NAME   "ATI68860_RGB"                          /*@V2.1MNH20*/
+#define MU9CBUG_NAME    "MU9C1880BUG_BGR"                       /*@V2.1MNH29*/
+#define CH8391_NAME     "CH8391_RGB"                            /*@V2.1MNH29*/
+#define W82C490_NAME    "W82C490_RGB"                           /*@V2.1MNH29*/
+#define ATT491_NAME     "ATT20C491_RGB"                         /*@V2.1MNH29*/
+#define ATT492_NAME     "ATT20C492_RGB"                         /*@V2.1MNH29*/
+#define ATT493_NAME     "ATT20C493_RGB"                         /*@V2.1MNH29*/
+#define ATT497_NAME     "ATT20C497_RGB"                         /*@V2.1MNH29*/
+#define WD90C24_NAME    "WD90C24_RGB"                           /*@V2.1MNH35*/
+#define MU9C9910_NAME   "MU9C9910_RGB"                          /*@V2.1MNH37*/
+#define ATT499_NAME     "ATT20C499_RGB"                         /*@V3.0JWK18*/
+#define ATT498_NAME     "ATT20C498_RGB"                         /*@V3.0JWK18*/
+#define ATT409_NAME     "ATT20C409_RGB"                         /*@V2.1YEE10*/
+#define TI3025_NAME     "TVP3025_RGB" /* TI Viewpoint 3025 DAC*//*@V3.0YEE01*/
+#define TI3020_NAME     "TVP3020_RGB" /* TI Viewpoint 3020 DAC*//*@V3.0YEE03*/
+#define ICS5342_NAME    "ICS5342_RGB"                           /*@V3.0YEE04*/
+#define NULL_DAC_NAME   "NULLDAC_RGB"                           /*@V3.0JWK11*/
+#define IMBEDDED_NAME   "IMBEDDED_RGB"/*ATI MACH64CT internal *//*@V3.0JWK21*/
+#define S3TRIODAC_NAME  "S3_RGB"      /* S3 TRIO DAC          *//*@V3.0YEE05*/
+
+/* NOINC */
+typedef struct _DACINFO {       /* dac */
+  USHORT        DACFamily;
+  USHORT        DACType;
+} DACINFO;
+
+/* INC */
+
+#define WEITEK_P9000_INCREMENT  0x0040 //Spacing between potential bases.
+#define WEITEK_P9000_REGISTERS  0x0010 //Base address offset for registers.
+#define WEITEK_P9000_VRAM       0x0020 //Base address offset for VRAM.
+#define WEITEK_P9000_SYSCONFIG  0x0004 //Offset for config reg
+#define WEITEK_P9000_INTERRUPT  0x0008 //Offset for interrupt reg
+#define WEITEK_P9000_ENABLE     0x000c //Offset for interrupt enable reg
+#define WEITEK_P9000_MEMCONFIG  0x0184 //Offset for memory config reg
+#define WEITEK_P9000_REGLENGTH  0x2000 //Length for register addressability
+/* @V2.1MNH13 end   */
+
+#define UNKNOWN_CHIP            0
+
+#define VIDEO7_HT205_CHIP       1
+#define VIDEO7_HT208_CHIP       2
+#define VIDEO7_HT209_CHIP       3
+#define MAX_VIDEO7_CHIP         VIDEO7_HT209_CHIP               /*@V2.1MNH01*/
+
+#define VIDEO7_HT205_NAME       "HT205"                         /*@V2.1MNH20*/
+#define VIDEO7_HT208_NAME       "HT208"                         /*@V2.1MNH20*/
+#define VIDEO7_HT209_NAME       "HT209"                         /*@V2.1MNH20*/
+
+#define TRIDENT_8800_CHIP       1
+#define TRIDENT_8900_CHIP       2
+#define MAX_TRIDENT_CHIP        TRIDENT_8900_CHIP               /*@V2.1MNH01*/
+
+#define TRIDENT_8800_NAME       "TR8800"                        /*@V2.1MNH20*/
+#define TRIDENT_8900_NAME       "TR8900"                        /*@V2.1MNH20*/
+
+
+#define TSENG_ET3000_CHIP       1
+#define TSENG_ET4000_CHIP       2
+#define TSENG_ET4000W32_CHIP    3    /* w32                   @V2.1MNH01*/
+#define TSENG_ET4000W32I_CHIP   4    /* w32i (level a)        @V2.1JWK01*/
+#define TSENG_ET4000W32IB_CHIP  5    /* w32i level b          @V2.1JWK01*/
+#define TSENG_ET4000W32IC_CHIP  6    /* w32i level c          @V2.1JWK01*/
+#define TSENG_ET4000W32PA_CHIP  7    /* w32p level a          @V2.1JWK01*/
+#define TSENG_ET4000W32PB_CHIP  8    /* w32p level b          @V2.1JWK01*/
+#define TSENG_ET4000W32PC_CHIP  9    /* w32p level c          @V2.1JWK01*/
+#define TSENG_ET4000W32ID_CHIP 10    /* w32i level d          @V2.1JWK03*/
+#define TSENG_ET4000W32PD_CHIP 11    /* w32p level d          @V2.1JWK03*/
+#define TSENG_ET4000W32PX_CHIP 12    /* all others            @V2.1JWK23*/
+#define MAX_TSENG_CHIP         12
+
+#define TSENG_ET3000_NAME       "ET3000"                        /*@V2.1JWK02*/
+#define TSENG_ET4000_NAME       "ET4000"                        /*@V2.1JWK02*/
+#define TSENG_ET4000W32_NAME    "ET4000W32"                     /*@V2.1JWK02*/
+#define TSENG_ET4000W32I_NAME   "ET4000W32IREVA"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32IB_NAME  "ET4000W32IREVB"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32IC_NAME  "ET4000W32IREVC"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32PA_NAME  "ET4000W32PREVA"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32PB_NAME  "ET4000W32PREVB"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32PC_NAME  "ET4000W32PREVC"                /*@V2.1JWK02*/
+#define TSENG_ET4000W32ID_NAME  "ET4000W32IREVD"                /*@V2.1JWK03*/
+#define TSENG_ET4000W32PD_NAME  "ET4000W32PREVD"                /*@V2.1JWK03*/
+#define TSENG_ET4000W32PX_NAME  "ET4000W32PREVC_COMPATABLE"     /*@V2.1JWK23*/
+
+#define WESTERNDIG_PVGA1A_CHIP  1
+#define WESTERNDIG_WD9000_CHIP  2 /* PVGA1B */
+#define WESTERNDIG_WD9011_CHIP  3 /* PVGA1C */
+#define WESTERNDIG_WD9030_CHIP  4 /* PVGA1D */
+#define WESTERNDIG_WD9026_CHIP  5 /* PVGA1F */                  /*@V2.1MNH01*/
+#define WESTERNDIG_WD9027_CHIP  6                               /*@V2.1MNH01*/
+#define WESTERNDIG_WD9031_CHIP  7 /* PVGA1DW */                 /*@V2.1MNH01*/
+#define WESTERNDIG_WD9024_CHIP  8                               /*@V2.1MNH01*/
+#define WESTERNDIG_WD9033_CHIP  9 /* PVGA2DW */                 /*@V2.1MNH01*/
+#define MAX_WESTERNDIG_CHIP     WESTERNDIG_WD9033_CHIP          /*@V2.1MNH01*/
+
+#define WESTERNDIG_PVGA1A_NAME  "PVGA1A"                        /*@V2.1MNH20*/
+#define WESTERNDIG_WD9000_NAME  "PVGA1B"                        /*@V2.1MNH20*/
+#define WESTERNDIG_WD9011_NAME  "PVGA1C"                        /*@V2.1MNH20*/
+#define WESTERNDIG_WD9030_NAME  "PVGA1D"                        /*@V2.1MNH20*/
+#define WESTERNDIG_WD9026_NAME  "WD90C26"                       /*@V2.1MNH20*/
+#define WESTERNDIG_WD9027_NAME  "WD90C27"                       /*@V2.1MNH20*/
+#define WESTERNDIG_WD9031_NAME  "WD90C31"                       /*@V2.1MNH20*/
+#define WESTERNDIG_WD9024_NAME  "WD90C24"                       /*@V2.1MNH20*/
+#define WESTERNDIG_WD9033_NAME  "WD90C33"                       /*@V2.1MNH20*/
+
+#define ATI_18800_CHIP          1 /*VGAWONDER*/
+#define ATI_28800_CHIP          2 /*VGAWONDER+/XL*/
+#define ATI_38800_CHIP          3 /*MACH8/GraphicsUltra*/       /*@V2.1MNH01*/
+#define ATI_68800_CHIP          4 /*MACH32/GraphicsUltraPro*/   /*@V2.1MNH01*/
+#define ATI_88800_CHIP          5 /*MACH64*/                    /*@V2.1MNH01*/
+#define ATI_88800CT_CHIP        6 /*MACH64CT*/                  /*@V3.0JWK21*/
+#define MAX_ATI_CHIP            ATI_88800CT_CHIP                /*@V3.0JWK21*/
+
+#define ATI_18800_NAME          "ATI18800"                      /*@V2.1MNH20*/
+#define ATI_28800_NAME          "ATI28800"                      /*@V2.1MNH20*/
+#define ATI_38800_NAME          "ATI38800MACH8"                 /*@V2.1MNH21*/
+#define ATI_68800_NAME          "ATI68800MACH32"                /*@V2.1MNH21*/
+#define ATI_88800_NAME          "ATI88800MACH64"                /*@V2.1MNH21*/
+#define ATI_88800CT_NAME        "ATI88800MACH64CT"              /*@V3.0JWK21*/
+
+#define IBM_SVGA_CHIP           1
+#define MAX_IBM_CHIP            IBM_SVGA_CHIP                   /*@V2.1MNH01*/
+
+#define IBM_SVGA_NAME           "IBMSVGA"                       /*@V2.1MNH20*/
+
+#define CIRRUS_5420_CHIP        1                               /*@V2.1YEE08*/
+#define CIRRUS_5422_CHIP        2
+#define CIRRUS_5424_CHIP        3
+#define CIRRUS_5426_CHIP        4
+#define CIRRUS_5428_CHIP        5                               /*@V2.1YEE02*/
+#define CIRRUS_5429_CHIP        6                               /*@V2.1YEE08*/
+#define CIRRUS_543X_CHIP        7                               /*@V2.1YEE08*/
+#define CIRRUS_5434_CHIP        8                               /*@V2.1YEE08*/
+#define CIRRUS_6235_CHIP        9                               /*@V3.0ITO01*/
+#define MAX_CIRRUS_CHIP         CIRRUS_6235_CHIP                /*@V3.0ITO01*/
+
+#define CIRRUS_5420_NAME        "GD5420"                        /*@V2.1MNH20*/
+#define CIRRUS_5422_NAME        "GD5422"                        /*@V2.1MNH20*/
+#define CIRRUS_5424_NAME        "GD5424"                        /*@V2.1MNH20*/
+#define CIRRUS_5426_NAME        "GD5426"                        /*@V2.1MNH20*/
+#define CIRRUS_5428_NAME        "GD5428"                        /*@V2.1MNH20*/
+#define CIRRUS_5429_NAME        "GD5429"                        /*@V2.1MNH20*/
+#define CIRRUS_543X_NAME        "GD543X"                        /*@V2.1MNH20*/
+#define CIRRUS_5434_NAME        "GD5434"                        /*@V2.1MNH20*/
+#define CIRRUS_6235_NAME        "GD6235"                        /*@V3.0ITO01*/
+
+#define S3_86C805_CHIP          1           /* 801 or 805 */
+#define S3_86C928_CHIP          2
+#define S3_86C911_CHIP          3           /* @V2.1YEE04 */
+#define S3_86C864_CHIP          4                               /*@V2.1MNH01*/
+//#define S3_DXP_CHIP              S3_86C864_CHIP               /*@IBMJ-S3GEN*/
+#define S3_86C964_CHIP          5                               /*@V2.1MNH01*/
+//#define S3_VXP_CHIP              S3_86C964_CHIP               /*@IBMJ-S3GEN*/
+
+/* These chip IDs added by S3 */                                /*@V3.1MNH10*/
+#define S3_86C868_CHIP          6                               /*@V3.1MNH10*/
+//#define S3_V868_CHIP             S3_86C868_CHIP               /*@V3.1MNH10*/
+#define S3_86C968_CHIP          7                               /*@V3.1MNH10*/
+//#define S3_V968_CHIP             S3_86C968_CHIP               /*@V3.1MNH10*/
+#define S3_86C732_CHIP          8                               /*@V3.1MNH10*/
+//#define S3_Trio32_CHIP           S3_86C732_CHIP               /*@V3.1MNH10*/
+#define S3_86C764_CHIP          9                               /*@V3.1MNH10*/
+//#define S3_Trio64_CHIP           S3_86C764_CHIP               /*@V3.1MNH10*/
+#define S3_86C765_CHIP         10                               /*@V3.1MNH10*/
+//#define S3_V765_CHIP             S3_86C765_CHIP               /*@V3.1MNH10*/
+#define S3_86CM65_CHIP         11 /* Aurora64V */               /*@V3.1MNH10*/
+#define S3_86C325_CHIP         12 /* ViRGE */                   /*@V3.1MNH10*/
+#define S3_86C988_CHIP         13 /* ViRGE/vX chip */           /*@V3.1MNH10*/
+#define S3_86C767_CHIP         14 /* Trio64UV+ */               /*@V3.1MNH10*/
+#define S3_86C765_FAMILY       15 /* Trio65V+ family compat */  /*@V3.1MNH10*/
+
+#define S3_86C924_CHIP         16                               /*@V3.1MNH10*/
+#define S3_86C866_CHIP         17                               /*@V3.1MNH10*/
+//#define S3_V866_CHIP             S3_86C866_CHIP               /*@V3.1MNH10*/
+#define S3_86C928PCI_CHIP      18                               /*@V3.1MNH10*/
+#define MAX_S3_CHIP              S3_86C928PCI_CHIP              /*@V3.1MNH10*/
+
+#define S3_86C805_NAME          "S386C80X"                      /*@V2.1MNH20*/
+#define S3_86C928_NAME          "S386C928"                      /*@V2.1MNH20*/
+#define S3_86C911_NAME          "S386C911"                      /*@V2.1MNH20*/
+#define S3_86C864_NAME          "VISION864"       /* S386C864 *//*@V3.1MNH10*/
+#define S3_86C964_NAME          "VISION964"       /* S386C964 *//*@V3.1MNH10*/
+
+#define S3_86C868_NAME          "VISION868"                     /*@V3.1MNH10*/
+//#define S3_V868_NAME            S3_86C868_NAME                /*@V3.1MNH10*/
+#define S3_86C968_NAME          "VISION968"                     /*@V3.1MNH10*/
+//#define S3_V968_NAME            S3_86C968_NAME                /*@V3.1MNH10*/
+#define S3_86C732_NAME          "S3TRIO32"                      /*@V3.1MNH10*/
+//#define S3_Trio32_NAME          S3_86C764_NAME                /*@V3.1MNH10*/
+#define S3_86C764_NAME          "S3TRIO64"                      /*@V3.1MNH10*/
+//#define S3_Trio64_NAME          S3_86C732_NAME                /*@V3.1MNH10*/
+#define S3_86C765_NAME          "S3TRIO64V+"                    /*@V3.1MNH10*/
+//#define S3_V765_NAME            S3_86C765_NAME                /*@V3.1MNH10*/
+#define S3_86CM65_NAME          "S3AURORA64V+"                  /*@V3.1MNH10*/
+#define S3_86C325_NAME          "S3VIRGE"                       /*@V3.1MNH10*/
+#define S3_86C988_NAME          "S3VIRGE/VX"                    /*@V3.1MNH10*/
+#define S3_86C767_NAME          "S3TRIO64UV+"                   /*@V3.1MNH10*/
+#define S3_86C765_FAMILY_NAME   "S3TRIO64V+COMPATIBLE"          /*@V3.1MNH10*/
+
+#define S3_86C924_NAME          "S386C924"                      /*@IBMJ-S3GEN*/
+#define S3_86C866_NAME          "S386C866"                      /*@V3.1MNH10*/
+//#define S3_V866_NAME            S3_86C866_NAME                /*@V3.1MNH10*/
+
+#define S3_86C928PCI_NAME       "S386C928PCI"                   /*@IBMJ-S3GEN*/
+
+#define CHIPS_FIRST_CHIP        1                /* bogus chip    @V2.1YEE09*/
+#define MAX_CHIPS_CHIP          1                               /*@V2.1YEE09*/
+
+#define WEITEK_P9000_CHIP       1                               /*@V2.1MNH01*/
+#define WEITEK_W5186_CHIP       2                               /*@V2.1MNH01*/
+#define WEITEK_W5286_CHIP       3                               /*@V2.1MNH01*/
+#define WEITEK_P9100_CHIP       4                               /*@V2.2TSU00*/
+#define MAX_WEITEK_CHIP         WEITEK_P9100_CHIP               /*@V2.2TSU00*/
+
+#define WEITEK_P9000_NAME       "P9000"                         /*@V2.1MNH20*/
+#define WEITEK_W5186_NAME       "W5186"                         /*@V2.1MNH20*/
+#define WEITEK_W5286_NAME       "W5286"                         /*@V2.1MNH20*/
+
+#define NULL_CHIP               1                               /*@V3.0JWK11*/
+#define MAX_NULL_CHIP           NULL_CHIP                       /*@V3.0JWK11*/
+                                                                /*@V3.0JWK11*/
+#define NULL_NAME               "NULL"                          /*@V3.0JWK11*/
+
+/*
+** OEM manufacturer defines.
+*/
+
+#define UNKNOWN_MANUFACTURER    0                               /*@V2.1MNH13*/
+#define DIAMOND_MANUFACTURER    1                               /*@V2.1YEE01*/
+#define ORCHID_MANUFACTURER     2                               /*@V2.1MNH01*/
+#define NUMBER9_MANUFACTURER    3                               /*@V2.1YEE04*/
+#define ARTIST_MANUFACTURER     4                               /*@V2.1YEE07*/
+#define LACUNA_MANUFACTURER     5                               /*@V2.1YEE07*/
+#define STB_MANUFACTURER        6                               /*@V2.2SEN02*/
+#define S3_MANUFACTURER         7                               /*@V2.1YEE10*/
+#define CIRRUS_MANUFACTURER     8
+#define MIROCRYSTAL_MANUFACTURER   9                            /*@V2.1YEE11*/
+#define VIDEOLOGIC_MANUFACTURER    10                           /*@V2.1YEE11*/
+#define THINKPAD_MANUFACTURER  11                               /*@V3.0YEE02*/
+#define TOSHIBA_MANUFACTURER   12                               /*@V3.0JWK04*/
+#define NEC_MANUFACTURER       13                               /*@V3.0JWK25*/
+#define IBM_VISION_MANUFACTURER    14                           /*@V3.1MNH01*/
+#define MANUFACTURER_MAX        IBM_VISION_MANUFACTURER         /*@V3.0MUT02*/
+#define DEFAULT_MANUFACTURER    UNKNOWN_MANUFACTURER            /*@V2.2SEN02*/
+
+/*
+** OEM manufacturer MODEL defines.
+*/
+
+#define UNKNOWN_MODEL           0                               /*@V3.0JWK04*/
+#define TOSHIBA_6600_MODEL      1                               /*@V3.0JWK04*/
+#define TOSHIBA_2100_MODEL      2                               /*@V3.0JWK04*/
+#define TOSHIBA_2100CS_MODEL    3                               /*@V3.0JWK04*/
+#define TOSHIBA_2100CT_MODEL    4                               /*@V3.0JWK04*/
+#define TOSHIBA_4700CS_MODEL    5                               /*@V3.0JWK04*/
+#define TOSHIBA_4700CT_MODEL    6                               /*@V3.0JWK04*/
+#define TOSHIBA_4800CT_MODEL    7                               /*@V3.0JWK04*/
+#define TOSHIBA_4850CT_MODEL    8                               /*@V3.0JWK04*/
+
+#define NEC_VERSA_MODEL         1                               /*@V3.0JWK25*/
+
+
+/* NOINC */
+typedef struct _ADAPTERS {      /* adp */
+  CHAR  *Name;
+  CHAR  *Manufacturer;
+  INT    ID;
+}ADAPTERS;
+
+typedef CHAR *CHIPNAMES;
+typedef CHIPNAMES *PCHIPNAMES;
+
+/*
+ * define CHIPS_INCL to include the following definitions.
+ */
+#ifdef CHIPS_INCL
+/*
+** This table contains adapter ID's as not to depend on the changes to
+** the ID's and their order. The ChipsetName table should be kept in sync
+** with the Adapters table.
+*/
+ADAPTERS Adapters [SVGA_LASTADAPTER + 0x01] =          /* @V2.2SENJA */
+{
+  {"UNKNOWN","Unknown",                         UNKNOWN_ADAPTER},
+  {"VIDEO7","Headland Technology, Inc.",        VIDEO7_ADAPTER},
+  {"TRIDENT","Trident Microsystems, Inc.",      TRIDENT_ADAPTER},
+  {"TSENG","Tseng Labs, Inc.",                  TSENG_ADAPTER},
+  {"WESTERNDIGITAL","Western Digital Corporation",WESTERNDIG_ADAPTER},
+  {"ATI","ATI Technologies Inc.",               ATI_ADAPTER},
+  {"IBM","IBM Corporation",                     IBM_ADAPTER},
+  {"CIRRUS","Cirrus Logic, Inc.",               CIRRUS_ADAPTER},
+  {"S3","S3 Incorporated",                      S3_ADAPTER},
+  {"CHIPS","Chips and Techologies",             CHIPS_ADAPTER},
+  {"WEITEK","WEITEK Corporation",               WEITEK_ADAPTER},
+  {"NUMBER9","Number Nine Corporation",         NUMBER9_ADAPTER},
+  {"GENERICPCI","Unknown",                      GENERIC_PCISVGA_ADAPTER},
+  {"OAK","Oak Technology, Inc",                 OAK_ADAPTER},         /* @V3.0YEE03 */
+  {"MATROX","Matrox",                           MATROX_ADAPTER},      /* @V3.0YEE03 */
+  {"BROOKTREE","Brooktree Corporation",         BROOKTREE_ADAPTER},   /* @V3.0YEE03 */
+  {"NVIDIA","nVIDIA",                           NVIDIA_ADAPTER},      /* @V3.0YEE03 */
+  {"ALLIANCE","Alliance Semiconductor Corporation", ALLIANCE_ADAPTER},/* @V3.0YEE03 */
+  {"AVANCE","Avance Logic",                     AVANCE_ADAPTER},      /* @V3.0YEE03 */
+  {"MEDIAVISION","Media Vision",                MEDIAVISION_ADAPTER}, /* @V3.0YEE03 */
+  {"ARKLOGIC","Ark Logic, Inc.",                ARKLOGIC_ADAPTER},    /* @V3.0YEE03 */
+  {"RADIUS","Radius",                           RADIUS_ADAPTER},      /* @V3.0YEE03 */
+  {"3DLABS","3D Labs Inc.",                     THREE_D_LABS_ADAPTER},/* @V3.0YEE03 */
+  {"NCR","NCR Corporation",                     NCR_ADAPTER},         /* @V3.0YEE03 */
+  {"IIT","IIT",                                 IIT_ADAPTER},         /* @V3.0YEE03 */
+  {"APPIAN","Appian Technology",                APPIAN_ADAPTER},      /* @V3.0YEE03 */
+  {"SIERRA","Sierra Semiconductor Inc.",        SIERRA_ADAPTER},      /* @V3.0YEE03 */
+  {"CORNERSTONE","Cornerstone Technology",      CORNERSTONE_ADAPTER}, /* @V3.0YEE03 */
+  {"DIGITAL","Digital Equipment Corporation",   DIGITAL_ADAPTER},     /* @V3.0YEE03 */
+  {"COMPAQ","Compaq Computer Corporation",      COMPAQ_ADAPTER},      /* @V3.0YEE03 */
+  {"INFOTRONIC","INFOTRONIC",                   INFOTRONIC_ADAPTER},  /* @V3.0YEE03 */
+  {"OPTI","OPTi, Inc.",                         OPTI_ADAPTER},        /* @V3.0YEE03 */
+  {"NULL","null",                               NULL_ADAPTER},        /* @V3.0JWK11 */
+};
+CHIPNAMES ppszUnknownChipNames [1] =
+  {
+    "UNKNOWN",
+  };
+CHIPNAMES ppszVideo7ChipNames [MAX_VIDEO7_CHIP] =               /*@V2.1MNH20*/
+  { /* Video 7==Headland Technology */                          /*@V2.1MNH01*/
+    VIDEO7_HT205_NAME,                                          /*@V2.1MNH20*/
+    VIDEO7_HT208_NAME,                                          /*@V2.1MNH20*/
+    VIDEO7_HT209_NAME,                                          /*@V2.1MNH20*/
+  };
+CHIPNAMES ppszTridentChipNames [MAX_TRIDENT_CHIP] =             /*@V2.1MNH20*/
+  { /* Trident */                                               /*@V2.1MNH01*/
+    TRIDENT_8800_NAME,                                          /*@V2.1MNH20*/
+    TRIDENT_8900_NAME,                                          /*@V2.1MNH20*/
+  };
+CHIPNAMES ppszTsengChipNames [MAX_TSENG_CHIP] =                 /*@V2.1MNH20*/
+  { /* Tseng */
+    TSENG_ET3000_NAME,                                          /*@V2.1MNH01*/
+    TSENG_ET4000_NAME,
+    TSENG_ET4000W32_NAME,
+    TSENG_ET4000W32I_NAME,
+    TSENG_ET4000W32IB_NAME,
+    TSENG_ET4000W32IC_NAME,                                     /*@V2.1JWK01*/
+    TSENG_ET4000W32PA_NAME,                                     /*@V2.1JWK01*/
+    TSENG_ET4000W32PB_NAME,                                     /*@V2.1JWK01*/
+    TSENG_ET4000W32PC_NAME,                                     /*@V2.2JWK03*/
+    TSENG_ET4000W32ID_NAME,                                     /*@V2.2JWK03*/
+    TSENG_ET4000W32PD_NAME,                                     /*@V2.2JWK03*/
+    TSENG_ET4000W32PX_NAME,                                     /*@V3.0JWK23*/
+  };
+CHIPNAMES ppszWDChipNames [MAX_WESTERNDIG_CHIP] =               /*@V2.1MNH20*/
+  { /* Western Digital */                                       /*@V2.1MNH01*/
+    WESTERNDIG_PVGA1A_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9000_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9011_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9030_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9026_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9027_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9031_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9024_NAME,                                     /*@V2.1MNH20*/
+    WESTERNDIG_WD9033_NAME,                                     /*@V2.1MNH20*/
+  };
+CHIPNAMES ppszATIChipNames [MAX_ATI_CHIP] =                     /*@V2.1MNH20*/
+  { /* ATI */                                                   /*@V2.1MNH01*/
+    ATI_18800_NAME,                                             /*@V2.1MNH20*/
+    ATI_28800_NAME,                                             /*@V2.1MNH20*/
+    ATI_38800_NAME,                                             /*@V2.1MNH20*/
+    ATI_68800_NAME,                                             /*@V2.1MNH20*/
+    ATI_88800_NAME,                                             /*@V2.1MNH20*/
+    ATI_88800CT_NAME,                                           /*@V3.0JWK21*/
+  };
+CHIPNAMES ppszIBMChipNames [MAX_IBM_CHIP] =                     /*@V2.1MNH20*/
+  { /* IBM */                                                   /*@V2.1MNH01*/
+    IBM_SVGA_NAME,                                              /*@V2.1MNH20*/
+  };
+CHIPNAMES ppszCirrusChipNames [MAX_CIRRUS_CHIP] =               /*@V2.1MNH20*/
+  { /* Cirrus Logic */                                          /*@V2.1MNH01*/
+    CIRRUS_5420_NAME,                                           /*@V2.1YEE31*/
+    CIRRUS_5422_NAME,
+    CIRRUS_5424_NAME,
+    CIRRUS_5426_NAME,
+    CIRRUS_5428_NAME,                                           /*@V2.1MNH01*/
+    CIRRUS_5429_NAME,                                           /*@V2.1YEE31*/
+    CIRRUS_543X_NAME,                                           /*@V2.1YEE31*/
+    CIRRUS_5434_NAME,
+    CIRRUS_6235_NAME,                                           /*@V3.0ITO01*/
+  };
+CHIPNAMES ppszS3ChipNames [MAX_S3_CHIP] =                       /*@V2.1MNH20*/
+  { /* S3 */                                                    /*@V2.1MNH01*/
+    S3_86C805_NAME,                                             /*@V2.1MNH20*/
+    S3_86C928_NAME,                                             /*@V2.1MNH20*/
+    S3_86C911_NAME,                                             /*@V2.1MNH20*/
+    S3_86C864_NAME,                                             /*@V2.1MNH20*/
+    S3_86C964_NAME,                                             /*@V2.1MNH20*/
+
+    S3_86C868_NAME,                                             /*@V3.1MNH10*/
+    S3_86C968_NAME,                                             /*@V3.1MNH10*/
+    S3_86C732_NAME,                                             /*@V3.1MNH10*/
+    S3_86C764_NAME,                                             /*@V3.1MNH10*/
+    S3_86C765_NAME,                                             /*@V3.1MNH10*/
+    S3_86CM65_NAME,                                             /*@V3.1MNH10*/
+    S3_86C325_NAME,                                             /*@V3.1MNH10*/
+    S3_86C988_NAME,                                             /*@V3.1MNH10*/
+    S3_86C767_NAME,                                             /*@V3.1MNH10*/
+    S3_86C765_FAMILY_NAME,                                      /*@V3.1MNH10*/
+
+    S3_86C924_NAME,                                             /*@IBMJ-S3GEN*/
+    S3_86C928PCI_NAME,                                          /*@IBMJ-S3GEN*/
+  };
+CHIPNAMES ppszWeitekChipNames [MAX_WEITEK_CHIP] =               /*@V2.1MNH20*/
+  { /* Weitek */                                                /*@V2.1MNH01*/
+    WEITEK_P9000_NAME,                                          /*@V2.1MNH20*/
+    WEITEK_W5186_NAME,                                          /*@V2.1MNH20*/
+    WEITEK_W5286_NAME,                                          /*@V2.1MNH20*/
+  };
+PCHIPNAMES ChipsetName [SVGA_LASTADAPTER + 0x01] =              /*@V2.1MNH20*/
+{
+  ppszUnknownChipNames,                                         /*@V2.1MNH20*/
+  ppszVideo7ChipNames,                                          /*@V2.1MNH20*/
+  ppszTridentChipNames,                                         /*@V2.1MNH20*/
+  ppszTsengChipNames,                                           /*@V2.1MNH20*/
+  ppszWDChipNames,                                              /*@V2.1MNH20*/
+  ppszATIChipNames,                                             /*@V2.1MNH20*/
+  ppszIBMChipNames,                                             /*@V2.1MNH20*/
+  ppszCirrusChipNames,                                          /*@V2.1MNH20*/
+  ppszS3ChipNames,                                              /*@V2.1MNH20*/
+  ppszUnknownChipNames,                                         /*@V2.1MNH20*/
+  ppszWeitekChipNames,                                          /*@V2.1MNH20*/
+};
+#endif
+/*
+** DIF subsystem defines
+*/
+typedef struct _MONMODEINFO { /* mmi */
+        USHORT            usXResolution;
+        USHORT            usYResolution;
+        BYTE              bVertRefresh;
+        BYTE              bHorizRefresh;
+        BYTE              bVPolarityPos;
+        BYTE              bHPolarityPos;
+} MONMODEINFO;
+#define MAX_PATH_NAME  256
+#define MAX_MONITOR_LEN   128   /* length of name string */
+#define MAX_MONITOR_MODES 10    /* up to 10 modes per monitor */
+typedef struct _MonInfo { /* mi */
+        CHAR             szMonitor[MAX_MONITOR_LEN];
+        MONMODEINFO      ModeInfo[MAX_MONITOR_MODES];
+} MONITORINFO, FAR *PMONITORINFO;
+
+#define DIF_SERVICE_DLL_NAME   "VIDEOCFG"
+#define VCFG_RESOURCE_DLL_NAME "VCFGMRI"
+
+#define SVGA_DATAFNAME         "svgadata.pmi"
+#define VIDEO_CFGFNAME         "video.cfg"
+#define MONITOR_FNAME          "monitor.dif"
+#define PRIVATE_MONITOR_FNAME  "private.dif"                    /*@V3.0DAI01*/
+
+/*
+**  DevEscape functions and structure for driver extra capabilities that need
+**  to be configured by VIDEOCFG.DLL
+*/
+
+#define  DEVESC_QUERYDRIVERCAPS      40010L                     /*@V3.0DAI01*/
+#define  DEVESC_QUERYDRIVERCAPSLIST  40011L                     /*@V3.0DAI01*/
+#define  DEVESC_SETDRIVERCAPSVALUE   40012L                     /*@V3.0DAI01*/
+                                                                /*@V3.0DAI01*/
+#define CAPSTYPE_BOOLEAN                 1L                     /*@V3.0DAI01*/
+#define CAPSTYPE_AGGREGATE_INT           2L                     /*@V3.0DAI01*/
+#define CAPSTYPE_AGGREGATE_STRING        3L                     /*@V3.0DAI01*/
+                                                                /*@V3.0DAI01*/
+typedef struct _DRIVERCAPS                                      /*@V3.0DAI01*/
+{                                                               /*@V3.0DAI01*/
+   ULONG  ulCb;                                                 /*@V3.0DAI01*/
+   CHAR   szCapsDesc[256];                                      /*@V3.0DAI01*/
+   CHAR   szHelpFileName[256];                                  /*@V3.0DAI01*/
+   ULONG  ulHelpId;                                             /*@V3.0DAI01*/
+   ULONG  ulCapsType;                                           /*@V3.0DAI01*/
+   ULONG  ulValueMemberSize;                                    /*@V3.0DAI01*/
+   ULONG  ulNumValueMember;                                     /*@V3.0DAI01*/
+   PVOID  pValueList;                                           /*@V3.0DAI01*/
+   PVOID  pCurrentValue;                                        /*@V3.0DAI01*/
+   PVOID  pDefaultValue;                                        /*@V3.0DAI01*/
+   BOOL   bDefaultValueSupported;                               /*@V3.0DAI01*/
+   BOOL   bStaticCaps;                                          /*@V3.0DAI01*/
+} DRIVERCAPS, *PDRIVERCAPS;                                     /*@V3.0DAI01*/
+
+/*
+** Functions exported by VIDEOCFG.DLL.
+*/
+
+/* Begin @V2.2DAI01                                                    */
+/* These functions are exported only to PM aware apps. Include PMWIN.H */
+#ifdef MRESULT
+BOOL EXPENTRY QueryScreenPageData(PHMODULE phmodResourceMRI,
+                                  PUSHORT  pusDlgId,
+                                  PSZ      pszName,
+                                  PUSHORT  pusHelpId,
+                                  PSZ      pszDlgProcName,
+                                  BOOL     bPaletteManagedDisplay);
+BOOL EXPENTRY QueryDisplayTypePageData(PHMODULE phmodResourceMRI,
+                                       PUSHORT  pusDlgId,
+                                       PSZ      pszName,
+                                       PUSHORT  pusHelpId,
+                                       PSZ      pszDlgProcName);
+MRESULT EXPENTRY ScreenDlgProc(HWND hwndDlg, USHORT msg, MPARAM mp1, MPARAM mp2);
+MRESULT EXPENTRY DIF_DisplayTypeDlgProc(HWND hwndDlg, USHORT msg, MPARAM mp1, MPARAM mp2);
+MRESULT EXPENTRY DMQS_DisplayTypeDlgProc(HWND hwndDlg, USHORT msg, MPARAM mp1, MPARAM mp2);
+#endif
+/* End @V2.2DAI01 */
+
+APIRET EXPENTRY QueryNumMonitors(ULONG *pulNumMonitors);
+APIRET EXPENTRY GetAllMonitors(MONITORINFO *pMonitors);
+APIRET EXPENTRY AddMonitorData(PSZ pszMonitorFileName, MONITORINFO *pNewMonitor);    /* @V3.0DAI01 */
+APIRET EXPENTRY GetCurrentCfg(ADAPTERINFO *pAdapter,MONITORINFO *pMonitor);
+APIRET EXPENTRY SetCurrentCfg(ADAPTERINFO *pAdapter,MONITORINFO *pMonitor);
+BOOL   EXPENTRY GetCurrentDesktopMode(PVIDEO_ADAPTER pVideoAdapter);                 /* @V3.0DAI01 */
+/*
+** 16 entry point into the VIDEOCFG.DLL
+*/
+APIRET VIDEOAPI VCFG16Request(PVOID pIn,ULONG function,PVOID pOut1,PVOID pOut2);
+typedef APIRET (VIDEOAPI  FNCFG16REQUEST)(PVOID, ULONG, PVOID, PVOID);
+typedef FNCFG16REQUEST *PFNCFG16REQUEST;
+/*
+** functions exported to 16 bit
+*/
+#define VCFG_GET_CURRENT_CONFIG 0       //pIn = NULL, pOut1 = pAdapter, pOut2 = pMonitor
+
+/* INC */
+
+
+/*
+** APM constants          @V3.0YEE06
+*/
+#define APM_RESUME              1
+#define APM_SUSPEND             2
+#define APM_DISABLED            4
+
+    /* this IOCTL is used internally between videopmi and screendd @V3.0YEE06 */
+#define SCREENDD_SVGA_APM               0x10    /* Wait for APM    @V3.0YEE06 */
+
+#ifndef INCL_DOSDEVIOCTL                //@senja: bsedev.h can't be used by vvid
+#ifndef BSEDEV_INCLUDED                 //don't define if bsedev already included
+#define SCREENDD_SVGA_ID                0x08    /* Get SVGA info IOCTL */
+#define SCREENDD_SVGA_OEM               0x09    /* Get OEM info IOCTL */
+/* #define SCREENDD_SVGA_APM            0x10       Wait for APM    @V3.0YEE06 */
+#define SCREENDD_CATEGORY               0x80
+#define SCREENDD_NAME                   "SCREEN$"
+                                           /* SCREENDD_SVGA_ID */
+typedef struct _OEMSVGAINFO { /* */
+        USHORT AdapterType;
+        USHORT ChipType;
+        ULONG  Memory;
+} OEMSVGAINFO;
+                                           /* SCREENDD_SVGA_OEM */
+typedef struct _OEMINFO {    /* */
+        ULONG  OEMLength;
+        USHORT Manufacturer;
+        ULONG  ManufacturerData;
+        USHORT ManufacturerModel;                               /*@V3.0JWK04*/
+} OEMINFO;
+#endif
+#endif
Index: trunk/src/ddraw/SVGAPMI.H
===================================================================
--- trunk/src/ddraw/SVGAPMI.H	(revision 5330)
+++ trunk/src/ddraw/SVGAPMI.H	(revision 5330)
@@ -0,0 +1,895 @@
+/*****************************************************************************
+ *
+ * SOURCE FILE NAME = SVGAPMI.H
+ *
+ * DESCRIPTIVE NAME =
+ *
+ * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
+ *             Copyright Microsoft Corporation, 1990
+ *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
+ *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
+ *             RESTRICTED MATERIALS OF IBM
+ *             IBM CONFIDENTIAL
+ *
+ * VERSION = V2.0
+ *
+ * DATE
+ *
+ * DESCRIPTION  Contains VIDEOPMI specific defintions
+ *
+ * FUNCTIONS
+ *
+ * NOTES
+ *
+ * STRUCTURES
+ *
+ * EXTERNAL REFERENCES
+ *
+ * EXTERNAL FUNCTIONS
+ *
+ * CHANGE ACTIVITY =
+ *   DATE      FLAG        APAR   CHANGE DESCRIPTION
+ *   --------  ----------  -----  --------------------------------------
+ *   mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
+ *   02/14/96  @V3.2TSU00 148283  Merlin PBE, support linear aperture
+ *   04/18/96  @V3.2TSU01 150783  Add flags for _int10handler
+ *   07/15/96  @V3.2TSU02 160023  Use the old VIDEO_ADAPTER & VIDEOMDOEINFO
+ *
+ *****************************************************************************/
+
+
+/*
+ * This flag is used to set the linear aperture mode.
+ * the pIn passed in PMIREQUEST_SETMODE will be the pointer to
+ * (mode number | SET_LINEAR_BUFFER_MODE).
+ */
+#define SET_LINEAR_BUFFER_MODE  0x80000000
+
+/*
+ * definitions of bus type
+ */
+#define ISA_BUS    0
+#define VLB_BUS    1
+#define PCI_BUS    2
+#define EISA_BUS   3
+#define PCMCIA_BUS 4
+#define MCA_BUS    5
+
+/*
+* endian type
+*/
+#define LITTLE_ENDIAN  0
+#define BIG_ENDIAN     1
+
+
+/*
+** VIDEOPMI.DLL prototypes.
+*/
+/* NOINC */
+#define HVIDEO   PVOID
+typedef HVIDEO  *PHVIDEO;
+
+#ifndef APIENTRY
+#define APIENTRY /* nothing */
+#endif
+
+#ifndef APIRET
+#define APIRET ULONG
+#endif
+
+typedef ULONG       MODEID;
+typedef MODEID FAR *PMODEID;
+
+/*
+** PMIREQUEST_SOFTWAREINT structures @V3.2SEN01
+*/
+typedef struct {
+  ULONG ulFlags;           //VDM initialization type
+#define VDM_POSTLOAD    0x1  //adapter just loaded, used internally for initialization
+#define VDM_INITIALIZE  0x2  //force initialization of a permanently open VDM, even if previously initialized
+#define VDM_TERMINATE_POSTINITIALIZE   0x6  //start VDM with initialization, but close it afterwards (includes VDM_INITIALIZE)
+#define VDM_QUERY_CAPABILITY     0x10  // query the current int 10 capability
+#define VDM_FULL_VDM_CREATED     0x20  // a full VDM is created
+#define VDM_MINI_VDM_CREATED     0x40  // a mini VDM is created
+#define VDM_MINI_VDM_SUPPORTED   0x80  // mini VDM support is available
+  PCHAR szName;            //VDM initialization program
+  PCHAR szArgs;            //VDM initialization arguments
+}INITVDM;
+
+/*
+ * Don't change these structures without
+ * changing the kernel dos\dosinc\vdmint10.h !
+ */
+typedef struct {
+  BYTE bBufferType;        // input vs output buffer
+#define BUFFER_NONE     0
+#define INPUT_BUFFER    1
+#define OUTPUT_BUFFER   2
+  BYTE bReserved;
+  BYTE bSelCRF;           // CRF flag for the selector: ulong index into the CRF
+  BYTE bOffCRF;           // CRF flag for the offset: ulong index into the CRF
+  PVOID pAddress;         // linear address of the buffer
+  ULONG ulSize;
+}BUFFER, *PBUFFER;
+
+// CRF taken from kmode.h
+typedef struct vcrf_s {
+
+        ULONG reg_eax;
+        ULONG reg_ebx;
+        ULONG reg_ecx;
+        ULONG reg_edx;
+        ULONG reg_ebp;
+        ULONG reg_esi;
+        ULONG reg_edi;
+        ULONG reg_ds;
+        ULONG reg_es;
+        ULONG reg_fs;
+        ULONG reg_gs;
+        ULONG reg_cs;
+        ULONG reg_eip;
+        ULONG reg_eflag;
+        ULONG reg_ss;
+        ULONG reg_esp;
+}VCRF;
+
+
+typedef struct {
+  ULONG ulBIOSIntNo;      /* 0x10 for INT10 calls */
+  VCRF aCRF;
+  BUFFER pB[2];
+}INTCRF;
+#define VPRPMI "VPRPMI$"
+#define VPRSYSREQ_INT10HANDLER      1
+#define VPRSYSREQ_INT10WAITFORPDB   2
+#define VPRSYSREQ_MARKINT10VDM      3
+#define VPRSYSREQ_MAX               VPRSYSREQ_MARKINT10VDM
+/* @V3.2SEN01 end */
+/*
+** Structures passed as input and output parameters.
+*/
+
+typedef struct _VIDEOMODEINFO { /* vmi */
+        MODEID  miModeId;               /* used to make setmode request     */
+
+#define MODE_FLAG_NOT_MONO      0x0001  /* Mono-compatible                  */
+#define MODE_FLAG_GRAPHICS      0x0002  /* Text mode, Graphics              */
+#define MODE_FLAG_NO_CLR_BRST   0x0004  /* Disable Color burst              */
+#define MODE_FLAG_NATIVE        0x0008  /* Native (advanced function) mode  */
+#define IGNORE_CLR_BRST         0x0010  /* Disable color burst doesn't make */
+                                        /* sense for this mode              */
+#define NOT_PLASMA              0x0020  /* @V2.2TSU00 won't work on plasma  */
+                                        /* display                          */
+#define MODE_FLAG_VGA_ENTRY     0x0040  /* VGA mode, need clean up          */
+
+#define MODE_FLAG_LINEAR_BUFFER 0x0100  /* flat frame buffer is supported   */
+
+#define MODE_FLAG_DIRECT_RGB    0x1000  /* direct color RGB                 */
+#define MODE_FLAG_DIRECT_BGR    0x2000  /* direct color BGR                 */
+#define MODE_FLAG_YUV           0x4000  /* YUV color format                 */
+
+        USHORT  usType;                 /* mode type bits                   */
+        USHORT  usInt10ModeSet;         /* int 10 mode                      */
+        USHORT  usXResolution;          /* horizontal pels                  */
+        USHORT  usYResolution;          /* vertical scan lines              */
+        ULONG   ulBufferAddress;        /* physical address of VRAM         */
+        ULONG   ulApertureSize;         /* VRAM aperture                    */
+        BYTE    bBitsPerPixel;          /* no of colors                     */
+        BYTE    bBitPlanes;             /* number of planes                 */
+        BYTE    bXCharSize;             /* font width                       */
+        BYTE    bYCharSize;             /* font height                      */
+        USHORT  usBytesPerScanLine;     /* logical line length in bytes     */
+        USHORT  usTextRows;             /* text rows                        */
+        ULONG   ulPageLength;           /* no of bytes to save a plane      */
+        ULONG   ulSaveSize;             /* total bytes of VRAM to save      */
+        /*
+         * Monitor Info
+         */
+        BYTE    bVrtRefresh;
+        BYTE    bHrtRefresh;
+        BYTE    bVrtPolPos;
+        BYTE    bHrtPolPos;
+        /*
+         * Direct Color Fields. The same definitions as VESA 1.2 and up.
+         */
+        CHAR    bRedMaskSize;               // @V3.2TSU02
+        CHAR    bRedFieldPosition;          // @V3.2TSU02
+        CHAR    bGreenMaskSize;             // @V3.2TSU02
+        CHAR    bGreenFieldPosition;        // @V3.2TSU02
+        CHAR    bBlueMaskSize;              // @V3.2TSU02
+        CHAR    bBlueFieldPosition;         // @V3.2TSU02
+        CHAR    bRsvdMaskSize;              // @V3.2TSU02
+        CHAR    bRsvdFieldPosition;         // @V3.2TSU02
+
+        /*
+         * The number of colors can be derived from MaskSize fields.
+         */
+        ULONG   ulColors;             // @V3.2TSU02
+
+        ULONG   ulReserved[3];        // @V3.2TSU02
+
+//        USHORT  usScrnTop;           @V3.2TSU02
+//        USHORT  usScrnBottom;        @V3.2TSU02
+//        USHORT  usScrnLeft;          @V3.2TSU02
+//        USHORT  usScrnRight;         @V3.2TSU02
+
+//        CHAR    szColorFormat[8];    @V3.2TSU02
+//        CHAR    szColorWeight[8];    @V3.2TSU02
+#ifndef VIDEOPMI_30_LEVEL
+        /*
+        ** The assumption is that all of the base video components
+        ** are built together and shipped in unison.
+        ** In order to build a back-level 3.0 base video component
+        ** (VIDEOPMI, BVHSVGA, VIDEOCFG, IBMGPMI), define macro
+        ** VIDEOPMI_30_LEVEL.
+        */
+//        ULONG   ulColors;               /* @V3.2SEN01 @V3.2TSU02 */
+#endif
+
+} VIDEOMODEINFO;
+typedef VIDEOMODEINFO FAR *PVIDEOMODEINFO;
+
+typedef struct _SVGARGB { /* rgb */
+        BYTE    bR;
+        BYTE    bG;
+        BYTE    bB;
+        BYTE    bUnused;
+} SVGARGB;
+typedef SVGARGB FAR *PSVGARGB;
+
+#define EIGHT_BIT_DAC   0x00010000      /* over load ulRGBCount to tell     */
+                                        /* videopmi the dac values are for  */
+                                        /* 8 bit DAC.                       */
+
+typedef struct _CLUTDATA { /* clt */
+        ULONG   ulRGBCount;             /* No of aRGB entries that follow   */
+        ULONG   ulRGBStart;             /* Start index for RGB triplets     */
+        SVGARGB aRGB[1];                /* One defined, ulRGBCount entries  */
+} CLUTDATA;
+typedef CLUTDATA FAR *PCLUTDATA;
+
+typedef struct _PALETTEDATA { /* pal */
+        ULONG   ulPalCount;             /* No of bPal.. entries that follow */
+        ULONG   ulPalStart;             /* Start index for data             */
+        BYTE    bPaletteData[1];        /* One defined, ulPalCount entries  */
+} PALETTEDATA;
+typedef PALETTEDATA FAR *PPALETTEDATA;
+
+typedef struct _FONTDATA { /* font */
+        ULONG   ulCharCount;            /* No of chars in font              */
+        ULONG   ulFontHeight;           /* No of scanlines per character    */
+        ULONG   ulFontWidth;            /* No of columns per character      */
+        BYTE    bFontData[1];           /* ulCharCount*ulFontHeight entries */
+} FONTDATA;
+typedef FONTDATA FAR *PFONTDATA;
+
+typedef BYTE FAR *PVRAMDATA;
+
+typedef struct _CLEANDATA { /* clean */
+    USHORT  Command;
+    USHORT  IndexPort;
+    USHORT  DataPort;
+    USHORT  Index;
+    USHORT  ANDMask;
+    USHORT  ORMask;
+} CLEANDATA;
+
+typedef struct _BANKDATA { /* bank */
+        MODEID  miBank;                 /*                                  */
+        ULONG   ulBank;                 /*                                  */
+} BANKDATA;
+typedef BANKDATA FAR *PBANKDATA;
+
+#define MAX_OEM_STRING  128
+#define MAX_DAC_STRING  128
+#define MAX_VERSION     128
+
+typedef struct _ADAPTERINFO {   /* adi */
+        ULONG       ulAdapterID;
+        CHAR        szOEMString[MAX_OEM_STRING];    /* adapter info from Hardware section */
+        CHAR        szDACString[MAX_DAC_STRING];    /* DAC info from Hardware section */
+        CHAR        szRevision[MAX_VERSION];        /* whatever the revision  means   */
+        ULONG       ulTotalMemory;
+        ULONG       ulMMIOBaseAddress;
+        ULONG       ulPIOBaseAddress;
+        BYTE        bBusType;
+        BYTE        bEndian;
+        USHORT      usDeviceBusID;       /* has to be 2 bytes */
+        USHORT      usVendorBusID;       /* has to be 2 bytes */
+        USHORT      SlotID;              /* has to be 2 bytes */
+} ADAPTERINFO, FAR *PADAPTERINFO;
+
+/*
+ * Adapter Instance definition. The structure will be passed in every
+ * PMIREQUEST call.
+ */
+typedef struct _VIDEO_ADAPTER { /* va */
+     HVIDEO          hvideo;
+
+     /*
+     ** The assumption is that all of the base video components
+     ** are built together and shipped in unison (any driver including
+     ** svgadefs.h and using the VIDEOPMI interface as well).
+     **
+     ** @V3.0TSU00
+     ** All the callers to videopmi have to fill cbAdapterInfo and
+     ** and cbVideoModeInfo with sizeof (ADAPTERINFO) and
+     ** sizeof (VIDEOMODEINFO), respectively. It is for version control.
+     ** All the DLLs called by videopmi have to access the ModeInfo field
+     ** in VIDEO_ADAPTER by the offset of ModeInfo.
+     ** For example, instead of pAdapter->ModeInfo.bBitsPerPixel,
+     ** it should be
+     **    ((PVIDEOMODEINFO)&((PBYTE)&(pAdapter->Adapter) + pAdapter->AdapterInfo_cb))->
+     **                                              bBitsPerPixel.
+     */
+
+//
+//    Goes back to the old structure of OS/2 Warp 3.0.
+//
+//     USHORT      AdapterInfo_cb;       @V3.2TSU02
+//     USHORT      VideoModeInfo_cb;     @V3.2TSU02
+
+     ADAPTERINFO     Adapter;
+     VIDEOMODEINFO   ModeInfo;
+} VIDEO_ADAPTER, FAR *PVIDEO_ADAPTER;
+
+/*
+ * prototype for import functions in PMI file
+ */
+typedef ULONG   *PREGS;     //pointer to registers. Passed to imported PMI functions.
+typedef APIRET (EXPENTRY FNIMPORTPMI)(PVIDEO_ADAPTER, PREGS);
+typedef FNIMPORTPMI *PFNIMPORTPMI;
+
+#ifdef INCL_16
+   #define VIDEOAPI FAR     //this controls the calling convention.
+#else                           // 32-bit code
+   #define VIDEOAPI EXPENTRY       //C calling convention
+#endif
+
+/*
+** prototype for META PMI imports   @V3.2SEN01
+*/
+typedef APIRET (VIDEOAPI FNPMIREQ)(PVIDEO_ADAPTER, PVOID, PVOID);
+typedef FNPMIREQ *PFNPMIREQ;
+
+typedef struct _PMIREQUEST {
+        PFNPMIREQ       pfnPMIRequest;
+        ULONG           ulRing2Call;
+} PMIREQUEST;
+typedef PMIREQUEST *PPMIREQUEST;
+
+#define METAPMI_LOADADAPTER "LoadAdapter"
+
+typedef APIRET (EXPENTRY FNIMPORTLOADPMI)(CHAR *,PPMIREQUEST);
+typedef FNIMPORTLOADPMI *PFNIMPORTLOADPMI;
+
+/*
+** prototype for VIDEOPMI request functions
+*/
+typedef APIRET (VIDEOAPI FNVIDEOPMIREQUEST)(PVIDEO_ADAPTER, ULONG, PVOID, PVOID);
+
+typedef FNVIDEOPMIREQUEST     *PFNVIDEOPMIREQUEST;
+                                         /* used to exchange data with vvid */
+typedef struct _VDDDATA {    /* vdd */
+        PFNVIDEOPMIREQUEST       npfnEntryPointAddress;
+        HVIDEO                   hvideo;
+} VDDDATA;
+typedef VDDDATA *PVDDATA;
+/* INC */
+/*
+** Save Restore constants
+*/
+
+#define STATEFLAG_REGISTERS     0x0001  /*                                  */
+#define STATEFLAG_CLUT          0x0002  /*                                  */
+#define STATEFLAG_VRAM          0x0004  /*                                  */
+#define STATEFLAG_FONT          0x0008  /*                                  */
+
+/* NOINC */
+typedef struct _VIDEOSTATE { /* vst */
+        ULONG     fStateFlags;          /*                                  */
+        MODEID    miState;              /*                                  */
+        PVOID     pModeData;            /*                                  */
+        ULONG     ulVRAMSaveSize;       /* No of bytes/page to save         */
+        PVRAMDATA pVRAM;                /*                                  */
+        PCLUTDATA pCLUT;                /*                                  */
+        PFONTDATA pFont;                /*                                  */
+} VIDEOSTATE;
+typedef VIDEOSTATE FAR *PVIDEOSTATE;
+/* INC */
+
+/*
+** Function request parameters supported.
+*/
+
+#define PMIREQUEST_SETMODE                 0
+#define PMIREQUEST_LOCKREGISTERS           1
+#define PMIREQUEST_UNLOCKREGISTERS         2
+#define PMIREQUEST_CLEANUP                 3
+#define PMIREQUEST_SAVESTATE               4
+#define PMIREQUEST_RESTORESTATE            5
+#define PMIREQUEST_GETBANK                 6
+#define PMIREQUEST_SETBANK                 7
+#define PMIREQUEST_GETCLUT                 8
+#define PMIREQUEST_SETCLUT                 9
+#define PMIREQUEST_GETPALETTE             10
+#define PMIREQUEST_SETPALETTE             11
+#define PMIREQUEST_GETFONT                12
+#define PMIREQUEST_SETFONT                13
+#define PMIREQUEST_TUNEDISPLAY            14        /* @V2.2TSU00 */
+#define PMIREQUEST_QUERYMAXMODEENTRIES    15
+#define PMIREQUEST_QUERYMAXMODELISTSIZE   16
+#define PMIREQUEST_QUERYMODEINFODATA      17
+#define PMIREQUEST_QUERYMAXTRAPENTRIES    18
+#define PMIREQUEST_QUERYTRAPLISTDATA      19
+#define PMIREQUEST_QUERYMODEHRDWRLIST     20        /* @V2.2TSU00 */
+#define PMIREQUEST_LOADPMIFILE            21
+#define PMIREQUEST_IDENTIFYADAPTER        22
+#define PMIREQUEST_SOFTWAREINT            23             /* @V3.2SEN01 */
+#define PMIREQUEST_INT10         PMIREQUEST_SOFTWAREINT
+#define PMIREQUEST_UNLOADPMIFILE          24
+#define PMIREQUEST_SETMEMORYIOADDRESS     25            /* @V3.2TSU00 */
+
+#define PMIREQUEST_MAX (PMIREQUEST_SETMEMORYIOADDRESS + 1) /* last entry + 1 */
+
+/* NOINC */
+
+/*
+ * define PMIDEF_INCL to include the following definitions.
+ */
+#ifdef PMIDEF_INCL
+
+/* @V2.2TSU00
+** Possible flags in ModeAtrributes field in PMI file
+** the flags will be saved in ModeInfo.ulType
+*/
+#define  PMI_MODE_COLOUR          0x08        /* Bit 3 - 0 = mono, 1 = colour */
+#define  PMI_MODE_GRAPHICS        0x10      /* Bit 4 - 0 = text, 1 = graphics */
+#define  PMI_MODE_VGA_ENTRY       0x20/* vga entry, need clean up in set mode */
+#define  PMI_MODE_IGNORE_CLR_BRST 0x40 /* won't work on B/W mode              */
+#define  PMI_MODE_LINEAR_APERTURE 0x80 /* linear aperture mode */
+
+/*
+ * PMI commands
+ */
+#define PMICMD_NONE             0xFF            //reserved
+#define PMICMD_INB              0
+#define PMICMD_OUTB             1
+#define PMICMD_INW              2
+#define PMICMD_OUTW             3
+#define PMICMD_INDW             4
+#define PMICMD_OUTDW            5
+#define PMICMD_BINB             6
+#define PMICMD_BOUTB            7
+#define PMICMD_ABOUTW           8
+#define PMICMD_ABOUTDW          9
+#define PMICMD_RMWBN           10
+#define PMICMD_RMWBI           11
+#define PMICMD_RMWWN           12
+#define PMICMD_REGOP           13
+#define PMICMD_ASSIGN          14
+/***************** for backward compatibility ***************/
+#define PMICMD_WAIT            15
+#define PMI_WAIT_CLEAR          0       /* Wait for CLEAR condition         */
+/***************** for backward compatibility ***************/
+#define PMICMD_WAITB           16
+#define PMICMD_WAITW           17
+#define PMICMD_WAITDW          18
+#define PMICMD_READB           19               /* @V2.2TSU00          */
+#define PMICMD_READW           20               /* Don't rearrange the */
+#define PMICMD_READDW          21               /* order or put        */
+#define PMICMD_WRITEB          22               /* anything in between */
+#define PMICMD_WRITEW          23               /* for these MMIO      */
+#define PMICMD_WRITEDW         24               /* commands            */
+#define PMICMD_ROUTINE         25               /* @V2.2TSU01          */
+#define PMICMD_LABEL           26
+#define PMICMD_WHILE           27
+#define PMICMD_ENDWHILE        28
+#define PMICMD_IF              29
+#define PMICMD_GOTO            30
+#define PMICMD_STRCMP          31
+#define PMICMD_MEMCMP          32
+#define PMICMD_CALL            33
+#define PMICMD_MAX             PMICMD_CALL  /* equals last entry   */
+
+
+#define PMI_REGOP_ASSIGN          0     /* Rxxx  = <value>                  */
+#define PMI_REGOP_AND             1     /* Rxxx &= <value>                  */
+#define PMI_REGOP_OR              2     /* Rxxx |= <value>                  */
+#define PMI_REGOP_XOR             3     /* Rxxx ^= <value>                  */
+#define PMI_REGOP_PLUS            4     /* Rxxx += <value>                  */
+#define PMI_REGOP_MINUS           5     /* Rxxx -= <value>                  */
+#define PMI_REGOP_SHL             6     /* Rxxx <= <value>                  */
+#define PMI_REGOP_SHR             7     /* Rxxx >= <value>                  */
+#define PMI_REGOP_LESS            8     /* Rxx < Rxyy                       */
+#define PMI_REGOP_LESS_EQUALS     9     /* Rxx <= Ryy                       */
+#define PMI_REGOP_GREATER         10    /* Rxx > Rxyy                       */
+#define PMI_REGOP_GREATER_EQUALS  11    /* Rxx >= Ryy                       */
+#define PMI_REGOP_EQUALS          12    /* Rxx == Ryy                       */
+#define PMI_REGOP_NOT_EQUALS      13    /* Rxx != Ryy                       */
+#define PMI_REGOP_MAX  PMI_REGOP_NOT_EQUALS /* must equal last entry        */
+
+/*
+**      Type Definitions
+**
+**      Tokens are grouped, and must be kept that way.
+**      There are dummy tokens, place holders, TOK_??_BEGIN and TOK_??_END
+**      to make tests and expansion easier. Just be sure to keep token
+**      info for a given section, within these bounds.
+*/
+
+typedef enum _PMITOKEN {        /* pt */
+     TOK_SECT_BEGIN,
+/***************** for backward compatibility ***************/
+     TOK_ADAPTERTYPE,           /* Section Heading tokens */
+     TOK_CHIPSET,
+/***************** for backward compatibility ***************/
+     TOK_PMIVERSION,           /* Section Heading tokens */
+     TOK_COMMENT,
+     TOK_MODEINFO,
+     TOK_SETMODE,
+     TOK_MONITORMODEINFO,
+     TOK_TRAPREGS,
+     TOK_UNLOCK,
+     TOK_LOCK,
+     TOK_CLEANUP,
+     TOK_SETBANK,
+     TOK_GETBANK,
+     TOK_DECLARATIONS,
+     TOK_COPYVRAM,
+     TOK_TUNEDISPLAY,
+     TOK_SETMEMORYIOADDRESS,             // @V3.2TSU00
+     TOK_HARDWARE,
+     TOK_IDENTIFYADAPTER,
+     TOK_ISENGINEBUSY,
+     TOK_ENABLECONTROLLER,
+     TOK_DISABLECONTROLLER,
+     TOK_SETMONITORTIMINGS,
+     TOK_ROUTINE_DECLR,             /* @V2.2TSU01 */
+     TOK_INCLUDE,                   /* text include */
+     TOK_INCLUDECODE,               /* DLL include  */
+     TOK_SECT_END,
+
+     TOK_MI_BEGIN,
+     TOK_MODEATTRIBUTES,        /* ModeInfo Section tokens */
+     TOK_INT10MODESET,          /* @V2.2TSU00 int 10 mode */
+     TOK_BYTESPERSCANLINE,
+     TOK_TEXTROWS,              /* [ModeInfo] and [Hardware] tokens       */
+     TOK_XRESOLUTION,           /* are PMI keyvariables. Do remember      */
+     TOK_YRESOLUTION,           /* update the PMIKeyVarTable[] and        */
+     TOK_XCHARSIZE,             /* PMI Keyvariable defines in header file */
+     TOK_YCHARSIZE,
+     TOK_BITSPERPIXEL,
+     TOK_NUMBEROFPLANES,
+     TOK_PAGELENGTH,
+     TOK_SAVESIZE,
+     TOK_BUFFERADDRESS,
+     TOK_APERTURESIZE,
+     TOK_COLORFORMAT,
+     TOK_COLORWEIGHT,
+     TOK_VERTICALREFRESH,
+     TOK_HORIZONTALREFRESH,
+     TOK_VPOLARITYPOSITIVE,
+     TOK_HPOLARITYPOSITIVE,
+     TOK_SCREENLEFTEDGE,
+     TOK_SCREENRIGHTEDGE,
+     TOK_SCREENTOPEDGE,
+     TOK_SCREENBOTTOMEDGE,
+     TOK_COLORS,        /* @V3.2SEN01 number of colors field added */
+/***************** for backward compatibility ***************/
+     TOK_INTERLACEMODE,
+/***************** for backward compatibility ***************/
+     TOK_MI_END,
+
+     TOK_HARDWARE_BEGIN,      /* @V2.2TSU00 Hardware Section */
+     TOK_BUSTYPE,
+     TOK_OEMSTRING,
+     TOK_DACSTRING,
+     TOK_VERSION,
+     TOK_TOTALMEMORY,
+     TOK_MEMORYIOADDRESS,
+     TOK_PORTIOADDRESS,
+     TOK_ENDIAN,
+     TOK_INT10SETMODE,                   /* @V3.1TSU00  */
+     TOK_HARDWARE_END,
+
+     TOK_TRAP_BEGIN,
+     TOK_BYTE_IOPORT,             /* @V2.2TSU00, trap registers type */
+     TOK_WORD_IOPORT,
+     TOK_DWORD_IOPORT,
+     TOK_BYTE_MMIOPORT,
+     TOK_WORD_MMIOPORT,
+     TOK_DWORD_MMIOPORT,
+     TOK_RESET,
+     TOK_INDEX,
+     TOK_INDEXMASK,
+     TOK_DATAMASK,
+     TOK_ACCEL,
+     TOK_RO,
+     TOK_WO,
+     TOK_RW,
+     TOK_TRAP_END,
+
+     TOK_SM_BEGIN,
+     TOK_INB,                /* Command Section tokens */
+     TOK_OUTB,
+     TOK_INW,
+     TOK_INDW,
+     TOK_OUTW,
+     TOK_OUTDW,
+     TOK_BINB,
+     TOK_BOUTB,
+     TOK_RMWBI,
+     TOK_RMWBN,
+     TOK_RMWWN,
+     TOK_ABOUTW,
+     TOK_ABOUTDW,
+     TOK_IF,
+     TOK_GOTO,
+     TOK_VARIABLE,
+     TOK_WHILE,
+     TOK_ENDWHILE,
+     TOK_MEMCMP,
+     TOK_STRCMP,
+     TOK_READB,         /* @V2.2TSU00          */
+     TOK_READW,         /* Don't rearrange the */
+     TOK_READDW,        /* order or put        */
+     TOK_WRITEB,        /* anything in between */
+     TOK_WRITEW,        /* for these MMIO      */
+     TOK_WRITEDW,       /* commands            */
+     TOK_CALL,
+     TOK_ROUTINE,
+/***************** for backward compatibility ***************/
+     TOK_WAIT,
+/***************** for backward compatibility ***************/
+     TOK_WAITB,
+     TOK_WAITW,
+     TOK_WAITDW,
+     TOK_VALUE,
+     TOK_PMIREG,
+     TOK_LPAREN,
+     TOK_RPAREN,
+     TOK_LBRACE,
+     TOK_RBRACE,
+     TOK_EQUALS,
+     TOK_NOTEQUALS,
+     TOK_SEMICOLON,
+     TOK_COMMA,
+     TOK_COLON,
+     TOK_MINUS,
+     TOK_HYPHEN = TOK_MINUS,
+     TOK_NEGATE,         /* @V2.2TSU01 */
+     TOK_DOUBLEQUOTE,
+     TOK_PLUS,
+     TOK_REGOP_AND,
+     TOK_REGOP_OR,
+     TOK_REGOP_XOR,
+     TOK_REGOP_SHL,
+     TOK_LESS = TOK_REGOP_SHL,  /* @V2.2TSU01 */
+     TOK_REGOP_SHR,
+     TOK_SM_END,
+
+     TOK_EOF,
+     TOK_IOPORT,
+     TOK_MMIO,
+     TOK_PIO,
+     TOK_ISA,
+     TOK_VLB,
+     TOK_PCI,
+     TOK_EISA,
+     TOK_PCMCIA,
+     TOK_MCA,
+     TOK_BIG_ENDIAN,
+     TOK_LITTLE_ENDIAN,
+     TOK_QUOTEDSTRING,
+     TOK_MMIO_REG_NAME,
+     TOK_IOPORT_NAME,
+     TOK_PMI_KEYVAR,
+     TOK_SHADOWVRAM,
+     TOK_MINIVDM,                /* @V3.1TSU00  */
+     TOK_FULLVDM,                /* @V3.1TSU00  */
+     TOK_ERROR,                /* error */
+     TOK_PASS
+} PMITOKEN;
+
+typedef struct _TOK { /* tok */
+  CHAR *tok_txt;
+  PMITOKEN tok_val;
+} TOK;
+
+/*
+ * definitions of bus types.
+ */
+#define ISA_BUS    0           /* @V2.2SENJA */
+#define VLB_BUS    1
+#define PCI_BUS    2
+#define EISA_BUS   3
+#define PCMCIA_BUS 4
+#define MCA_BUS    5
+#define BUS_MAX MCA_BUS
+
+#endif /* PMIDEF_INCL */
+
+/*
+ * PMI token declarations
+ * PMI_TOKEN_ARRAY should be defined to include the following array.
+ * In this way, this array will not be allocated for every C file.
+ */
+#ifdef PMI_TOKEN_ARRAY
+
+TOK Tokens[] =
+{
+
+/***************** for backward compatibility ***************/
+  "[ADAPTERTYPE]",      TOK_ADAPTERTYPE,
+  "[CHIPSET]",          TOK_CHIPSET,
+/***************** for backward compatibility ***************/
+  "[PMIVERSION]",       TOK_PMIVERSION,
+  "[COMMENT]",          TOK_COMMENT,
+  "[MODEINFO]",         TOK_MODEINFO,
+  "[SETMODE]",          TOK_SETMODE,
+  "[MONITORMODEINFO]",  TOK_MONITORMODEINFO,
+  "[TRAPREGS]",         TOK_TRAPREGS,
+  "[UNLOCK]",           TOK_UNLOCK,
+  "[LOCK]",             TOK_LOCK,
+  "[CLEANUP]",          TOK_CLEANUP,
+  "[SETBANK]",          TOK_SETBANK,
+  "[GETBANK]",          TOK_GETBANK,
+  "[DECLARATIONS]",     TOK_DECLARATIONS,
+  "[COPYVRAM]",         TOK_COPYVRAM,
+  "[TUNEDISPLAY]",      TOK_TUNEDISPLAY,
+  "[SETMEMORYIOADDRESS]",TOK_SETMEMORYIOADDRESS,  // @V3.2TSU00
+  "[HARDWARE]",         TOK_HARDWARE,
+  "[IDENTIFYADAPTER]",  TOK_IDENTIFYADAPTER,
+  "[ISENGINEBUSY]",     TOK_ISENGINEBUSY,
+  "[ENABLECONTROLLER]", TOK_ENABLECONTROLLER,
+  "[DISABLECONTROLLER]",TOK_DISABLECONTROLLER,
+  "[SETMONITORTIMINGS]",TOK_SETMONITORTIMINGS,
+  "INCLUDE",            TOK_INCLUDE,                   /* text include */
+  "INCLUDECODE",        TOK_INCLUDECODE,               /* DLL include  */
+  /*
+   * Hardware Section
+   */
+  "BUSTYPE",            TOK_BUSTYPE,
+  "OEMSTRING",          TOK_OEMSTRING,
+  "DACSTRING",          TOK_DACSTRING,
+  "VERSION",            TOK_VERSION,
+  "TOTALMEMORY",        TOK_TOTALMEMORY,
+  "MEMORYIOADDRESS",    TOK_MEMORYIOADDRESS,
+  "PORTIOADDRESS",      TOK_PORTIOADDRESS,
+  "ENDIAN",             TOK_ENDIAN,
+  "INT10SETMODE",       TOK_INT10SETMODE,    /* @V3.1TSU00  */
+  /*
+   * TrapRegs Section
+   */
+  "BYTE_IOPORT",        TOK_BYTE_IOPORT,
+  "WORD_IOPORT",        TOK_WORD_IOPORT,
+  "DWORD_IOPORT",       TOK_DWORD_IOPORT,
+  "BYTE_MMIOPORT",      TOK_BYTE_MMIOPORT,
+  "WORD_MMIOPORT",      TOK_WORD_MMIOPORT,
+  "DWORD_MMIOPORT",     TOK_DWORD_MMIOPORT,
+  "RESET",              TOK_RESET,
+  "INDEX",              TOK_INDEX,
+  "INDEXMASK",          TOK_INDEXMASK,
+  "DATAMASK",           TOK_DATAMASK,
+  "ACCEL",              TOK_ACCEL,
+  "RO",                 TOK_RO,
+  "WO",                 TOK_WO,
+  "RW",                 TOK_RW,
+  /*
+   * ModeInfo Section
+   */
+  "INT10MODESET",       TOK_INT10MODESET,
+  "MODEATTRIBUTES",     TOK_MODEATTRIBUTES,
+  "BYTESPERSCANLINE",   TOK_BYTESPERSCANLINE,
+  "TEXTROWS",           TOK_TEXTROWS,
+  "XRESOLUTION",        TOK_XRESOLUTION,
+  "YRESOLUTION",        TOK_YRESOLUTION,
+  "XCHARSIZE",          TOK_XCHARSIZE,
+  "YCHARSIZE",          TOK_YCHARSIZE,
+  "BITSPERPIXEL",       TOK_BITSPERPIXEL,
+  "NUMBEROFPLANES",     TOK_NUMBEROFPLANES,
+  "PAGELENGTH",         TOK_PAGELENGTH,
+  "SAVESIZE",           TOK_SAVESIZE,
+  "BUFFERADDRESS",      TOK_BUFFERADDRESS,
+  "APERTURESIZE",       TOK_APERTURESIZE,
+  "COLORFORMAT",        TOK_COLORFORMAT,
+  "COLORWEIGHT",        TOK_COLORWEIGHT,
+/***************** for backward compatibility ***************/
+  "INTERLACEMODE",      TOK_INTERLACEMODE,
+/***************** for backward compatibility ***************/
+  "VERTICALREFRESH",    TOK_VERTICALREFRESH,
+  "HORIZONTALREFRESH",  TOK_HORIZONTALREFRESH,
+  "VPOLARITYPOSITIVE",  TOK_VPOLARITYPOSITIVE,
+  "HPOLARITYPOSITIVE",  TOK_HPOLARITYPOSITIVE,
+  "SCREENLEFTEDGE",     TOK_SCREENLEFTEDGE,
+  "SCREENRIGHTEDGE",    TOK_SCREENRIGHTEDGE,
+  "SCREENTOPEDGE",      TOK_SCREENTOPEDGE,
+  "SCREENBOTTOMEDGE",   TOK_SCREENBOTTOMEDGE,
+  "COLORS",             TOK_COLORS,    /* @V3.2SEN01 */
+  /*
+   * PMI Commands
+   */
+  "INB",                TOK_INB,
+  "OUTB",               TOK_OUTB,
+  "INW",                TOK_INW,
+  "OUTW",               TOK_OUTW,
+  "INDW",               TOK_INDW,
+  "OUTDW",              TOK_OUTDW,
+  "BINB",               TOK_BINB,
+  "BOUTB",              TOK_BOUTB,
+  "RMWBI",              TOK_RMWBI,
+  "RMWBN",              TOK_RMWBN,
+/***************** for backward compatibility ***************/
+  "RMWB",               TOK_RMWBI,
+  "RMWW",               TOK_RMWBN,
+/***************** for backward compatibility ***************/
+  "RMWWN",               TOK_RMWWN,
+  "ABOUTW",             TOK_ABOUTW,
+  "ABOUTDW",            TOK_ABOUTDW,
+  "IF",                 TOK_IF,
+  "GOTO",               TOK_GOTO,
+  "WHILE",              TOK_WHILE,
+  "ENDWHILE",           TOK_ENDWHILE,
+  "MEMCMP",             TOK_MEMCMP,
+  "STRCMP",             TOK_STRCMP,
+  "READB",              TOK_READB,      /* @V2.2TSU00          */
+  "READW",              TOK_READW,      /* Don't rearrange the */
+  "READDW",             TOK_READDW,     /* order or put        */
+  "WRITEB",             TOK_WRITEB,     /* anything in between */
+  "WRITEW",             TOK_WRITEW,     /* for these MMIO      */
+  "WRITEDW",            TOK_WRITEDW,    /* commands            */
+  "CALL",               TOK_CALL,
+/***************** for backward compatibility ***************/
+  "WAIT",               TOK_WAIT,
+/***************** for backward compatibility ***************/
+  "WAITB",              TOK_WAITB,
+  "WAITW",              TOK_WAITW,
+  "WAITDW",             TOK_WAITDW,
+  /*
+   * others
+   */
+  "MMIO",               TOK_MMIO,    /* used in [Declarations]  */
+/***************** for backward compatibility ***************/
+  "P",                  TOK_MMIO,    /* used in [Declarations]  */
+/***************** for backward compatibility ***************/
+  "PIO",                TOK_PIO,     /*                         */
+  "ISA",                TOK_ISA,
+  "VLB",                TOK_VLB,
+  "PCI",                TOK_PCI,
+  "EISA",               TOK_EISA,
+  "PCMCIA",             TOK_PCMCIA,
+  "MCA",                TOK_MCA,
+  "SHADOWVRAM",         TOK_SHADOWVRAM,
+  "BIG",                TOK_BIG_ENDIAN,
+  "LITTLE",             TOK_LITTLE_ENDIAN,
+  "MINIVDM",            TOK_MINIVDM,         /* @V3.1TSU00  */
+  "FULLVDM",            TOK_FULLVDM          /* @V3.1TSU00  */
+
+} ;
+
+extern TOK Tokens[];
+
+#endif  /* PMI_TOKEN_ARRAY */
+
+/*
+** PMI subsystem errors
+*/
+#define ERROR_ADAPTER_NOT_SUPPORTED          ERROR_USER_DEFINED_BASE+0x10
+#define ERROR_REFRESH_NOT_SUPPORTED          ERROR_USER_DEFINED_BASE+0x11
+#define ERROR_MODE_NOT_SUPPORTED             ERROR_USER_DEFINED_BASE+0x12
+#define ERROR_REQ_SECTION_UNDEFINED          ERROR_USER_DEFINED_BASE+0x13
+#define ERROR_PMI_FILE_SYNTAX                ERROR_USER_DEFINED_BASE+0x14
+#define ERROR_NO_MONITOR_SUPPORT             ERROR_USER_DEFINED_BASE+0x15
+#define ERROR_INVALID_CONFIGURATION          ERROR_USER_DEFINED_BASE+0x16
+/* @V3.2SEN01 start */
+#define ERROR_INADEQUATE_VDM_SUPPORT       ERROR_USER_DEFINED_BASE+0x17
+#define ERROR_VDM_CREATION_NOT_SHELLPROCESS    ERROR_USER_DEFINED_BASE+0x18
+#define ERROR_MINIVDM_PROCESSSUPPORTONLY   ERROR_USER_DEFINED_BASE+0x19
+#define ERROR_INVALID_ADAPTER_EXTENSION      ERROR_USER_DEFINED_BASE+0x20
+#define ERROR_ADAPTER_STILL_IN_USE           ERROR_USER_DEFINED_BASE+0x21
+#define ERROR_UPLEVEL_VIDEOPMI               ERROR_USER_DEFINED_BASE+0x22  //structure change for cb and ulcolors
+/* @V3.2SEN01 end */
+
+/* INC */
+
Index: trunk/src/ddraw/os2fsdd.cpp
===================================================================
--- trunk/src/ddraw/os2fsdd.cpp	(revision 5330)
+++ trunk/src/ddraw/os2fsdd.cpp	(revision 5330)
@@ -0,0 +1,380 @@
+/*
+ * Few routines for full-screen DirectDraw on OS/2
+ *
+ * Copyright 2000 Michal Necasek
+ * Copyright 2000 Przemyslaw Dobrowolski
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#define INCL_DOS
+#define INCL_WINWINDOWMGR
+#include <os2wrap.h>
+#include <misc.h>
+
+#include <svgadefs.h>
+
+#include "os2fsdd.h"
+
+/* DirectX palette entry */
+typedef struct tagPALETTEENTRY
+{
+   BYTE        peRed;
+   BYTE        peGreen;
+   BYTE        peBlue;
+   BYTE        peFlags;
+} PALETTEENTRY;
+
+#define DLLNAME                 "VIDEOPMI"
+
+#define REQUEST_ENTRYPOINT      "VIDEOPMI32Request"
+
+#define FAIL_LENGTH             256
+
+char PMIFILE[256] = "\\os2\\svgadata.pmi";
+
+/*
+ * Adapter instance.
+ */
+VIDEO_ADAPTER AdapterInstance;
+
+/*
+ * Entry point to videopmi
+ */
+PFNVIDEOPMIREQUEST __pfnPMIRequest;
+
+//
+// mode table. It is an array of VIDEOMODEINFOs.
+//
+static PVIDEOMODEINFO ModeTable;
+
+static ULONG ulTotalModes;
+
+static bIsInFS = FALSE;
+
+/*
+ * PMI request wrapper
+ */
+inline ULONG PMI_Request(PVIDEO_ADAPTER a, ULONG b, PVOID c, PVOID d)
+{
+   ULONG yyrc;
+   USHORT sel = RestoreOS2FS();
+
+   yyrc = __pfnPMIRequest(a, b, c, d);
+   SetFS(sel);
+
+   return yyrc;
+}
+
+
+/************************************************************
+ * Load the .PMI file, get the hardware information about the
+ * adapter and the entry point to videopmi.
+ *
+ * Returns 0 if successful; DOS error token, otherwise.
+ ************************************************************/
+
+ULONG LoadPMIService (VOID)
+{
+   APIRET        rc;
+   char          sFail[FAIL_LENGTH] = {0};
+   HMODULE       hmodVIDEOPMI;
+
+
+/************************************************************
+ * Load videopmi.dll
+ ************************************************************/
+
+   if (!(rc = DosLoadModule (sFail, FAIL_LENGTH, DLLNAME,
+                            &hmodVIDEOPMI)))
+   {
+
+/************************************************************
+ * Get PMIREQUEST entry point
+ ************************************************************/
+
+      rc = DosQueryProcAddr (hmodVIDEOPMI,
+                             0,
+                             REQUEST_ENTRYPOINT,
+                             (PFN*)&__pfnPMIRequest);
+
+      if (!rc)
+
+         /*
+          * Load PMI file.
+          * If PMI file is successfully loaded,
+          * adapter in AdapterInstance will be filled with the
+          * information in .PMI file.
+          *
+          * Remember to set up the size information for ADAPTERINFO
+          * and VIDEOMODEINFO.
+          */
+
+//          AdapterInstance.AdapterInfo.cb    = sizeof (ADAPTERINFO);
+//          AdapterInstance.VideoModeInfo.cb  = sizeof (VIDEOMODEINFO);
+
+         rc = PMI_Request (&AdapterInstance,
+                           PMIREQUEST_LOADPMIFILE,
+//                         PMIREQUEST_IDENTIFYADAPTER,
+                           PMIFILE,
+                           NULL);
+//      if (rc)
+         DosFreeModule (hmodVIDEOPMI);
+   }
+
+   return rc;
+}
+
+
+/************************************************************
+ *
+ * This function sets up the mode table.
+ *
+ * Copy the mode table from videopmi. It is an arrary of modes.
+ * All the information in [ModeInfo] and
+ * [MonitorModeInfo], if any, is included.
+ *
+ * Returns 0 if successful; DOS error token, otherwise.
+ ************************************************************/
+ULONG SetUpModeTable (VOID)
+{
+   APIRET        rc;
+   /*
+    * Get the total number of modes
+    */
+   if (!(rc = PMI_Request (&AdapterInstance,
+                           PMIREQUEST_QUERYMAXMODEENTRIES,
+                           NULL,
+                           &ulTotalModes)))
+
+      /*
+       * Allocate memory for mode table
+       */
+      if (!(rc = DosAllocSharedMem ((PPVOID)&ModeTable,
+                                    NULL,
+                                    ulTotalModes *
+                                    sizeof (VIDEOMODEINFO),
+                                    OBJ_GETTABLE | PAG_COMMIT |
+                                    PAG_WRITE)))
+
+         /*
+          * Copy mode table.
+          * Please check svgadefs.h for the fields in VIDEOMODEINFO.
+          */
+         rc = PMI_Request (&AdapterInstance,
+                           PMIREQUEST_QUERYMODEINFODATA,
+                           NULL,
+                           ModeTable);
+
+   return rc;
+}
+
+ULONG FreeModeTable (VOID)
+{
+  DosFreeMem (ModeTable);
+  return 0;
+}
+
+
+/************************************************************
+ *
+ * This function sets the graphic mode.
+ *
+ * You can select the mode based on any information in the VIDEOMODEINFO
+ * structure. The following is only an example to set the graphics mode
+ * based on resolution and refresh rate.
+ * PM driver should not call videopmi to set the mode directly.
+ * It should call BVH to set the mode as before, such that
+ * the mode can be set based on the current monitor capability
+ * handled by BVH.
+ *
+ * Returns 0 if successful; DOS error token, otherwise.
+ ************************************************************/
+
+ULONG SetSVGAMode (ULONG     ulHorRes,
+                   ULONG     ulVerRes,
+                   ULONG     ulColors,
+                   ULONG     ulVerRefr,
+                   PULONG    pulModeInd,
+                   PVOID     pCLUTData)
+{
+    APIRET rc=0xFFFF;
+    ULONG  i;
+
+    *pulModeInd = -1;
+    /* Search mode */
+    /* Assuming that the modes are sorted by refresh mode in ascending */
+    /* order, we'll find the highest refresh mode                      */
+    if (ulVerRefr >= 0xFFL)
+    {
+      for(i=0; i < ulTotalModes; i++)
+         if ((ModeTable[i].usXResolution == (USHORT)ulHorRes) &&
+             (ModeTable[i].usYResolution == (USHORT)ulVerRes) &&
+             (ModeTable[i].bBitsPerPixel == (BYTE)ulColors)) {
+            *pulModeInd = i;
+//            break;
+         }
+   }
+
+   else    /* verify all including the refresh parameter */
+   {
+      for(i=0; i < ulTotalModes; i++)
+         if ((ModeTable[i].usXResolution  == (USHORT) ulHorRes) &&
+             (ModeTable[i].usYResolution  == (USHORT) ulVerRes) &&
+             (ModeTable[i].bBitsPerPixel  == (BYTE) ulColors) &&
+             ((ModeTable[i].bVrtRefresh   == 0xFF) ||
+              (ModeTable[i].bVrtRefresh   == (BYTE) ulVerRefr)))
+             *pulModeInd = i;
+   }
+
+   if (*pulModeInd == -1)
+      return rc;              /* mode not found */
+
+   /* Unlock first */
+   rc = PMI_Request (&AdapterInstance,
+                     PMIREQUEST_UNLOCKREGISTERS,
+                     NULL,
+                     NULL);
+
+   /*
+    * Copy VIDEOMODEINFO of the selected mode to AdapterInstance.
+    * Depending on the .PMI file, this information may be needed.
+    */
+   AdapterInstance.ModeInfo = ModeTable[*pulModeInd];
+   /*
+    * Call videopmi to set the mode.
+    */
+   rc = PMI_Request (&AdapterInstance,
+                     PMIREQUEST_SETMODE,
+                     &ModeTable[*pulModeInd].miModeId,
+                     NULL);
+
+   if (rc)
+      return rc;
+
+   else
+      /* Load Color Lookup Table */
+      if (ModeTable[*pulModeInd].bBitsPerPixel <= 8 && pCLUTData != NULL)
+         rc = PMI_Request (&AdapterInstance,
+                           PMIREQUEST_SETCLUT,
+                           pCLUTData,
+                           NULL);
+
+
+   return rc;
+}
+
+//******************************************************************************
+//******************************************************************************
+ULONG SetSVGAPalette (PVOID pal) {
+   PALETTEENTRY *pDirectXPal = (PALETTEENTRY *)pal;
+   struct {
+      CLUTDATA  clData;
+      SVGARGB   svgaRGB[255];
+   } clutData;
+
+   ULONG i, rc;
+
+   dprintf(("DDRAW-OS2FSDD: Setting physical palette\n"));
+
+   /* We have to clamp down the values - physical palette only goes to 64 */
+   /* on standard VGA                                                     */
+   for(i = 0; i < 256; i++) {
+      clutData.clData.aRGB[i].bR      = pDirectXPal[i].peRed   >> 2;
+      clutData.clData.aRGB[i].bG      = pDirectXPal[i].peGreen >> 2;
+      clutData.clData.aRGB[i].bB      = pDirectXPal[i].peBlue  >> 2;
+      clutData.clData.aRGB[i].bUnused = 0;
+   }
+   clutData.clData.ulRGBCount = 256;
+   clutData.clData.ulRGBStart = 0;
+
+   rc = PMI_Request (&AdapterInstance,
+                     PMIREQUEST_SETCLUT,
+                     &clutData,
+                     NULL);
+   return rc;
+}
+
+//******************************************************************************
+//******************************************************************************
+VOID KillPM(VOID)
+{
+  HAB  hab;
+  HWND hwnd;
+  HDC  hdc;
+  ULONG rc;
+  USHORT sel = RestoreOS2FS();
+
+  hab = WinQueryAnchorBlock(HWND_DESKTOP);
+
+  hwnd = WinQueryDesktopWindow(hab, NULL);
+
+  // Grab the handle to the Desktop DC
+  hdc = WinOpenWindowDC(hwnd);
+
+  dprintf(("*** Killing the PM screen ***"));
+
+  // Call GreDeath
+  rc=GreDeath(hdc);
+
+  SetFS(sel);
+
+  // Set a flag so that a subsequent restore works
+  bIsInFS = TRUE;
+
+  dprintf(("GreDeath() rc= %x",rc));
+}
+
+//******************************************************************************
+//******************************************************************************
+VOID RestorePM(VOID)
+{
+  HAB   hab;
+  HWND  hwnd;
+  HDC   hdc;
+  ULONG rc;
+  USHORT sel = RestoreOS2FS();
+
+  // Bail out if we aren't in FS mode
+  if (!bIsInFS) {
+      SetFS(sel);
+      return;
+  }
+
+  // Get the anchor block
+  hab = WinQueryAnchorBlock(HWND_DESKTOP);
+
+  // Get the window handle to the Desktop
+  hwnd = WinQueryDesktopWindow(hab, NULL);
+
+  // Grab the handle to the Desktop DC
+  hdc = WinQueryWindowDC(hwnd);
+
+  dprintf(("*** Restore the PM screen ***"));
+
+  rc=GreResurrection(hdc, 0L, NULL);
+
+  // Repaint the desktop
+  WinInvalidateRect(hwnd, NULL, TRUE);
+
+  // Set a flag so that we know we're back in PM
+  bIsInFS = FALSE;
+
+  SetFS(sel);
+  dprintf(("GreResurrection() rc=%x",rc));
+}
+
+//******************************************************************************
+//******************************************************************************
+BOOL ModeInSVGAModeTable(ULONG resX,ULONG resY, ULONG bpp)
+{
+  int i;
+  for (i=0;i<ulTotalModes;i++)
+  {
+    if ((ModeTable[i].usXResolution==resX) &&
+        (ModeTable[i].usYResolution==resY) &&
+        (ModeTable[i].bBitsPerPixel==bpp)) return TRUE;
+  }
+  return FALSE;
+}
Index: trunk/src/ddraw/os2fsdd.h
===================================================================
--- trunk/src/ddraw/os2fsdd.h	(revision 5330)
+++ trunk/src/ddraw/os2fsdd.h	(revision 5330)
@@ -0,0 +1,66 @@
+/*
+ * Few routines for full-screen DirectDraw on OS/2
+ *
+ * Copyright 2000 Michal Necasek
+ * Copyright 2000 Przemyslaw Dobrowolski
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#ifndef __OS2FSDD__
+#define __OS2FSDD__
+
+ULONG APIENTRY Gre32Entry3(ULONG,ULONG,ULONG);
+
+inline ULONG APIENTRY _Gre32Entry3 (ULONG a, ULONG b, ULONG c)
+{
+ ULONG yyrc;
+ USHORT sel = RestoreOS2FS();
+
+    yyrc = Gre32Entry3(a,b,c);
+    SetFS(sel);
+
+    return yyrc;
+}
+
+ULONG APIENTRY Gre32Entry5(ULONG,ULONG,ULONG,ULONG,ULONG);
+
+inline ULONG APIENTRY _Gre32Entry5 (ULONG a, ULONG b, ULONG c, ULONG d, ULONG e)
+{
+ ULONG yyrc;
+ USHORT sel = RestoreOS2FS();
+
+    yyrc = Gre32Entry5(a,b,c,d,e);
+    SetFS(sel);
+
+    return yyrc;
+}
+
+#define NGreDeath 0x000040B7L
+#define GreDeath(a) (BOOL) _Gre32Entry3((HDC)(a),0L,NGreDeath)
+#define NGreResurrection 0x000040B8L
+#define GreResurrection(a,b,c) (BOOL) _Gre32Entry5((HDC)(a),(LONG)(b),(c),0L,NGreResurrection)
+
+ULONG SetSVGAMode (ULONG     ulHorRes,
+                   ULONG     ulVerRes,
+                   ULONG     ulColors,
+                   ULONG     ulVerRefr,
+                   PULONG    pulModeInd,
+                   PVOID     pCLUTData);
+
+ULONG LoadPMIService (VOID);
+
+ULONG SetUpModeTable (VOID);
+
+ULONG SetSVGAPalette (PVOID pal);
+
+VOID RestorePM(VOID);
+
+VOID KillPM(VOID);
+
+ULONG FreeModeTable (VOID);
+
+BOOL ModeInSVGAModeTable(ULONG resX,ULONG resY, ULONG bpp);
+
+#endif /* __OS2FSDD__ */
