Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/i386/libsaio/autoresolution.h

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
49bool gAutoResolution;
50UInt32 paramsAR[4]; //Azi: testing autoresolution
51
52
53typedef struct
54{
55uint8_t width;
56uint8_t height;
57} sAspect;
58
59
60typedef enum
61{
62CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G,
63CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ,
64CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X,
65CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,
66CT_GM45, CT_G41, CT_G31, CT_G45, CT_500
67} chipsetType;
68
69
70typedef enum
71{
72BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA
73} biosType;
74
75typedef struct
76{
77uint32_tclock;
78uint16_tx;
79uint16_thSyncStart;
80uint16_thSyncEnd;
81uint16_thTotal;
82uint16_ty;
83uint16_tvSyncStart;
84uint16_tvSyncEnd;
85uint16_tvTotal;
86} generic_modeline;
87
88typedef struct sModeTable_
89{
90uint8_t*pointer;
91
92uint8_tid;
93uint32_tsize;
94uint32_tmodeCount;
95
96uint8_t *backup;
97
98struct sModeTable_ *prev;
99struct sModeTable_ *next;
100} sModeTable;
101
102
103
104typedef struct
105{
106uint32_t chipsetId;
107chipsetType chipset;
108biosType bios;
109
110uint8_t* biosBackupPtr;
111uint8_t* biosPtr;
112
113sModeTable *modeTables;
114
115uint32_t currentX, currentY;
116uint8_t b1, b2;
117
118//bool hasSwitched;
119
120bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);
121
122sAspect aspectRatio;
123
124uint8_t unlocked;
125} vBiosMap;
126
127vBiosMap *map;
128
129vBiosMap * openVbios(chipsetType type);
130void closeVbios (vBiosMap* map);
131
132void unlockVbios(vBiosMap* map);
133void relockVbios(vBiosMap* map);
134
135void saveVbios(vBiosMap* map);
136void restoreVbios(vBiosMap* map);
137
138void saveTables(sModeTable * table);
139void restoreTables(vBiosMap * map, sModeTable * table);
140
141void 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
146sModeTable * intializeTables(vBiosMap * map, int tablesCount);
147
148void 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

Archive Download this file

Revision: 602