Chameleon

Chameleon Svn Source Tree

Root/branches/autoResolution/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#define NEW(a) ((a *)(malloc(sizeof(a))))
22#define FREE(a) (free(a))
23
24#ifdef AUTORES_DEBUG
25#define PRINT(a, b...) printf(a, ##b);
26#else
27#define PRINT(a, b...) verbose(a, ##b);
28#endif
29
30#define VBIOS_START 0xc0000
31#define VBIOS_SIZE 0x10000
32
33#define FALSE 0
34#define TRUE 1
35
36typedef struct {
37unsigned char width;
38unsigned char height;
39} s_aspect;
40
41
42typedef enum {
43CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G,
44CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ,
45CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X,
46CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,
47CT_GM45, CT_G41, CT_G31, CT_G45, CT_500
48} chipset_type;
49
50
51typedef enum {
52BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA
53} bios_type;
54
55typedef struct {
56UInt32clock;
57UInt16x;
58UInt16hsyncstart;
59UInt16hsyncend;
60UInt16htotal;
61UInt16y;
62UInt16vsyncstart;
63UInt16vsyncend;
64UInt16vtotal;
65} generic_modeline;
66
67
68typedef struct {
69UInt32 chipset_id;
70chipset_type chipset;
71bios_type bios;
72
73UInt32 bios_fd;
74unsigned char* bios_backup_ptr;
75unsigned char* bios_ptr;
76
77char * mode_table;
78char * nv_mode_table_2;
79
80UInt32 mode_table_size;
81UInt32 nv_mode_table_2_size;
82
83UInt32 modeline_num;
84UInt32 nv_modeline_num_2;
85
86UInt8 b1, b2;
87
88s_aspect aspect_ratio;
89
90UInt8 unlocked;
91} vbios_map;
92
93vbios_map * open_vbios(chipset_type);
94void close_vbios (vbios_map*);
95void unlock_vbios(vbios_map*);
96void relock_vbios(vbios_map*);
97void save_vbios(vbios_map*);
98void restore_vbios(vbios_map*);
99
100void gtf_timings(UInt32 x, UInt32 y, UInt32 freq,
101 unsigned long *clock,
102 UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,
103 UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank);
104
105void cvt_timings(UInt32 x, UInt32 y, UInt32 freq,
106 unsigned long *clock,
107 UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,
108 UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank, bool reduced);
109
110void patch_vbios(vbios_map*, UInt32, UInt32, UInt32, UInt32, UInt32);
111
112#endif
113

Archive Download this file

Revision: 137