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

Archive Download this file

Revision: 1119