Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/Resolution/915resolution.c

1/*
2 * resolution.h
3 *
4 *NOTE: I don't beleive this code is production ready / should be in trunk
5 * Atleast, not in it's current state.
6 *
7 * Created by Evan Lojewski on 3/4/10.
8 * Copyright 2009. All rights reserved.
9 *
10 */
11#ifndef _RESOLUTION_H_
12#define _RESOLUTION_H_
13
14#include "libsaio.h"
15#include "edid.h"
16#include "915resolution.h"
17
18
19void patchVideoBios()
20{
21UInt32 x = 0, y = 0, bp = 0;
22
23getResolution(&x, &y, &bp);
24
25
26if (x != 0 &&
27y != 0 &&
28bp != 0)
29{
30vbios_map * map;
31
32map = open_vbios(CT_UNKWN);
33if(map)
34{
35unlock_vbios(map);
36
37set_mode(map, x, y, bp, 0, 0);
38
39relock_vbios(map);
40
41close_vbios(map);
42}
43}
44
45}
46
47
48/* Copied from 915 resolution created by steve tomljenovic
49 *
50 * This code is based on the techniques used in :
51 *
52 * - 855patch. Many thanks to Christian Zietz (czietz gmx net)
53 * for demonstrating how to shadow the VBIOS into system RAM
54 * and then modify it.
55 *
56 * - 1280patch by Andrew Tipton (andrewtipton null li).
57 *
58 * - 855resolution by Alain Poirier
59 *
60 * This source code is into the public domain.
61 */
62
63/**
64 **
65 **/
66
67#define CONFIG_MECH_ONE_ADDR0xCF8
68#define CONFIG_MECH_ONE_DATA0xCFC
69
70int freqs[] = { 60, 75, 85 };
71
72UInt32 get_chipset_id(void)
73{
74outl(CONFIG_MECH_ONE_ADDR, 0x80000000);
75return inl(CONFIG_MECH_ONE_DATA);
76}
77
78chipset_type get_chipset(UInt32 id)
79{
80chipset_type type;
81
82switch (id) {
83case 0x35758086:
84type = CT_830;
85break;
86
87case 0x25608086:
88type = CT_845G;
89break;
90
91case 0x35808086:
92type = CT_855GM;
93break;
94
95case 0x25708086:
96type = CT_865G;
97break;
98
99case 0x25808086:
100type = CT_915G;
101break;
102
103case 0x25908086:
104type = CT_915GM;
105break;
106
107case 0x27708086:
108type = CT_945G;
109break;
110
111case 0x27a08086:
112type = CT_945GM;
113break;
114
115case 0x27ac8086:
116type = CT_945GME;
117break;
118
119case 0x29708086:
120type = CT_946GZ;
121break;
122
123case 0x27748086:
124type = CT_955X;
125break;
126
127case 0x277c8086:
128type = CT_975X;
129break;
130
131case 0x29a08086:
132type = CT_G965;
133break;
134
135case 0x29908086:
136type = CT_Q965;
137break;
138
139case 0x81008086:
140type = CT_500;
141break;
142
143case 0x2e108086:
144case 0X2e908086:
145type = CT_B43;
146break;
147
148case 0x2e208086:
149type = CT_P45;
150break;
151
152case 0x2e308086:
153type = CT_G41;
154break;
155
156case 0x29c08086:
157type = CT_G31;
158break;
159
160case 0x29208086:
161type = CT_G45;
162break;
163
164case 0xA0108086:
165type = CT_3150;
166break;
167
168case 0x2a008086:
169type = CT_965GM;
170break;
171
172case 0x29e08086:
173type = CT_X48;
174break;
175
176case 0x2a408086:
177type = CT_GM45;
178break;
179
180
181default:
182if((id & 0x0000FFFF) == 0x00008086) // Intel chipset
183{
184//printf("Unknown chipset 0x%llX, please email id to meklort@gmail.com", id);
185//getc();
186type = CT_UNKWN_INTEL;
187
188}
189type = CT_UNKWN;
190break;
191}
192return type;
193}
194
195vbios_resolution_type1 * map_type1_resolution(vbios_map * map, UInt16 res)
196{
197vbios_resolution_type1 * ptr = ((vbios_resolution_type1*)(map->bios_ptr + res));
198return ptr;
199}
200
201vbios_resolution_type2 * map_type2_resolution(vbios_map * map, UInt16 res)
202{
203vbios_resolution_type2 * ptr = ((vbios_resolution_type2*)(map->bios_ptr + res));
204return ptr;
205}
206
207vbios_resolution_type3 * map_type3_resolution(vbios_map * map, UInt16 res)
208{
209vbios_resolution_type3 * ptr = ((vbios_resolution_type3*)(map->bios_ptr + res));
210return ptr;
211}
212
213char detect_bios_type(vbios_map * map, char modeline, int entry_size)
214{
215UInt32 i;
216UInt16 r1, r2;
217
218r1 = r2 = 32000;
219
220for (i=0; i < map->mode_table_size; i++)
221{
222if (map->mode_table[i].resolution <= r1)
223{
224r1 = map->mode_table[i].resolution;
225}
226else
227{
228if (map->mode_table[i].resolution <= r2)
229{
230r2 = map->mode_table[i].resolution;
231}
232}
233
234/*printf("r1 = %d r2 = %d\n", r1, r2);*/
235}
236
237return (r2-r1-6) % entry_size == 0;
238}
239
240void close_vbios(vbios_map * map);
241
242char detect_ati_bios_type(vbios_map * map)
243{
244return map->mode_table_size % sizeof(ATOM_MODE_TIMING) == 0;
245}
246
247
248vbios_map * open_vbios(chipset_type forced_chipset)
249{
250UInt32 z;
251vbios_map * map = malloc(sizeof(vbios_map));
252for(z=0; z<sizeof(vbios_map); z++) ((char*)map)[z]=0;
253/*
254 * Determine chipset
255 */
256
257if (forced_chipset == CT_UNKWN)
258{
259map->chipset_id = get_chipset_id();
260map->chipset = get_chipset(map->chipset_id);
261}
262else if (forced_chipset != CT_UNKWN)
263{
264map->chipset = forced_chipset;
265}
266
267
268if (map->chipset == CT_UNKWN)
269{
270//verbose("Unknown chipset type.\n");
271//verbose("915resolution only works with Intel 800/900 series graphic chipsets.\n");
272//verbose("Chipset Id: %x\n", map->chipset_id);
273close_vbios(map);
274return 0;
275}
276
277
278/*
279 * Map the video bios to memory
280 */
281map->bios_ptr=(char*)VBIOS_START;
282
283/*
284 * check if we have ATI Radeon
285 */
286map->ati_tables.base = map->bios_ptr;
287map->ati_tables.AtomRomHeader = (ATOM_ROM_HEADER *) (map->bios_ptr + *(unsigned short *) (map->bios_ptr + OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER));
288if (strcmp ((char *) map->ati_tables.AtomRomHeader->uaFirmWareSignature, "ATOM") == 0)
289{
290// ATI Radeon Card
291map->bios = BT_ATI_1;
292
293map->ati_tables.MasterDataTables = (unsigned short *) &((ATOM_MASTER_DATA_TABLE *) (map->bios_ptr + map->ati_tables.AtomRomHeader->usMasterDataTableOffset))->ListOfDataTables;
294unsigned short std_vesa_offset = (unsigned short) ((ATOM_MASTER_LIST_OF_DATA_TABLES *)map->ati_tables.MasterDataTables)->StandardVESA_Timing;
295ATOM_STANDARD_VESA_TIMING * std_vesa = (ATOM_STANDARD_VESA_TIMING *) (map->bios_ptr + std_vesa_offset);
296
297map->ati_mode_table = (char *) &std_vesa->aModeTimings;
298if (map->ati_mode_table == 0)
299{
300printf("Unable to locate the mode table.\n");
301printf("Please run the program 'dump_bios' as root and\n");
302printf("email the file 'vbios.dmp' to stomljen@yahoo.com.\n");
303printf("Chipset: %d\n", map->chipset);
304close_vbios(map);
305pause();
306return 0;
307}
308map->mode_table_size = std_vesa->sHeader.usStructureSize - sizeof(ATOM_COMMON_TABLE_HEADER);
309
310if (!detect_ati_bios_type(map)) map->bios = BT_ATI_2;
311
312}
313else {
314
315/*
316 * check if we have NVIDIA
317 */
318
319int i = 0;
320while (i < 512)
321{ // we don't need to look through the whole bios, just the firs 512 bytes
322if ((map->bios_ptr[i] == 'N')
323&& (map->bios_ptr[i+1] == 'V')
324&& (map->bios_ptr[i+2] == 'I')
325&& (map->bios_ptr[i+3] == 'D'))
326{
327map->bios = BT_NVDA;
328unsigned short nv_data_table_offset = 0;
329unsigned short * nv_data_table;
330NV_VESA_TABLE * std_vesa;
331
332int i = 0;
333
334while (i < 0x300)
335{ //We don't need to look for the table in the whole bios, the 768 first bytes only
336if ((map->bios_ptr[i] == 0x44)
337&& (map->bios_ptr[i+1] == 0x01)
338&& (map->bios_ptr[i+2] == 0x04)
339&& (map->bios_ptr[i+3] == 0x00))
340{
341nv_data_table_offset = (unsigned short) (map->bios_ptr[i+4] | (map->bios_ptr[i+5] << 8));
342break;
343}
344i++;
345}
346
347nv_data_table = (unsigned short *) (map->bios_ptr + (nv_data_table_offset + OFFSET_TO_VESA_TABLE_INDEX));
348std_vesa = (NV_VESA_TABLE *) (map->bios_ptr + *nv_data_table);
349
350map->nv_mode_table = (char *) std_vesa->sModelines;
351if (map->nv_mode_table == 0)
352{
353printf("Unable to locate the mode table.\n");
354printf("Please run the program 'dump_bios' as root and\n");
355printf("email the file 'vbios.dmp' to stomljen@yahoo.com.\n");
356printf("Chipset: %s\n", map->chipset);
357close_vbios(map);
358pause();
359return 0;
360}
361map->mode_table_size = std_vesa->sHeader.usTable_Size;
362
363break;
364}
365i++;
366}
367}
368
369
370/*
371 * check if we have Intel
372 */
373
374/*if (map->chipset == CT_UNKWN && memmem(map->bios_ptr, VBIOS_SIZE, INTEL_SIGNATURE, strlen(INTEL_SIGNATURE))) {
375 printf( "Intel chipset detected. However, 915resolution was unable to determine the chipset type.\n");
376
377 printf("Chipset Id: %x\n", map->chipset_id);
378
379 printf("Please report this problem to stomljen@yahoo.com\n");
380
381 close_vbios(map);
382 return 0;
383 }*/
384
385/*
386 * check for others
387 */
388
389
390
391/*
392 * Figure out where the mode table is
393 */
394if ((map->bios != BT_ATI_1) && (map->bios != BT_NVDA))
395{
396char* p = map->bios_ptr + 16;
397char* limit = map->bios_ptr + VBIOS_SIZE - (3 * sizeof(vbios_mode));
398
399while (p < limit && map->mode_table == 0)
400{
401vbios_mode * mode_ptr = (vbios_mode *) p;
402
403if (((mode_ptr[0].mode & 0xf0) == 0x30) && ((mode_ptr[1].mode & 0xf0) == 0x30) &&
404((mode_ptr[2].mode & 0xf0) == 0x30) && ((mode_ptr[3].mode & 0xf0) == 0x30))
405{
406map->mode_table = mode_ptr;
407}
408
409p++;
410}
411
412if (map->mode_table == 0)
413{
414close_vbios(map);
415return 0;
416}
417}
418
419
420/*
421 * Determine size of mode table
422 */
423if ((map->bios != BT_ATI_1) && (map->bios != BT_ATI_2) && (map->bios != BT_NVDA))
424{
425vbios_mode * mode_ptr = map->mode_table;
426
427while (mode_ptr->mode != 0xff)
428{
429map->mode_table_size++;
430mode_ptr++;
431}
432}
433
434/*
435 * Figure out what type of bios we have
436 * order of detection is important
437 */
438if ((map->bios != BT_ATI_1) && (map->bios != BT_ATI_2) && (map->bios != BT_NVDA))
439{
440if (detect_bios_type(map, TRUE, sizeof(vbios_modeline_type3)))
441{
442map->bios = BT_3;
443}
444else if (detect_bios_type(map, TRUE, sizeof(vbios_modeline_type2)))
445{
446map->bios = BT_2;
447}
448else if (detect_bios_type(map, FALSE, sizeof(vbios_resolution_type1)))
449{
450map->bios = BT_1;
451}
452else {
453return 0;
454}
455}
456
457return map;
458}
459
460void close_vbios(vbios_map * map)
461{
462free(map);
463}
464
465void unlock_vbios(vbios_map * map)
466{
467
468map->unlocked = TRUE;
469
470switch (map->chipset) {
471case CT_UNKWN:
472break;
473case CT_830:
474case CT_855GM:
475outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
476map->b1 = inb(CONFIG_MECH_ONE_DATA + 2);
477
478outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
479outb(CONFIG_MECH_ONE_DATA + 2, 0x33);
480break;
481case CT_845G:
482case CT_865G:
483case CT_915G:
484case CT_915GM:
485case CT_945G:
486case CT_945GM:
487case CT_945GME:
488case CT_946GZ:
489case CT_G965:
490case CT_Q965:
491case CT_965GM:
492case CT_975X:
493case CT_P35:
494case CT_955X:
495case CT_X48:
496case CT_B43:
497case CT_Q45:
498case CT_P45:
499case CT_GM45:
500case CT_G45:
501case CT_G41:
502case CT_G31:
503case CT_500:
504case CT_3150:
505case CT_UNKWN_INTEL:// Assume newer intel chipset is the same as before
506outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
507map->b1 = inb(CONFIG_MECH_ONE_DATA + 1);
508map->b2 = inb(CONFIG_MECH_ONE_DATA + 2);
509outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
510outb(CONFIG_MECH_ONE_DATA + 1, 0x33);
511outb(CONFIG_MECH_ONE_DATA + 2, 0x33);
512break;
513}
514
515#if DEBUG
516{
517UInt32 t = inl(CONFIG_MECH_ONE_DATA);
518verbose("unlock PAM: (0x%08x)\n", t);
519}
520#endif
521}
522
523void relock_vbios(vbios_map * map)
524{
525
526map->unlocked = FALSE;
527
528switch (map->chipset)
529{
530case CT_UNKWN:
531break;
532case CT_830:
533case CT_855GM:
534outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
535outb(CONFIG_MECH_ONE_DATA + 2, map->b1);
536break;
537case CT_845G:
538case CT_865G:
539case CT_915G:
540case CT_915GM:
541case CT_945G:
542case CT_945GM:
543case CT_945GME:
544case CT_946GZ:
545case CT_G965:
546case CT_955X:
547case CT_G45:
548case CT_Q965:
549case CT_965GM:
550case CT_975X:
551case CT_P35:
552case CT_X48:
553case CT_B43:
554case CT_Q45:
555case CT_P45:
556case CT_GM45:
557case CT_G41:
558case CT_G31:
559case CT_500:
560case CT_3150:
561case CT_UNKWN_INTEL:
562outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
563outb(CONFIG_MECH_ONE_DATA + 1, map->b1);
564outb(CONFIG_MECH_ONE_DATA + 2, map->b2);
565break;
566}
567
568#if DEBUG
569{
570 UInt32 t = inl(CONFIG_MECH_ONE_DATA);
571verbose("relock PAM: (0x%08x)\n", t);
572}
573#endif
574}
575
576
577int getMode(edid_mode *mode)
578{
579char* edidInfo = readEDID();
580
581if(!edidInfo) return 1;
582
583mode->pixel_clock = (edidInfo[55] << 8) | edidInfo[54];
584mode->h_active = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4);
585mode->h_blanking = ((edidInfo[58] & 0x0F) << 8) | edidInfo[57];
586mode->v_active = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4);
587mode->v_blanking = ((edidInfo[61] & 0x0F) << 8) | edidInfo[60];
588mode->h_sync_offset = ((edidInfo[65] & 0xC0) >> 2) | edidInfo[62];
589mode->h_sync_width = (edidInfo[65] & 0x30) | edidInfo[63];
590mode->v_sync_offset = (edidInfo[65] & 0x0C) | ((edidInfo[64] & 0x0C) >> 2);
591mode->v_sync_width = ((edidInfo[65] & 0x3) << 2) | (edidInfo[64] & 0x03);
592
593
594free( edidInfo );
595
596if(!mode->h_active) return 1;
597
598return 0;
599
600}
601
602
603static void gtf_timings(UInt32 x, UInt32 y, UInt32 freq,
604unsigned long *clock,
605UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,
606UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank)
607{
608UInt32 hbl, vbl, vfreq;
609
610vbl = y + (y+1)/(20000.0/(11*freq) - 1) + 1.5;
611vfreq = vbl * freq;
612hbl = 16 * (int)(x * (30.0 - 300000.0 / vfreq) /
613 + (70.0 + 300000.0 / vfreq) / 16.0 + 0.5);
614
615*vsyncstart = y;
616*vsyncend = y + 3;
617*vblank = vbl - 1;
618*hsyncstart = x + hbl / 2 - (x + hbl + 50) / 100 * 8 - 1;
619*hsyncend = x + hbl / 2 - 1;
620*hblank = x + hbl - 1;
621*clock = (x + hbl) * vfreq / 1000;
622}
623
624void set_mode(vbios_map * map, /*UInt32 mode,*/ UInt32 x, UInt32 y, UInt32 bp, UInt32 htotal, UInt32 vtotal) {
625UInt32 xprev, yprev;
626UInt32 i = 0, j;
627// patch first available mode
628
629//for (i=0; i < map->mode_table_size; i++) {
630//if (map->mode_table[0].mode == mode) {
631switch(map->bios) {
632case BT_1:
633{
634vbios_resolution_type1 * res = map_type1_resolution(map, map->mode_table[i].resolution);
635
636if (bp) {
637map->mode_table[i].bits_per_pixel = bp;
638}
639
640res->x2 = (htotal?(((htotal-x) >> 8) & 0x0f) : (res->x2 & 0x0f)) | ((x >> 4) & 0xf0);
641res->x1 = (x & 0xff);
642
643res->y2 = (vtotal?(((vtotal-y) >> 8) & 0x0f) : (res->y2 & 0x0f)) | ((y >> 4) & 0xf0);
644res->y1 = (y & 0xff);
645if (htotal)
646res->x_total = ((htotal-x) & 0xff);
647
648if (vtotal)
649res->y_total = ((vtotal-y) & 0xff);
650
651break;
652}
653case BT_2:
654{
655vbios_resolution_type2 * res = map_type2_resolution(map, map->mode_table[i].resolution);
656
657res->xchars = x / 8;
658res->ychars = y / 16 - 1;
659xprev = res->modelines[0].x1;
660yprev = res->modelines[0].y1;
661
662for(j=0; j < 3; j++) {
663vbios_modeline_type2 * modeline = &res->modelines[j];
664
665if (modeline->x1 == xprev && modeline->y1 == yprev) {
666modeline->x1 = modeline->x2 = x-1;
667modeline->y1 = modeline->y2 = y-1;
668
669gtf_timings(x, y, freqs[j], &modeline->clock,
670&modeline->hsyncstart, &modeline->hsyncend,
671&modeline->hblank, &modeline->vsyncstart,
672&modeline->vsyncend, &modeline->vblank);
673
674if (htotal)
675modeline->htotal = htotal;
676else
677modeline->htotal = modeline->hblank;
678
679if (vtotal)
680modeline->vtotal = vtotal;
681else
682modeline->vtotal = modeline->vblank;
683}
684}
685break;
686}
687case BT_3:
688{
689vbios_resolution_type3 * res = map_type3_resolution(map, map->mode_table[i].resolution);
690
691xprev = res->modelines[0].x1;
692yprev = res->modelines[0].y1;
693
694for (j=0; j < 3; j++) {
695vbios_modeline_type3 * modeline = &res->modelines[j];
696
697if (modeline->x1 == xprev && modeline->y1 == yprev) {
698modeline->x1 = modeline->x2 = x-1;
699modeline->y1 = modeline->y2 = y-1;
700
701gtf_timings(x, y, freqs[j], &modeline->clock,
702&modeline->hsyncstart, &modeline->hsyncend,
703&modeline->hblank, &modeline->vsyncstart,
704&modeline->vsyncend, &modeline->vblank);
705if (htotal)
706modeline->htotal = htotal;
707else
708modeline->htotal = modeline->hblank;
709if (vtotal)
710modeline->vtotal = vtotal;
711else
712modeline->vtotal = modeline->vblank;
713
714modeline->timing_h = y-1;
715modeline->timing_v = x-1;
716}
717}
718break;
719}
720case BT_ATI_1:
721{
722edid_mode mode;
723
724ATOM_MODE_TIMING *mode_timing = (ATOM_MODE_TIMING *) map->ati_mode_table;
725
726//if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {
727if (!getMode(&mode)) {
728mode_timing->usCRTC_H_Total = mode.h_active + mode.h_blanking;
729mode_timing->usCRTC_H_Disp = mode.h_active;
730mode_timing->usCRTC_H_SyncStart = mode.h_active + mode.h_sync_offset;
731mode_timing->usCRTC_H_SyncWidth = mode.h_sync_width;
732
733mode_timing->usCRTC_V_Total = mode.v_active + mode.v_blanking;
734mode_timing->usCRTC_V_Disp = mode.v_active;
735mode_timing->usCRTC_V_SyncStart = mode.v_active + mode.v_sync_offset;
736mode_timing->usCRTC_V_SyncWidth = mode.v_sync_width;
737
738mode_timing->usPixelClock = mode.pixel_clock;
739}
740/*else
741{
742vbios_modeline_type2 modeline;
743
744cvt_timings(x, y, freqs[0], &modeline.clock,
745&modeline.hsyncstart, &modeline.hsyncend,
746&modeline.hblank, &modeline.vsyncstart,
747&modeline.vsyncend, &modeline.vblank, 0);
748
749mode_timing->usCRTC_H_Total = x + modeline.hblank;
750mode_timing->usCRTC_H_Disp = x;
751mode_timing->usCRTC_H_SyncStart = modeline.hsyncstart;
752mode_timing->usCRTC_H_SyncWidth = modeline.hsyncend - modeline.hsyncstart;
753
754mode_timing->usCRTC_V_Total = y + modeline.vblank;
755mode_timing->usCRTC_V_Disp = y;
756mode_timing->usCRTC_V_SyncStart = modeline.vsyncstart;
757mode_timing->usCRTC_V_SyncWidth = modeline.vsyncend - modeline.vsyncstart;
758
759mode_timing->usPixelClock = modeline.clock;
760 }*/
761
762break;
763}
764case BT_ATI_2:
765{
766edid_mode mode;
767
768ATOM_DTD_FORMAT *mode_timing = (ATOM_DTD_FORMAT *) map->ati_mode_table;
769
770/*if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {*/
771if (!getMode(&mode)) {
772mode_timing->usHBlanking_Time = mode.h_blanking;
773mode_timing->usHActive = mode.h_active;
774mode_timing->usHSyncOffset = mode.h_sync_offset;
775mode_timing->usHSyncWidth = mode.h_sync_width;
776
777mode_timing->usVBlanking_Time = mode.v_blanking;
778mode_timing->usVActive = mode.v_active;
779mode_timing->usVSyncOffset = mode.v_sync_offset;
780mode_timing->usVSyncWidth = mode.v_sync_width;
781
782mode_timing->usPixClk = mode.pixel_clock;
783}
784/*else
785{
786vbios_modeline_type2 modeline;
787
788cvt_timings(x, y, freqs[0], &modeline.clock,
789&modeline.hsyncstart, &modeline.hsyncend,
790&modeline.hblank, &modeline.vsyncstart,
791&modeline.vsyncend, &modeline.vblank, 0);
792
793mode_timing->usHBlanking_Time = modeline.hblank;
794 +mode_timing->usHActive = x;
795 +mode_timing->usHSyncOffset = modeline.hsyncstart - x;
796 +mode_timing->usHSyncWidth = modeline.hsyncend - modeline.hsyncstart;
797 +
798 +mode_timing->usVBlanking_Time = modeline.vblank;
799 +mode_timing->usVActive = y;
800 +mode_timing->usVSyncOffset = modeline.vsyncstart - y;
801 +mode_timing->usVSyncWidth = modeline.hsyncend - modeline.hsyncstart;
802 +
803 +mode_timing->usPixClk = modeline.clock;
804 +}*/
805
806
807break;
808}
809case BT_NVDA:
810{
811edid_mode mode;
812
813NV_MODELINE *mode_timing = (NV_MODELINE *) map->nv_mode_table;
814
815/*if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {*/
816if (!getMode(&mode)) {
817mode_timing[i].usH_Total = mode.h_active + mode.h_blanking;
818mode_timing[i].usH_Active = mode.h_active;
819mode_timing[i].usH_SyncStart = mode.h_active + mode.h_sync_offset;
820mode_timing[i].usH_SyncEnd = mode.h_active + mode.h_sync_offset + mode.h_sync_width;
821
822mode_timing[i].usV_Total = mode.v_active + mode.v_blanking;
823mode_timing[i].usV_Active = mode.v_active;
824mode_timing[i].usV_SyncStart = mode.v_active + mode.v_sync_offset;
825mode_timing[i].usV_SyncEnd = mode.v_active + mode.v_sync_offset + mode.v_sync_width;
826
827mode_timing[i].usPixel_Clock = mode.pixel_clock;
828}
829/*else
830 {
831 vbios_modeline_type2 modeline;
832
833 cvt_timings(x, y, freqs[0], &modeline.clock,
834 &modeline.hsyncstart, &modeline.hsyncend,
835 &modeline.hblank, &modeline.vsyncstart,
836 &modeline.vsyncend, &modeline.vblank, 0);
837
838 mode_timing[i].usH_Total = x + modeline.hblank - 1;
839 mode_timing[i].usH_Active = x;
840 mode_timing[i].usH_SyncStart = modeline.hsyncstart - 1;
841 mode_timing[i].usH_SyncEnd = modeline.hsyncend - 1;
842
843 mode_timing[i].usV_Total = y + modeline.vblank - 1;
844 mode_timing[i].usV_Active = y;
845 mode_timing[i].usV_SyncStart = modeline.vsyncstart - 1;
846 mode_timing[i].usV_SyncEnd = modeline.vsyncend - 1;
847
848 mode_timing[i].usPixel_Clock = modeline.clock;
849 }*/
850break;
851}
852case BT_UNKWN:
853{
854break;
855}
856}
857//}
858//}
859}
860
861#endif // _RESOLUTION_H_

Archive Download this file

Revision: 789