1/* 2 * Global data and definitions 3 * 4 * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1) Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2) Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3) The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Author: Thomas Winischhofer <thomas@winischhofer.net> 29 * 30 */ 31 32 33/* For calculating refresh rate index (CR33) */ 34static const struct _xgi_vrate { 35 CARD16 idx; 36 CARD16 xres; 37 CARD16 yres; 38 CARD16 refresh; 39 BOOLEAN XGI730valid32bpp; 40} xgix_vrate[] = { 41 {1, 320, 200, 70, TRUE}, 42 {1, 320, 240, 60, TRUE}, 43 {1, 400, 300, 60, TRUE}, 44 {1, 512, 384, 60, TRUE}, 45 {1, 640, 400, 72, TRUE}, 46 {1, 640, 480, 60, TRUE}, 47 {2, 640, 480, 72, TRUE}, 48 {3, 640, 480, 75, TRUE}, 49 {4, 640, 480, 85, TRUE}, 50 {5, 640, 480, 100, TRUE}, 51 {6, 640, 480, 120, TRUE}, 52 {7, 640, 480, 160, FALSE}, 53 {8, 640, 480, 200, FALSE}, 54 {1, 720, 480, 60, TRUE}, 55 {1, 720, 576, 58, TRUE}, 56 {1, 768, 576, 58, TRUE}, 57 {1, 800, 480, 60, TRUE}, 58 {2, 800, 480, 75, TRUE}, 59 {3, 800, 480, 85, TRUE}, 60 {1, 800, 600, 56, TRUE}, 61 {2, 800, 600, 60, TRUE}, 62 {3, 800, 600, 72, TRUE}, 63 {4, 800, 600, 75, TRUE}, 64 {5, 800, 600, 85, TRUE}, 65 {6, 800, 600, 105, TRUE}, 66 {7, 800, 600, 120, FALSE}, 67 {8, 800, 600, 160, FALSE}, 68 {1, 848, 480, 39, TRUE}, 69 {2, 848, 480, 60, TRUE}, 70 {1, 856, 480, 39, TRUE}, 71 {2, 856, 480, 60, TRUE}, 72 {1, 1024, 576, 60, TRUE}, 73 {2, 1024, 576, 75, TRUE}, 74 {3, 1024, 576, 85, TRUE}, 75 {1, 1024, 600, 60, TRUE}, 76 {1, 1024, 768, 43, TRUE}, 77 {2, 1024, 768, 60, TRUE}, 78 {3, 1024, 768, 70, FALSE}, 79 {4, 1024, 768, 75, FALSE}, 80 {5, 1024, 768, 85, TRUE}, 81 {6, 1024, 768, 100, TRUE}, 82 {7, 1024, 768, 120, TRUE}, 83 {1, 1152, 768, 60, TRUE}, 84 {1, 1152, 864, 75, TRUE}, 85 {2, 1152, 864, 84, FALSE}, 86 {1, 1280, 720, 60, TRUE}, 87 {2, 1280, 720, 75, FALSE}, 88 {3, 1280, 720, 85, TRUE}, 89 {1, 1280, 768, 60, TRUE}, 90 {1, 1280, 800, 60, TRUE}, 91 {1, 1280, 960, 60, TRUE}, 92 {2, 1280, 960, 85, TRUE}, 93 {1, 1280, 1024, 43, FALSE}, 94 {2, 1280, 1024, 60, TRUE}, 95 {3, 1280, 1024, 75, FALSE}, 96 {4, 1280, 1024, 85, TRUE}, 97 {1, 1360, 768, 60, TRUE}, 98 {1, 1400, 1050, 60, TRUE}, 99 {2, 1400, 1050, 75, TRUE}, 100 {1, 1600, 1200, 60, TRUE}, 101 {2, 1600, 1200, 65, TRUE}, 102 {3, 1600, 1200, 70, TRUE}, 103 {4, 1600, 1200, 75, TRUE}, 104 {5, 1600, 1200, 85, TRUE}, 105 {6, 1600, 1200, 100, TRUE}, 106 {7, 1600, 1200, 120, TRUE}, 107 {1, 1680, 1050, 60, TRUE}, 108 {1, 1920, 1440, 60, TRUE}, 109 {2, 1920, 1440, 65, TRUE}, 110 {3, 1920, 1440, 70, TRUE}, 111 {4, 1920, 1440, 75, TRUE}, 112 {5, 1920, 1440, 85, TRUE}, 113 {6, 1920, 1440, 100, TRUE}, 114 {1, 2048, 1536, 60, TRUE}, 115 {2, 2048, 1536, 65, TRUE}, 116 {3, 2048, 1536, 70, TRUE}, 117 {4, 2048, 1536, 75, TRUE}, 118 {5, 2048, 1536, 85, TRUE}, 119 {0, 0, 0, 0, FALSE} 120}; 121 122 123/* TV filters for video bridges 124 */ 125static const struct _XGITVFilter301 { 126 unsigned char filter[7][4]; 127} XGITVFilter301[] = { 128 {{ {0x00,0xE0,0x10,0x60}, /* NTSCFilter - 320 */ 129 {0x00,0xEE,0x10,0x44}, 130 {0x00,0xF4,0x10,0x38}, 131 {0xF8,0xF4,0x18,0x38}, 132 {0xFC,0xFB,0x14,0x2A}, 133 {0x00,0x00,0x10,0x20}, 134 {0x00,0x04,0x10,0x18} }}, 135 {{ {0xF5,0xEE,0x1B,0x44}, /* NTSCFilter - 640 */ 136 {0xF8,0xF4,0x18,0x38}, 137 {0xEB,0x04,0x25,0x18}, 138 {0xF1,0x05,0x1F,0x16}, 139 {0xF6,0x06,0x1A,0x14}, 140 {0xFA,0x06,0x16,0x14}, 141 {0x00,0x04,0x10,0x18} }}, 142 {{ {0xEB,0x04,0x25,0x18}, /* NTSCFilter - 720 */ 143 {0xE7,0x0E,0x29,0x04}, 144 {0xEE,0x0C,0x22,0x08}, 145 {0xF6,0x0B,0x1A,0x0A}, 146 {0xF9,0x0A,0x17,0x0C}, 147 {0xFC,0x0A,0x14,0x0C}, 148 {0x00,0x08,0x10,0x10} }}, 149 {{ {0xEC,0x02,0x24,0x1C}, /* NTSCFilter - 800/400 */ 150 {0xF2,0x04,0x1E,0x18}, 151 {0xEB,0x15,0x25,0xF6}, 152 {0xF4,0x10,0x1C,0x00}, 153 {0xF8,0x0F,0x18,0x02}, 154 {0x00,0x04,0x10,0x18}, 155 {0x01,0x06,0x0F,0x14} }}, 156 {{ {0x00,0xE0,0x10,0x60}, /* PALFilter - 320 */ 157 {0x00,0xEE,0x10,0x44}, 158 {0x00,0xF4,0x10,0x38}, 159 {0xF8,0xF4,0x18,0x38}, 160 {0xFC,0xFB,0x14,0x2A}, 161 {0x00,0x00,0x10,0x20}, 162 {0x00,0x04,0x10,0x18} }}, 163 {{ {0xF5,0xEE,0x1B,0x44}, /* PALFilter - 640 */ 164 {0xF8,0xF4,0x18,0x38}, 165 {0xF1,0xF7,0x1F,0x32}, 166 {0xF5,0xFB,0x1B,0x2A}, 167 {0xF9,0xFF,0x17,0x22}, 168 {0xFB,0x01,0x15,0x1E}, 169 {0x00,0x04,0x10,0x18} }}, 170 {{ {0xF5,0xEE,0x1B,0x2A}, /* PALFilter - 720 */ 171 {0xEE,0xFE,0x22,0x24}, 172 {0xF3,0x00,0x1D,0x20}, 173 {0xF9,0x03,0x17,0x1A}, 174 {0xFB,0x02,0x14,0x1E}, 175 {0xFB,0x04,0x15,0x18}, 176 {0x00,0x06,0x10,0x14} }}, 177 {{ {0xF5,0xEE,0x1B,0x44}, /* PALFilter - 800/400 */ 178 {0xF8,0xF4,0x18,0x38}, 179 {0xFC,0xFB,0x14,0x2A}, 180 {0xEB,0x05,0x25,0x16}, 181 {0xF1,0x05,0x1F,0x16}, 182 {0xFA,0x07,0x16,0x12}, 183 {0x00,0x07,0x10,0x12} }} 184}; 185 186static const struct _XGITVFilter301B { 187 unsigned char filter[7][7]; 188} XGITVFilter301B[] = { 189 {{ {0x01,0x02,0xfb,0xf8,0x06,0x27,0x3a}, /* NTSC - 640 */ 190 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 191 {0x01,0x01,0x00,0xf6,0x00,0x28,0x40}, 192 {0xff,0x03,0x02,0xf6,0xfc,0x27,0x46}, 193 {0xff,0x01,0x04,0xf8,0xfa,0x27,0x46}, 194 {0xff,0x01,0x05,0xf9,0xf7,0x26,0x4a}, 195 {0xff,0xff,0x05,0xfc,0xf4,0x24,0x52} }}, 196 {{ {0x01,0x00,0xfb,0xfb,0x0b,0x25,0x32}, /* NTSC - 720 (?) */ 197 {0x01,0x01,0xfb,0xf9,0x09,0x26,0x36}, 198 {0x01,0x02,0xfc,0xf8,0x06,0x27,0x38}, 199 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 200 {0x01,0x03,0xff,0xf6,0x00,0x27,0x40}, 201 {0xff,0x03,0x02,0xf6,0xfe,0x27,0x42}, 202 {0xff,0x02,0x03,0xf7,0xfb,0x27,0x46} }}, 203 {{ {0x01,0xfe,0xfb,0xfe,0x0e,0x23,0x2e}, /* NTSC - 800 */ 204 {0x01,0xff,0xfb,0xfc,0x0c,0x25,0x30}, 205 {0x01,0x00,0xfb,0xfa,0x0a,0x26,0x34}, 206 {0x01,0x01,0xfc,0xf8,0x08,0x26,0x38}, 207 {0x01,0x02,0xfd,0xf7,0x06,0x27,0x38}, 208 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 209 {0xff,0x03,0x00,0xf6,0x00,0x27,0x42} }}, 210 {{ {0xff,0xfd,0xfe,0x05,0x11,0x1e,0x24}, /* NTSC - 1024 */ 211 {0xff,0xfd,0xfd,0x04,0x11,0x1f,0x26}, 212 {0xff,0xfd,0xfc,0x02,0x10,0x22,0x28}, 213 {0xff,0xff,0xfc,0x00,0x0f,0x22,0x28}, 214 {0x01,0xfe,0xfb,0xff,0x0e,0x23,0x2c}, 215 {0x01,0xff,0xfb,0xfd,0x0d,0x24,0x2e}, 216 {0x01,0xff,0xfb,0xfb,0x0c,0x25,0x32} }}, 217 {{ {0x01,0x02,0xfb,0xf8,0x06,0x27,0x3a}, /* PAL - 640 */ 218 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 219 {0x01,0x01,0x00,0xf6,0x00,0x28,0x40}, 220 {0xff,0x03,0x02,0xf6,0xfc,0x27,0x46}, 221 {0xff,0x01,0x04,0xf8,0xfa,0x27,0x46}, 222 {0xff,0x01,0x05,0xf9,0xf7,0x26,0x4a}, 223 {0xff,0xff,0x05,0xfc,0xf4,0x24,0x52} }}, 224 {{ {0x01,0x00,0xfb,0xfb,0x0b,0x25,0x32}, /* PAL - 720/768 */ 225 {0x01,0x01,0xfb,0xf9,0x09,0x26,0x36}, 226 {0x01,0x02,0xfc,0xf8,0x06,0x27,0x38}, 227 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 228 {0x01,0x03,0xff,0xf6,0x00,0x27,0x40}, 229 {0xff,0x03,0x02,0xf6,0xfe,0x27,0x42}, 230 {0xff,0x02,0x03,0xf7,0xfb,0x27,0x46} }}, 231 {{ {0x01,0xfe,0xfb,0xfe,0x0e,0x23,0x2e}, /* PAL - 800 */ 232 {0x01,0xff,0xfb,0xfc,0x0c,0x25,0x30}, 233 {0x01,0x00,0xfb,0xfa,0x0a,0x26,0x34}, 234 {0x01,0x01,0xfc,0xf8,0x08,0x26,0x38}, 235 {0x01,0x02,0xfd,0xf7,0x06,0x27,0x38}, 236 {0x01,0x02,0xfe,0xf7,0x03,0x27,0x3c}, 237 {0xff,0x03,0x00,0xf6,0x00,0x27,0x42} }}, 238 {{ {0xff,0xfd,0xfe,0x05,0x11,0x1e,0x24}, /* PAL - 1024 */ 239 {0xff,0xfd,0xfd,0x04,0x11,0x1f,0x26}, 240 {0xff,0xfd,0xfc,0x02,0x10,0x22,0x28}, 241 {0xff,0xff,0xfc,0x00,0x0f,0x22,0x28}, 242 {0x01,0xfe,0xfb,0xff,0x0e,0x23,0x2c}, 243 {0x01,0xff,0xfb,0xfd,0x0d,0x24,0x2e}, 244 {0x01,0xff,0xfb,0xfb,0x0c,0x25,0x32} }} 245}; 246 247/* TV scaling data for video bridges 248 */ 249typedef struct _XGITVVScale { 250 unsigned short ScaleVDE; 251 int sindex; 252 unsigned short RealVDE; 253 unsigned short reg[24]; 254} MyXGITVVScale, *MyXGITVVScalePtr; 255 256static const MyXGITVVScale XGITVVScale[] = { 257 { 0x01D6, 3, 480, /* NTSC 640 */ 258 { 0x037C, 0x02B0, 0x00EF, 0x01FA, 0x01E7, 0x01E9, 259 0x0000, 0x004C, 0x008F, 0x037C, 0x01FB, 0x00D4, 260 0x037C, 0x02CB, 0x0049, 0x01FB, 0x01EE, 0x01F0, 261 0x0000, 0x004C, 0x008F, 0x037C, 0x01FB, 0x00E0 } 262 }, 263 { 0x01CC, 2, 480, 264 { 0x0369, 0x02AD, 0x00E7, 0x01FF, 0x01E8, 0x01EB, 265 0x0000, 0x004C, 0x008F, 0x0369, 0x0200, 0x00D4, 266 0x0369, 0x02C6, 0x003A, 0x0200, 0x01F0, 0x01F3, 267 0x0000, 0x004C, 0x008F, 0x0369, 0x0200, 0x00E0 } 268 }, 269 { 0x01C2, 1, 480, 270 { 0x0356, 0x02AB, 0x00E0, 0x0204, 0x01E9, 0x01EC, 271 0x0000, 0x004C, 0x008F, 0x0356, 0x0205, 0x00D4, 272 0x0356, 0x02C1, 0x002B, 0x0205, 0x01F3, 0x01F6, 273 0x0000, 0x004C, 0x008F, 0x0356, 0x0205, 0x00E0 } 274 }, 275 { 0x01B8, 0, 480, /* default */ 276 { 0x0343, 0x02A9, 0x00DA, 0x0209, 0x01EA, 0x01ED, 277 0x0000, 0x004C, 0x008F, 0x0343, 0x020A, 0x00D4, 278 0x0343, 0x02BD, 0x001F, 0x020A, 0x01F5, 0x01F8, 279 0x0000, 0x004C, 0x008F, 0x0343, 0x020A, 0x00E0 } 280 }, 281 { 0x01AE, -1, 480, 282 { 0x035B, 0x02AC, 0x00E3, 0x020E, 0x01EC, 0x01F0, 283 0x0000, 0x0050, 0x008F, 0x035B, 0x020F, 0x0152, 284 0x035B, 0x02C3, 0x0031, 0x020F, 0x01F8, 0x01FC, 285 0x0000, 0x0050, 0x008F, 0x035B, 0x020F, 0x015E } 286 }, 287 { 0x01A4, -2, 480, 288 { 0x0347, 0x02A9, 0x00DB, 0x0213, 0x01ED, 0x01F1, 289 0x0000, 0x0050, 0x008F, 0x0347, 0x0214, 0x0102, 290 0x0347, 0x02BE, 0x0022, 0x0214, 0x01FA, 0x01FE, 291 0x0000, 0x0050, 0x008F, 0x0347, 0x0214, 0x010E } 292 }, 293 { 0x019A, -3, 480, 294 { 0x0333, 0x02A7, 0x00D4, 0x0218, 0x01EE, 0x01F2, 295 0x0000, 0x0050, 0x008F, 0x0333, 0x0219, 0x016A, 296 0x0333, 0x02B9, 0x0013, 0x0219, 0x01FD, 0x0201, 297 0x0000, 0x0050, 0x008F, 0x0333, 0x0219, 0x016A } 298 }, 299 { 0x01D6, 3, 480, /* NTSC 720 */ 300 { 0x037C, 0x0307, 0x005D, 0x01FB, 0x01EE, 0x01F0, 301 0x0000, 0x004C, 0x008F, 0x037C, 0x01FB, 0x0090 } 302 }, 303 { 0x01CC, 2, 480, 304 { 0x0369, 0x0302, 0x004E, 0x0200, 0x01F0, 0x01F3, 305 0x0000, 0x004C, 0x008F, 0x0369, 0x0200, 0x0090 } 306 }, 307 { 0x01C2, 1, 480, 308 { 0x0356, 0x02FD, 0x003F, 0x0205, 0x01F3, 0x01F6, 309 0x0000, 0x004C, 0x008F, 0x0356, 0x0205, 0x0090 } 310 }, 311 { 0x01B8, 0, 480, /* default */ 312 { 0x0343, 0x02F9, 0x0033, 0x020A, 0x01F5, 0x01F8, 313 0x0000, 0x004C, 0x008F, 0x0343, 0x020A, 0x0090 } 314 }, 315 { 0x01AE, -1, 480, 316 { 0x035B, 0x02FF, 0x0045, 0x020F, 0x01F8, 0x01FC, 317 0x0000, 0x0050, 0x008F, 0x035B, 0x020F, 0x010E } 318 }, 319 { 0x01A4, -2, 480, 320 { 0x0347, 0x02FA, 0x0036, 0x0214, 0x01FA, 0x01FE, 321 0x0000, 0x0050, 0x008F, 0x0347, 0x0214, 0x00BE } 322 }, 323 { 0x019A, -3, 480, 324 { 0x0333, 0x02F5, 0x0027, 0x0219, 0x01FD, 0x0201, 325 0x0000, 0x0050, 0x008F, 0x0333, 0x0219, 0x0136 } 326 }, 327 { 0x01D6, 3, 600, /* NTSC 800 */ 328 { 0x0438, 0x0353, 0x0099, 0x0272, 0x025F, 0x0261, 329 0x0000, 0x0073, 0x008F, 0x0438, 0x0273, 0x020A, 330 0x0438, 0x0372, 0x00FE, 0x0273, 0x0266, 0x0268, 331 0x0000, 0x0073, 0x008F, 0x0438, 0x0273, 0x020A } 332 }, 333 { 0x01CC, 2, 600, 334 { 0x0421, 0x0350, 0x0090, 0x0277, 0x0260, 0x0263, 335 0x0000, 0x0073, 0x008F, 0x0421, 0x0278, 0x020A, 336 0x0421, 0x036C, 0x00EC, 0x0278, 0x0268, 0x026B, 337 0x0000, 0x0073, 0x008F, 0x0421, 0x0278, 0x020A } 338 }, 339 { 0x01C2, 1, 600, 340 { 0x0413, 0x034F, 0x008C, 0x027C, 0x0261, 0x0264, 341 0x0000, 0x0074, 0x008F, 0x0413, 0x027D, 0x01FE, 342 0x0413, 0x0369, 0x00E3, 0x027D, 0x026B, 0x026E, 343 0x0000, 0x0074, 0x008F, 0x0413, 0x027D, 0x020C } 344 }, 345 { 0x01B8, 0, 600, /* default */ 346 { 0x041F, 0x0350, 0x0090, 0x0281, 0x0262, 0x0265, 347 0x0000, 0x0078, 0x008F, 0x041F, 0x0282, 0x0220, 348 0x041F, 0x036C, 0x00EC, 0x0282, 0x026D, 0x0270, 349 0x0001, 0x0078, 0x008F, 0x041F, 0x0282, 0x0220 } 350 }, 351 { 0x01AE, -1, 600, 352 { 0x0407, 0x034D, 0x0087, 0x0286, 0x0264, 0x0268, 353 0x0000, 0x0078, 0x008F, 0x0407, 0x0287, 0x0220, 354 0x0407, 0x0366, 0x00DA, 0x0287, 0x0270, 0x0274, 355 0x0001, 0x0078, 0x008F, 0x0407, 0x0287, 0x0220 } 356 }, 357 { 0x01A4, -2, 600, 358 { 0x03EF, 0x034A, 0x007E, 0x028B, 0x0265, 0x0269, 359 0x0000, 0x0078, 0x008F, 0x03EF, 0x028C, 0x0220, 360 0x03EF, 0x0360, 0x00C8, 0x028C, 0x0272, 0x0276, 361 0x0001, 0x0078, 0x008F, 0x03EF, 0x028C, 0x0220 } 362 }, 363 { 0x019A, -3, 600, 364 { 0x0429, 0x0351, 0x0093, 0x0290, 0x0266, 0x026A, 365 0x0000, 0x0082, 0x008F, 0x0429, 0x0291, 0x024E, 366 0x0429, 0x036E, 0x00F2, 0x0291, 0x0275, 0x0279, 367 0x0001, 0x0082, 0x008F, 0x0429, 0x0291, 0x024E } 368 }, 369 { 0x0230, 3, 480, /* PAL 640 */ 370 { 0x0371, 0x02AE, 0x00EA, 0x01FF, 0x01E8, 0x01EB, 371 0x0000, 0x0007, 0x0010, 0x0371, 0x0200, 0x0032, 372 0x0371, 0x02C8, 0x0040, 0x0200, 0x01F0, 0x01F3, 373 0x0000, 0x000E, 0x0020, 0x0371, 0x0200, 0x0032 } 374 }, 375 { 0x0226, 2, 480, 376 { 0x0383, 0x02B1, 0x00F2, 0x0204, 0x01E9, 0x01EC, 377 0x0000, 0x0005, 0x000B, 0x0383, 0x0205, 0x0032, 378 0x0383, 0x02CD, 0x004F, 0x0205, 0x01F3, 0x01F6, 379 0x0000, 0x0005, 0x000B, 0x0383, 0x0205, 0x0032 } 380 }, 381 { 0x021C, 1, 480, 382 { 0x035F, 0x02AC, 0x00E4, 0x0209, 0x01EA, 0x01ED, 383 0x0000, 0x0004, 0x0009, 0x035F, 0x020A, 0x0032, 384 0x035F, 0x02C4, 0x0034, 0x020A, 0x01F5, 0x01F8, 385 0x0000, 0x0004, 0x0009, 0x035F, 0x020A, 0x0032 } 386 }, 387 { 0x0212, 0, 480, /* default */ 388 { 0x034F, 0x02AA, 0x00DE, 0x020E, 0x01EC, 0x01F0, 389 0x0000, 0x0004, 0x0009, 0x034F, 0x020F, 0x0032, 390 0x034F, 0x02C0, 0x0028, 0x020F, 0x01F8, 0x01FC, 391 0x0000, 0x0004, 0x0009, 0x034F, 0x020F, 0x0032 } 392 }, 393 { 0x0208, -1, 480, 394 { 0x033F, 0x02A8, 0x00D8, 0x0213, 0x01ED, 0x01F1, 395 0x0000, 0x0004, 0x0009, 0x033F, 0x0214, 0x0032, 396 0x033F, 0x02BC, 0x001C, 0x0214, 0x01FA, 0x01FE, 397 0x0000, 0x0004, 0x0009, 0x033F, 0x0214, 0x0032 } 398 }, 399 { 0x01FE, -2, 480, 400 { 0x0395, 0x02B3, 0x00F8, 0x0218, 0x01EE, 0x01F2, 401 0x0000, 0x0001, 0x0002, 0x0395, 0x0219, 0x0032, 402 0x0395, 0x02D1, 0x005B, 0x0219, 0x01FD, 0x0201, 403 0x0000, 0x0001, 0x0002, 0x0395, 0x0219, 0x0032 } 404 }, 405 { 0x01F4, -3, 480, 406 { 0x0383, 0x02B1, 0x00F2, 0x021D, 0x01EF, 0x01F3, 407 0x0000, 0x0001, 0x0002, 0x0383, 0x021E, 0x0032, 408 0x0383, 0x02CD, 0x004F, 0x021E, 0x01FF, 0x0203, 409 0x0000, 0x0001, 0x0002, 0x0383, 0x021E, 0x0032 } 410 }, 411 { 0x0230, 2, 576, /* PAL 720 */ 412 { 0x03BF, 0x0318, 0x0090, 0x0260, 0x0250, 0x0253, 413 0x0000, 0x0004, 0x0007, 0x03BF, 0x0260, 0x00E0, 414 0x6954, 0x6C6C, 0x5320, 0x666F, 0x6169, 0x4220, 415 0x7265, 0x746E, 0x7373, 0x6E6F, 0x0260, 0x00E0 } 416 }, 417 { 0x0226, 1, 576, 418 { 0x03DD, 0x031F, 0x00A5, 0x0265, 0x0253, 0x0256, 419 0x0000, 0x0003, 0x0005, 0x03DD, 0x0265, 0x013B, 420 0x7242, 0x756F, 0x6867, 0x2074, 0x6F74, 0x7920, 421 0x756F, 0x6220, 0x2079, 0x6F6E, 0x2074, 0x2061 } 422 }, 423 { 0x021C, 0, 576, /* default */ 424 { 0x0437, 0x0336, 0x00EA, 0x026A, 0x0255, 0x0258, 425 0x0000, 0x0002, 0x0003, 0x0437, 0x026A, 0x0180, 426 0x656D, 0x6572, 0x5720, 0x7A69, 0x7261, 0x2064, 427 0x7562, 0x2074, 0x6874, 0x2065, 0x0274, 0x01CE } 428 }, 429 { 0x0212, -1, 576, 430 { 0x0423, 0x0331, 0x00DB, 0x026F, 0x0258, 0x025C, 431 0x0001, 0x0002, 0x0003, 0x0423, 0x026F, 0x01CA, 432 0x6957, 0x617A, 0x6472, 0x4520, 0x7478, 0x6172, 433 0x726F, 0x6964, 0x616E, 0x7269, 0x3A65, 0x01CE } 434 }, 435 { 0x0208, -2, 576, 436 { 0x040F, 0x032C, 0x00CC, 0x0274, 0x025A, 0x025E, 437 0x0000, 0x0002, 0x0003, 0x040F, 0x0274, 0x01CA, 438 0x6854, 0x6D6F, 0x7361, 0x5720, 0x6E69, 0x7369, 439 0x6863, 0x6F68, 0x6566, 0x2172, 0x027E, 0x01CA } 440 }, 441 { 0x01FE, -3, 576, 442 { 0x03FB, 0x0327, 0x00BD, 0x0279, 0x025D, 0x0261, 443 0x0000, 0x0002, 0x0003, 0x03FB, 0x0279, 0x01CA, 444 } 445 }, 446 { 0x01F4, -4, 576, 447 { 0x03E7, 0x0322, 0x00AE, 0x027E, 0x025F, 0x0263, 448 0x0000, 0x0002, 0x0003, 0x03E7, 0x027E, 0x01CA, 449 0x6854, 0x7369, 0x7320, 0x6170, 0x6563, 0x6620, 450 0x726F, 0x7320, 0x6C61, 0x0365, 0x027F, 0x01FE } 451 }, 452 { 0x0230, 3, 600, /* PAL 800 */ 453 { 0x047F, 0x035C, 0x00B4, 0x0277, 0x0260, 0x0263, 454 0x0000, 0x0005, 0x0007, 0x047F, 0x0278, 0x0170, 455 0x047F, 0x0384, 0x0034, 0x0278, 0x0268, 0x026B, 456 0x0000, 0x0005, 0x0007, 0x047F, 0x0278, 0x017E } 457 }, 458 { 0x0226, 2, 600, 459 { 0x044B, 0x0356, 0x00A1, 0x027C, 0x0261, 0x0264, 460 0x0000, 0x0019, 0x0024, 0x044B, 0x027D, 0x0150, 461 0x044B, 0x0377, 0x000D, 0x027D, 0x026B, 0x026E, 462 0x0000, 0x0019, 0x0024, 0x044B, 0x027D, 0x015E } 463 }, 464 { 0x021C, 1, 600, 465 { 0x0437, 0x0353, 0x0099, 0x0281, 0x0262, 0x0265, 466 0x0000, 0x0019, 0x0024, 0x0437, 0x0282, 0x0150, 467 0x0437, 0x0372, 0x00FE, 0x0282, 0x026D, 0x0270, 468 0x0000, 0x0019, 0x0024, 0x0437, 0x0282, 0x015E } 469 }, 470 { 0x0212, 0, 600, /* default */ 471 { 0x0423, 0x0351, 0x0092, 0x0286, 0x0264, 0x0268, 472 0x0000, 0x0019, 0x0024, 0x0423, 0x0287, 0x01C8, 473 0x0423, 0x036D, 0x00EF, 0x0287, 0x0270, 0x0274, 474 0x0000, 0x0019, 0x0024, 0x0423, 0x0287, 0x01D6 } 475 }, 476 { 0x0208, -1, 600, 477 { 0x040F, 0x034E, 0x008A, 0x028B, 0x0265, 0x0269, 478 0x0000, 0x0019, 0x0024, 0x040F, 0x028C, 0x01A0, 479 0x040F, 0x0368, 0x00E0, 0x028C, 0x0272, 0x0276, 480 0x0000, 0x0019, 0x0024, 0x040F, 0x028C, 0x01AE } 481 }, 482 { 0x01FE, -2, 600, 483 { 0x03FB, 0x034C, 0x0083, 0x0290, 0x0266, 0x026A, 484 0x0000, 0x0019, 0x0024, 0x03FB, 0x0291, 0x01C8, 485 0x03FB, 0x0363, 0x00D1, 0x0291, 0x0275, 0x0279, 486 0x0000, 0x0019, 0x0024, 0x03FB, 0x0291, 0x01D6 } 487 }, 488 { 0x01F4, -3, 600, 489 { 0x0437, 0x0353, 0x0099, 0x0295, 0x0267, 0x026B, 490 0x0000, 0x0003, 0x0004, 0x0437, 0x0296, 0x01BF, 491 0x0437, 0x0372, 0x00FE, 0x0296, 0x0277, 0x027B, 492 0x0000, 0x0003, 0x0004, 0x0437, 0x0296, 0x01BA } 493 }, 494}; 495 496static unsigned const char XGIScalingP1Regs[] = { 497 0x08,0x09,0x0b,0x0c,0x0d,0x0e,0x10,0x11,0x12 498}; 499static unsigned const char XGIScalingP4Regs[] = { 500 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b 501}; 502 503static const unsigned char XGI301CScaling[] = { 504 505 /* NTSC/PAL-M/525ip 640x480 */ 506 507 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D, 508 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, 509 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, 510 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01, 511 512 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D, 513 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, 514 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, 515 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02, 516 517 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, 518 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, 519 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, 520 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, 521 522 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, 523 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, 524 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, 525 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, 526 527 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, 528 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, 529 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E, 530 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 531 532 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D, 533 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D, 534 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E, 535 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03, 536 537 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, 538 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 539 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, 540 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, 541 542 /* NTSC/PAL-M/525ip 720x480 */ 543 544 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D, 545 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, 546 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, 547 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01, 548 549 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D, 550 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, 551 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, 552 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02, 553 554 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, 555 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, 556 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, 557 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, 558 559 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, 560 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, 561 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, 562 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, 563 564 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, 565 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, 566 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E, 567 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 568 569 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D, 570 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D, 571 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E, 572 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03, 573 574 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, 575 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 576 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, 577 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, 578 579 /* NTSC/PAL-M/525i 800x600 */ 580 581 0x07,0x15,0x07,0x7D,0x05,0x15,0x08,0x7E,0x04,0x15,0x09,0x7E,0x03,0x15,0x0B,0x7D, 582 0x02,0x14,0x0C,0x7E,0x01,0x14,0x0D,0x7E,0x00,0x13,0x0F,0x7E,0x00,0x12,0x10,0x7E, 583 0x7F,0x11,0x11,0x7F,0x7E,0x10,0x12,0x00,0x7E,0x0F,0x13,0x00,0x7E,0x0D,0x14,0x01, 584 0x7D,0x0C,0x14,0x03,0x7D,0x0B,0x15,0x03,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06, 585 586 0x07,0x15,0x07,0x7D,0x06,0x15,0x08,0x7D,0x05,0x15,0x09,0x7D,0x04,0x14,0x0B,0x7D, 587 0x03,0x14,0x0C,0x7D,0x02,0x13,0x0D,0x7E,0x01,0x13,0x0E,0x7E,0x00,0x12,0x10,0x7E, 588 0x7F,0x11,0x11,0x7F,0x7F,0x10,0x12,0x7F,0x7E,0x0E,0x13,0x01,0x7E,0x0D,0x13,0x02, 589 0x7E,0x0C,0x14,0x02,0x7D,0x0B,0x14,0x04,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06, 590 591 0x07,0x14,0x07,0x7E,0x06,0x14,0x08,0x7E,0x05,0x14,0x0A,0x7D,0x04,0x14,0x0B,0x7D, 592 0x03,0x13,0x0C,0x7E,0x02,0x13,0x0D,0x7E,0x01,0x12,0x0E,0x7F,0x00,0x11,0x0F,0x00, 593 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x13,0x02, 594 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x14,0x03,0x7D,0x0A,0x14,0x05,0x7D,0x08,0x14,0x07, 595 596 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E, 597 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F, 598 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03, 599 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06, 600 601 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x05,0x13,0x0A,0x7E,0x04,0x13,0x0B,0x7E, 602 0x04,0x12,0x0C,0x7E,0x03,0x12,0x0D,0x7E,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0F,0x00, 603 0x00,0x10,0x10,0x00,0x00,0x0F,0x10,0x01,0x7F,0x0E,0x11,0x02,0x7F,0x0D,0x12,0x02, 604 0x7E,0x0C,0x12,0x04,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x13,0x05,0x7E,0x09,0x13,0x06, 605 606 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E, 607 0x04,0x12,0x0C,0x7E,0x03,0x11,0x0D,0x7F,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0E,0x01, 608 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0E,0x11,0x01,0x7F,0x0D,0x11,0x03, 609 0x7F,0x0C,0x12,0x03,0x7E,0x0B,0x12,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x13,0x06, 610 611 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E, 612 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0D,0x7F,0x02,0x10,0x0D,0x01,0x02,0x10,0x0E,0x00, 613 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0D,0x11,0x03, 614 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x12,0x04,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07, 615 616 /* PAL/PAL-N 640x480 */ 617 618 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 619 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 620 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 621 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 622 623 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 624 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 625 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 626 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 627 628 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 629 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 630 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 631 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 632 633 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 634 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 635 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 636 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 637 638 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 639 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 640 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 641 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 642 643 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 644 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 645 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 646 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 647 648 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, 649 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, 650 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, 651 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, 652 653 /* PAL/PAL-N 720x576, 768x576 */ 654 655 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x07,0x7D,0x7F,0x1B,0x09,0x7D, 656 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, 657 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, 658 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1C,0x7F,0x7E,0x05,0x1C,0x01, 659 660 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x01,0x1B,0x07,0x7D,0x7F,0x1B,0x09,0x7D, 661 0x7E,0x1A,0x0B,0x7D,0x7E,0x19,0x0D,0x7C,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, 662 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, 663 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7D,0x07,0x1B,0x01,0x7E,0x05,0x1B,0x02, 664 665 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, 666 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, 667 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, 668 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, 669 670 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x1A,0x09,0x7D, 671 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, 672 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, 673 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, 674 675 0x04,0x19,0x04,0x7F,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, 676 0x7F,0x18,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, 677 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F, 678 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 679 680 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, 681 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 682 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, 683 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 684 685 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D, 686 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 687 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, 688 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04, 689 690 /* PAL/PAL-N 800x600 */ 691 692 0x04,0x1A,0x04,0x7E,0x02,0x1A,0x05,0x7F,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, 693 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, 694 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, 695 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1A,0x03, 696 697 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, 698 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, 699 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, 700 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, 701 702 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, 703 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, 704 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F, 705 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 706 707 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, 708 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 709 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, 710 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, 711 712 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D, 713 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 714 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, 715 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04, 716 717 0x06,0x18,0x06,0x7C,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, 718 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, 719 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, 720 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, 721 722 0x06,0x17,0x06,0x7D,0x05,0x17,0x07,0x7D,0x03,0x17,0x09,0x7D,0x02,0x17,0x0A,0x7D, 723 0x01,0x16,0x0C,0x7D,0x00,0x15,0x0E,0x7D,0x7F,0x14,0x0F,0x7E,0x7F,0x13,0x11,0x7D, 724 0x7E,0x12,0x12,0x7E,0x7E,0x11,0x13,0x7E,0x7D,0x0F,0x14,0x00,0x7D,0x0E,0x15,0x00, 725 0x7D,0x0C,0x16,0x01,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x17,0x03,0x7D,0x07,0x17,0x05 726}; 727 728 729/* Mandatory functions */ 730static void XGIIdentify(int flags); 731static Bool XGIPreInit(ScrnInfoPtr pScrn, int flags); 732static Bool XGIScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); 733static Bool XGIEnterVT(int scrnIndex, int flags); 734static void XGILeaveVT(int scrnIndex, int flags); 735static Bool XGICloseScreen(int scrnIndex, ScreenPtr pScreen); 736static Bool XGISaveScreen(ScreenPtr pScreen, int mode); 737static Bool XGISwitchMode(int scrnIndex, DisplayModePtr mode, int flags); 738static void XGIAdjustFrame(int scrnIndex, int x, int y, int flags); 739static Bool XGISaveScreenDH(ScreenPtr pScreen, int mode); 740 741/* Optional functions */ 742static void XGIFreeScreen(int scrnIndex, int flags); 743 744static int XGIValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, 745 int flags); 746/* Internally used functions */ 747static Bool XGIMapMem(ScrnInfoPtr pScrn); 748static Bool XGIUnmapMem(ScrnInfoPtr pScrn); 749static void XGISave(ScrnInfoPtr pScrn); 750static void XGIRestore(ScrnInfoPtr pScrn); 751static Bool XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); 752static void XGIModifyModeInfo(DisplayModePtr mode); 753static void XGIPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode); 754static void XGIPostSetMode(ScrnInfoPtr pScrn, XGIRegPtr xgiReg); 755 756/* static Bool InRegion(int x, int y, region r); */ 757/* #ifdef XGIMERGED 758static void XGIMergePointerMoved(int scrnIndex, int x, int y); 759#endif */ 760USHORT XGI_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, 761 unsigned long VBFlags); 762unsigned char XGI_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value); 763#ifdef DEBUG 764static void XGIDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); 765#endif 766 767extern BOOLEAN XGIBIOSSetMode(VB_DEVICE_INFO *XGI_Pr, 768 PXGI_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, 769 DisplayModePtr mode); 770 771extern void XGI_New_GetVBType(VB_DEVICE_INFO *XGI_Pr, PXGI_HW_DEVICE_INFO); 772 773extern BOOLEAN XGIBIOSSetModeCRT1(VB_DEVICE_INFO *XGI_Pr, 774 PXGI_HW_DEVICE_INFO HwDeviceExtension, ScrnInfoPtr pScrn, 775 DisplayModePtr mode); 776