1 | ␊ |
2 | /* Copied from 915 resolution created by steve tomljenovic␊ |
3 | *␊ |
4 | * This code is based on the techniques used in :␊ |
5 | *␊ |
6 | * - 855patch. Many thanks to Christian Zietz (czietz gmx net)␊ |
7 | * for demonstrating how to shadow the VBIOS into system RAM␊ |
8 | * and then modify it.␊ |
9 | *␊ |
10 | * - 1280patch by Andrew Tipton (andrewtipton null li).␊ |
11 | *␊ |
12 | * - 855resolution by Alain Poirier␊ |
13 | *␊ |
14 | * This source code is into the public domain.␊ |
15 | */␊ |
16 | #ifndef __915_RESOLUTION_H␊ |
17 | #define __915_RESOLUTION_H␊ |
18 | ␊ |
19 | //#define AUTORES_DEBUG 1 // enable AutoResolution debug - review!␊ |
20 | ␊ |
21 | #include "libsa.h"␊ |
22 | #include "saio_internal.h"␊ |
23 | #include "edid.h"␊ |
24 | ␊ |
25 | #if DEBUG␊ |
26 | #ifndef AUTORES_DEBUG␊ |
27 | #define AUTORES_DEBUG␊ |
28 | #endif␊ |
29 | #endif␊ |
30 | ␊ |
31 | #ifdef AUTORES_DEBUG␊ |
32 | #define PRINT(a, b...) printf(a, ##b);␊ |
33 | #else ␊ |
34 | #define PRINT(a, b...) verbose(a, ##b);␊ |
35 | #endif␊ |
36 | ␊ |
37 | #define __packed __attribute__((packed))␊ |
38 | ␊ |
39 | #define NEW(a) ((a *)(malloc(sizeof(a))))␊ |
40 | #define FREE(a) (free(a))␊ |
41 | ␊ |
42 | #define VBIOS_START 0xc0000␊ |
43 | #define VBIOS_SIZE 0x10000␊ |
44 | ␊ |
45 | #define FALSE 0␊ |
46 | #define TRUE 1␊ |
47 | ␊ |
48 | ␊ |
49 | bool gAutoResolution;␊ |
50 | ␊ |
51 | ␊ |
52 | typedef struct␊ |
53 | {␊ |
54 | ␉uint8_t width;␊ |
55 | ␉uint8_t height;␊ |
56 | } sAspect;␊ |
57 | ␊ |
58 | ␊ |
59 | typedef enum␊ |
60 | {␊ |
61 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
62 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
63 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
64 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
65 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
66 | } chipsetType;␊ |
67 | ␊ |
68 | ␊ |
69 | typedef enum␊ |
70 | {␊ |
71 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
72 | } biosType;␊ |
73 | ␊ |
74 | typedef struct␊ |
75 | {␊ |
76 | ␉uint32_t␉clock;␊ |
77 | ␉uint16_t␉x;␊ |
78 | ␉uint16_t␉hSyncStart;␊ |
79 | ␉uint16_t␉hSyncEnd;␊ |
80 | ␉uint16_t␉hTotal;␊ |
81 | ␉uint16_t␉y;␊ |
82 | ␉uint16_t␉vSyncStart;␊ |
83 | ␉uint16_t␉vSyncEnd;␊ |
84 | ␉uint16_t␉vTotal;␊ |
85 | } generic_modeline;␊ |
86 | ␊ |
87 | typedef struct sModeTable_␊ |
88 | {␊ |
89 | ␉uint8_t␉*␉pointer;␊ |
90 | ␉␊ |
91 | ␉uint8_t␉␉id;␊ |
92 | ␉uint32_t␉size;␊ |
93 | ␉uint32_t␉modeCount;␊ |
94 | ␉␊ |
95 | ␉uint8_t *␉backup;␊ |
96 | ␉␊ |
97 | ␉struct sModeTable_ *prev;␊ |
98 | ␉struct sModeTable_ *next;␊ |
99 | } sModeTable;␊ |
100 | ␉␊ |
101 | ␊ |
102 | ␊ |
103 | typedef struct␊ |
104 | {␊ |
105 | ␉uint32_t chipsetId;␊ |
106 | ␉chipsetType chipset;␊ |
107 | ␉biosType bios;␊ |
108 | ␉␊ |
109 | ␉uint8_t* biosBackupPtr;␊ |
110 | ␉uint8_t* biosPtr;␊ |
111 | ␉␊ |
112 | ␉sModeTable *modeTables;␊ |
113 | ␉␊ |
114 | ␉uint32_t currentX, currentY;␊ |
115 | ␉uint8_t b1, b2;␊ |
116 | ␉␊ |
117 | ␉bool hasSwitched;␊ |
118 | ␉␊ |
119 | ␉bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);␊ |
120 | ␉␊ |
121 | ␉sAspect aspectRatio;␊ |
122 | ␉␊ |
123 | ␉uint8_t unlocked;␊ |
124 | } vBiosMap;␊ |
125 | ␊ |
126 | vBiosMap *map;␊ |
127 | ␊ |
128 | vBiosMap * openVbios(chipsetType type);␊ |
129 | void closeVbios (vBiosMap* map);␊ |
130 | ␊ |
131 | void unlockVbios(vBiosMap* map);␊ |
132 | void relockVbios(vBiosMap* map);␊ |
133 | ␊ |
134 | void saveVbios(vBiosMap* map);␊ |
135 | void restoreVbios(vBiosMap* map);␊ |
136 | ␊ |
137 | void saveTables(sModeTable * table);␊ |
138 | void restoreTables(vBiosMap * map, sModeTable * table);␊ |
139 | ␊ |
140 | void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,␊ |
141 | ␉␉␉␉ uint32_t *clock,␊ |
142 | ␉␉␉␉ uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,␊ |
143 | ␉␉␉␉ uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);␊ |
144 | ␊ |
145 | sModeTable * intializeTables(vBiosMap * map, int tablesCount);␊ |
146 | ␊ |
147 | void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);␊ |
148 | ␊ |
149 | #endif␊ |
150 | |