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

Archive Download this file

Revision: 527