Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazileon/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 "edid.h"
20
21#if DEBUG
22#ifndef AUTORES_DEBUG
23#define AUTORES_DEBUG
24#endif
25#endif
26
27#ifdef AUTORES_DEBUG
28#define PRINT(a, b...) printf(a, ##b);
29#else
30#define PRINT(a, b...) verbose(a, ##b);
31#endif
32
33#define __packed __attribute__((packed))
34
35#define NEW(a) ((a *)(malloc(sizeof(a))))
36#define FREE(a) (free(a))
37
38#define VBIOS_START 0xc0000
39#define VBIOS_SIZE 0x10000
40
41#define FALSE 0
42#define TRUE 1
43
44
45bool gAutoResolution;
46
47
48typedef struct
49{
50uint8_t width;
51uint8_t height;
52} sAspect;
53
54
55typedef enum
56{
57CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G,
58CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ,
59CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X,
60CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,
61CT_GM45, CT_G41, CT_G31, CT_G45, CT_500
62} chipsetType;
63
64
65typedef enum
66{
67BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA
68} biosType;
69
70typedef struct
71{
72uint32_tclock;
73uint16_tx;
74uint16_thSyncStart;
75uint16_thSyncEnd;
76uint16_thTotal;
77uint16_ty;
78uint16_tvSyncStart;
79uint16_tvSyncEnd;
80uint16_tvTotal;
81} generic_modeline;
82
83typedef struct sModeTable_
84{
85uint8_t*pointer;
86
87uint8_tid;
88uint32_tsize;
89uint32_tmodeCount;
90
91uint8_t *backup;
92
93struct sModeTable_ *prev;
94struct sModeTable_ *next;
95} sModeTable;
96
97
98
99typedef struct
100{
101uint32_t chipsetId;
102chipsetType chipset;
103biosType bios;
104
105uint8_t* biosBackupPtr;
106uint8_t* biosPtr;
107
108sModeTable *modeTables;
109
110uint32_t currentX, currentY;
111uint8_t b1, b2;
112
113bool hasSwitched;
114
115bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);
116
117sAspect aspectRatio;
118
119uint8_t unlocked;
120} vBiosMap;
121
122vBiosMap *map;
123
124vBiosMap * openVbios(chipsetType type);
125void closeVbios (vBiosMap* map);
126
127void unlockVbios(vBiosMap* map);
128void relockVbios(vBiosMap* map);
129
130void saveVbios(vBiosMap* map);
131void restoreVbios(vBiosMap* map);
132
133void saveTables(sModeTable * table);
134void restoreTables(vBiosMap * map, sModeTable * table);
135
136void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,
137 uint32_t *clock,
138 uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,
139 uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);
140
141sModeTable * intializeTables(vBiosMap * map, int tablesCount);
142
143void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);
144
145#endif
146

Archive Download this file

Revision: 296