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 | #include "libsa.h"␊ |
20 | #include "saio_internal.h"␊ |
21 | #include "edid.h"␊ |
22 | ␊ |
23 | //#define AUTORES_DEBUG 1 // enable AutoResolution debug - review!␊ |
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␉␉␉(Reviewing...)␊ |
46 | //#define true 1␊ |
47 | ␊ |
48 | ␊ |
49 | bool gAutoResolution;␊ |
50 | UInt32 paramsAR[4]; //Azi: testing autoresolution␊ |
51 | ␊ |
52 | ␊ |
53 | typedef struct␊ |
54 | {␊ |
55 | ␉uint8_t width;␊ |
56 | ␉uint8_t height;␊ |
57 | } sAspect;␊ |
58 | ␊ |
59 | ␊ |
60 | typedef enum␊ |
61 | {␊ |
62 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
63 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
64 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
65 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
66 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
67 | } chipsetType;␊ |
68 | ␊ |
69 | ␊ |
70 | typedef enum␊ |
71 | {␊ |
72 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
73 | } biosType;␊ |
74 | ␊ |
75 | typedef struct␊ |
76 | {␊ |
77 | ␉uint32_t␉clock;␊ |
78 | ␉uint16_t␉x;␊ |
79 | ␉uint16_t␉hSyncStart;␊ |
80 | ␉uint16_t␉hSyncEnd;␊ |
81 | ␉uint16_t␉hTotal;␊ |
82 | ␉uint16_t␉y;␊ |
83 | ␉uint16_t␉vSyncStart;␊ |
84 | ␉uint16_t␉vSyncEnd;␊ |
85 | ␉uint16_t␉vTotal;␊ |
86 | } generic_modeline;␊ |
87 | ␊ |
88 | typedef struct sModeTable_␊ |
89 | {␊ |
90 | ␉uint8_t␉*␉pointer;␊ |
91 | ␉␊ |
92 | ␉uint8_t␉␉id;␊ |
93 | ␉uint32_t␉size;␊ |
94 | ␉uint32_t␉modeCount;␊ |
95 | ␉␊ |
96 | ␉uint8_t *␉backup;␊ |
97 | ␉␊ |
98 | ␉struct sModeTable_ *prev;␊ |
99 | ␉struct sModeTable_ *next;␊ |
100 | } sModeTable;␊ |
101 | ␉␊ |
102 | ␊ |
103 | ␊ |
104 | typedef struct␊ |
105 | {␊ |
106 | ␉uint32_t chipsetId;␊ |
107 | ␉chipsetType chipset;␊ |
108 | ␉biosType bios;␊ |
109 | ␉␊ |
110 | ␉uint8_t* biosBackupPtr;␊ |
111 | ␉uint8_t* biosPtr;␊ |
112 | ␉␊ |
113 | ␉sModeTable *modeTables;␊ |
114 | ␉␊ |
115 | ␉uint32_t currentX, currentY;␊ |
116 | ␉uint8_t b1, b2;␊ |
117 | ␉␊ |
118 | //␉bool hasSwitched;␊ |
119 | ␉␊ |
120 | ␉bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);␊ |
121 | ␉␊ |
122 | ␉sAspect aspectRatio;␊ |
123 | ␉␊ |
124 | ␉uint8_t unlocked;␊ |
125 | } vBiosMap;␊ |
126 | ␊ |
127 | vBiosMap *map;␊ |
128 | ␊ |
129 | vBiosMap * openVbios(chipsetType type);␊ |
130 | void closeVbios (vBiosMap* map);␊ |
131 | ␊ |
132 | void unlockVbios(vBiosMap* map);␊ |
133 | void relockVbios(vBiosMap* map);␊ |
134 | ␊ |
135 | void saveVbios(vBiosMap* map);␊ |
136 | void restoreVbios(vBiosMap* map);␊ |
137 | ␊ |
138 | void saveTables(sModeTable * table);␊ |
139 | void restoreTables(vBiosMap * map, sModeTable * table);␊ |
140 | ␊ |
141 | void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,␊ |
142 | ␉␉␉␉ uint32_t *clock,␊ |
143 | ␉␉␉␉ uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,␊ |
144 | ␉␉␉␉ uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);␊ |
145 | ␊ |
146 | sModeTable * intializeTables(vBiosMap * map, int tablesCount);␊ |
147 | ␊ |
148 | void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);␊ |
149 | ␊ |
150 | //void patchRes();␊ |
151 | //void reloadRes();␊ |
152 | ␊ |
153 | #endif␊ |
154 | |