Chameleon

Chameleon Svn Source Tree

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

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

Archive Download this file

Revision: 840