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));
250 if (!map) {
251 return 0;
252
253 }
254for(z=0; z<sizeof(vbios_map); z++) ((char*)map)[z]=0;
255/*
256 * Determine chipset
257 */
258
259if (forced_chipset == CT_UNKWN)
260{
261map->chipset_id = get_chipset_id();
262map->chipset = get_chipset(map->chipset_id);
263}
264else if (forced_chipset != CT_UNKWN)
265{
266map->chipset = forced_chipset;
267}
268
269
270if (map->chipset == CT_UNKWN)
271{
272//verbose("Unknown chipset type.\n");
273//verbose("915resolution only works with Intel 800/900 series graphic chipsets.\n");
274//verbose("Chipset Id: %x\n", map->chipset_id);
275close_vbios(map);
276return 0;
277}
278
279
280/*
281 * Map the video bios to memory
282 */
283map->bios_ptr=(char*)VBIOS_START;
284
285/*
286 * check if we have ATI Radeon
287 */
288map->ati_tables.base = map->bios_ptr;
289map->ati_tables.AtomRomHeader = (ATOM_ROM_HEADER *) (map->bios_ptr + *(unsigned short *) (map->bios_ptr + OFFSET_TO_POINTER_TO_ATOM_ROM_HEADER));
290if (strncmp ((char *) map->ati_tables.AtomRomHeader->uaFirmWareSignature, "ATOM", sizeof("ATOM")) == 0)
291{
292// ATI Radeon Card
293map->bios = BT_ATI_1;
294
295map->ati_tables.MasterDataTables = (unsigned short *) &((ATOM_MASTER_DATA_TABLE *) (map->bios_ptr + map->ati_tables.AtomRomHeader->usMasterDataTableOffset))->ListOfDataTables;
296unsigned short std_vesa_offset = (unsigned short) ((ATOM_MASTER_LIST_OF_DATA_TABLES *)map->ati_tables.MasterDataTables)->StandardVESA_Timing;
297ATOM_STANDARD_VESA_TIMING * std_vesa = (ATOM_STANDARD_VESA_TIMING *) (map->bios_ptr + std_vesa_offset);
298
299map->ati_mode_table = (char *) &std_vesa->aModeTimings;
300if (map->ati_mode_table == 0)
301{
302printf("Unable to locate the mode table.\n");
303printf("Please run the program 'dump_bios' as root and\n");
304printf("email the file 'vbios.dmp' to stomljen@yahoo.com.\n");
305printf("Chipset: %d\n", map->chipset);
306close_vbios(map);
307pause();
308return 0;
309}
310map->mode_table_size = std_vesa->sHeader.usStructureSize - sizeof(ATOM_COMMON_TABLE_HEADER);
311
312if (!detect_ati_bios_type(map)) map->bios = BT_ATI_2;
313
314}
315else {
316
317/*
318 * check if we have NVIDIA
319 */
320
321int i = 0;
322while (i < 512)
323{ // we don't need to look through the whole bios, just the firs 512 bytes
324if ((map->bios_ptr[i] == 'N')
325&& (map->bios_ptr[i+1] == 'V')
326&& (map->bios_ptr[i+2] == 'I')
327&& (map->bios_ptr[i+3] == 'D'))
328{
329map->bios = BT_NVDA;
330unsigned short nv_data_table_offset = 0;
331unsigned short * nv_data_table;
332NV_VESA_TABLE * std_vesa;
333
334int i = 0;
335
336while (i < 0x300)
337{ //We don't need to look for the table in the whole bios, the 768 first bytes only
338if ((map->bios_ptr[i] == 0x44)
339&& (map->bios_ptr[i+1] == 0x01)
340&& (map->bios_ptr[i+2] == 0x04)
341&& (map->bios_ptr[i+3] == 0x00))
342{
343nv_data_table_offset = (unsigned short) (map->bios_ptr[i+4] | (map->bios_ptr[i+5] << 8));
344break;
345}
346i++;
347}
348
349nv_data_table = (unsigned short *) (map->bios_ptr + (nv_data_table_offset + OFFSET_TO_VESA_TABLE_INDEX));
350std_vesa = (NV_VESA_TABLE *) (map->bios_ptr + *nv_data_table);
351
352map->nv_mode_table = (char *) std_vesa->sModelines;
353if (map->nv_mode_table == 0)
354{
355printf("Unable to locate the mode table.\n");
356printf("Please run the program 'dump_bios' as root and\n");
357printf("email the file 'vbios.dmp' to stomljen@yahoo.com.\n");
358printf("Chipset: %s\n", map->chipset);
359close_vbios(map);
360pause();
361return 0;
362}
363map->mode_table_size = std_vesa->sHeader.usTable_Size;
364
365break;
366}
367i++;
368}
369}
370
371
372/*
373 * check if we have Intel
374 */
375
376/*if (map->chipset == CT_UNKWN && memmem(map->bios_ptr, VBIOS_SIZE, INTEL_SIGNATURE, strlen(INTEL_SIGNATURE))) {
377 printf( "Intel chipset detected. However, 915resolution was unable to determine the chipset type.\n");
378
379 printf("Chipset Id: %x\n", map->chipset_id);
380
381 printf("Please report this problem to stomljen@yahoo.com\n");
382
383 close_vbios(map);
384 return 0;
385 }*/
386
387/*
388 * check for others
389 */
390
391
392
393/*
394 * Figure out where the mode table is
395 */
396if ((map->bios != BT_ATI_1) && (map->bios != BT_NVDA))
397{
398char* p = map->bios_ptr + 16;
399char* limit = map->bios_ptr + VBIOS_SIZE - (3 * sizeof(vbios_mode));
400
401while (p < limit && map->mode_table == 0)
402{
403vbios_mode * mode_ptr = (vbios_mode *) p;
404
405if (((mode_ptr[0].mode & 0xf0) == 0x30) && ((mode_ptr[1].mode & 0xf0) == 0x30) &&
406((mode_ptr[2].mode & 0xf0) == 0x30) && ((mode_ptr[3].mode & 0xf0) == 0x30))
407{
408map->mode_table = mode_ptr;
409}
410
411p++;
412}
413
414if (map->mode_table == 0)
415{
416close_vbios(map);
417return 0;
418}
419}
420
421
422/*
423 * Determine size of mode table
424 */
425if ((map->bios != BT_ATI_1) && (map->bios != BT_ATI_2) && (map->bios != BT_NVDA))
426{
427vbios_mode * mode_ptr = map->mode_table;
428
429while (mode_ptr->mode != 0xff)
430{
431map->mode_table_size++;
432mode_ptr++;
433}
434}
435
436/*
437 * Figure out what type of bios we have
438 * order of detection is important
439 */
440if ((map->bios != BT_ATI_1) && (map->bios != BT_ATI_2) && (map->bios != BT_NVDA))
441{
442if (detect_bios_type(map, TRUE, sizeof(vbios_modeline_type3)))
443{
444map->bios = BT_3;
445}
446else if (detect_bios_type(map, TRUE, sizeof(vbios_modeline_type2)))
447{
448map->bios = BT_2;
449}
450else if (detect_bios_type(map, FALSE, sizeof(vbios_resolution_type1)))
451{
452map->bios = BT_1;
453}
454else {
455return 0;
456}
457}
458
459return map;
460}
461
462void close_vbios(vbios_map * map)
463{
464free(map);
465}
466
467void unlock_vbios(vbios_map * map)
468{
469
470map->unlocked = TRUE;
471
472switch (map->chipset) {
473case CT_UNKWN:
474break;
475case CT_830:
476case CT_855GM:
477outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
478map->b1 = inb(CONFIG_MECH_ONE_DATA + 2);
479
480outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
481outb(CONFIG_MECH_ONE_DATA + 2, 0x33);
482break;
483case CT_845G:
484case CT_865G:
485case CT_915G:
486case CT_915GM:
487case CT_945G:
488case CT_945GM:
489case CT_945GME:
490case CT_946GZ:
491case CT_G965:
492case CT_Q965:
493case CT_965GM:
494case CT_975X:
495case CT_P35:
496case CT_955X:
497case CT_X48:
498case CT_B43:
499case CT_Q45:
500case CT_P45:
501case CT_GM45:
502case CT_G45:
503case CT_G41:
504case CT_G31:
505case CT_500:
506case CT_3150:
507case CT_UNKWN_INTEL:// Assume newer intel chipset is the same as before
508outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
509map->b1 = inb(CONFIG_MECH_ONE_DATA + 1);
510map->b2 = inb(CONFIG_MECH_ONE_DATA + 2);
511outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
512outb(CONFIG_MECH_ONE_DATA + 1, 0x33);
513outb(CONFIG_MECH_ONE_DATA + 2, 0x33);
514break;
515default:
516break;
517}
518
519#if DEBUG
520{
521UInt32 t = inl(CONFIG_MECH_ONE_DATA);
522verbose("unlock PAM: (0x%08x)\n", t);
523}
524#endif
525}
526
527void relock_vbios(vbios_map * map)
528{
529
530map->unlocked = FALSE;
531
532switch (map->chipset)
533{
534case CT_UNKWN:
535break;
536case CT_830:
537case CT_855GM:
538outl(CONFIG_MECH_ONE_ADDR, 0x8000005a);
539outb(CONFIG_MECH_ONE_DATA + 2, map->b1);
540break;
541case CT_845G:
542case CT_865G:
543case CT_915G:
544case CT_915GM:
545case CT_945G:
546case CT_945GM:
547case CT_945GME:
548case CT_946GZ:
549case CT_G965:
550case CT_955X:
551case CT_G45:
552case CT_Q965:
553case CT_965GM:
554case CT_975X:
555case CT_P35:
556case CT_X48:
557case CT_B43:
558case CT_Q45:
559case CT_P45:
560case CT_GM45:
561case CT_G41:
562case CT_G31:
563case CT_500:
564case CT_3150:
565case CT_UNKWN_INTEL:
566outl(CONFIG_MECH_ONE_ADDR, 0x80000090);
567outb(CONFIG_MECH_ONE_DATA + 1, map->b1);
568outb(CONFIG_MECH_ONE_DATA + 2, map->b2);
569break;
570default:
571break;
572}
573
574#if DEBUG
575{
576 UInt32 t = inl(CONFIG_MECH_ONE_DATA);
577verbose("relock PAM: (0x%08x)\n", t);
578}
579#endif
580}
581
582
583int getMode(edid_mode *mode)
584{
585char* edidInfo = readEDID();
586
587if(!edidInfo) return 1;
588
589mode->pixel_clock = (edidInfo[55] << 8) | edidInfo[54];
590mode->h_active = edidInfo[56] | ((edidInfo[58] & 0xF0) << 4);
591mode->h_blanking = ((edidInfo[58] & 0x0F) << 8) | edidInfo[57];
592mode->v_active = edidInfo[59] | ((edidInfo[61] & 0xF0) << 4);
593mode->v_blanking = ((edidInfo[61] & 0x0F) << 8) | edidInfo[60];
594mode->h_sync_offset = ((edidInfo[65] & 0xC0) >> 2) | edidInfo[62];
595mode->h_sync_width = (edidInfo[65] & 0x30) | edidInfo[63];
596mode->v_sync_offset = (edidInfo[65] & 0x0C) | ((edidInfo[64] & 0x0C) >> 2);
597mode->v_sync_width = ((edidInfo[65] & 0x3) << 2) | (edidInfo[64] & 0x03);
598
599
600free( edidInfo );
601
602if(!mode->h_active) return 1;
603
604return 0;
605
606}
607
608
609static void gtf_timings(UInt32 x, UInt32 y, UInt32 freq,
610unsigned long *clock,
611UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,
612UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank)
613{
614UInt32 hbl, vbl, vfreq;
615
616vbl = y + (y+1)/(20000.0/(11*freq) - 1) + 1.5;
617vfreq = vbl * freq;
618hbl = 16 * (int)(x * (30.0 - 300000.0 / vfreq) /
619 + (70.0 + 300000.0 / vfreq) / 16.0 + 0.5);
620
621*vsyncstart = y;
622*vsyncend = y + 3;
623*vblank = vbl - 1;
624*hsyncstart = x + hbl / 2 - (x + hbl + 50) / 100 * 8 - 1;
625*hsyncend = x + hbl / 2 - 1;
626*hblank = x + hbl - 1;
627*clock = (x + hbl) * vfreq / 1000;
628}
629
630void set_mode(vbios_map * map, /*UInt32 mode,*/ UInt32 x, UInt32 y, UInt32 bp, UInt32 htotal, UInt32 vtotal) {
631UInt32 xprev, yprev;
632UInt32 i = 0, j;
633// patch first available mode
634
635//for (i=0; i < map->mode_table_size; i++) {
636//if (map->mode_table[0].mode == mode) {
637switch(map->bios) {
638case BT_1:
639{
640vbios_resolution_type1 * res = map_type1_resolution(map, map->mode_table[i].resolution);
641
642if (bp) {
643map->mode_table[i].bits_per_pixel = bp;
644}
645
646res->x2 = (htotal?(((htotal-x) >> 8) & 0x0f) : (res->x2 & 0x0f)) | ((x >> 4) & 0xf0);
647res->x1 = (x & 0xff);
648
649res->y2 = (vtotal?(((vtotal-y) >> 8) & 0x0f) : (res->y2 & 0x0f)) | ((y >> 4) & 0xf0);
650res->y1 = (y & 0xff);
651if (htotal)
652res->x_total = ((htotal-x) & 0xff);
653
654if (vtotal)
655res->y_total = ((vtotal-y) & 0xff);
656
657break;
658}
659case BT_2:
660{
661vbios_resolution_type2 * res = map_type2_resolution(map, map->mode_table[i].resolution);
662
663res->xchars = x / 8;
664res->ychars = y / 16 - 1;
665xprev = res->modelines[0].x1;
666yprev = res->modelines[0].y1;
667
668for(j=0; j < 3; j++) {
669vbios_modeline_type2 * modeline = &res->modelines[j];
670
671if (modeline->x1 == xprev && modeline->y1 == yprev) {
672modeline->x1 = modeline->x2 = x-1;
673modeline->y1 = modeline->y2 = y-1;
674
675gtf_timings(x, y, freqs[j], &modeline->clock,
676&modeline->hsyncstart, &modeline->hsyncend,
677&modeline->hblank, &modeline->vsyncstart,
678&modeline->vsyncend, &modeline->vblank);
679
680if (htotal)
681modeline->htotal = htotal;
682else
683modeline->htotal = modeline->hblank;
684
685if (vtotal)
686modeline->vtotal = vtotal;
687else
688modeline->vtotal = modeline->vblank;
689}
690}
691break;
692}
693case BT_3:
694{
695vbios_resolution_type3 * res = map_type3_resolution(map, map->mode_table[i].resolution);
696
697xprev = res->modelines[0].x1;
698yprev = res->modelines[0].y1;
699
700for (j=0; j < 3; j++) {
701vbios_modeline_type3 * modeline = &res->modelines[j];
702
703if (modeline->x1 == xprev && modeline->y1 == yprev) {
704modeline->x1 = modeline->x2 = x-1;
705modeline->y1 = modeline->y2 = y-1;
706
707gtf_timings(x, y, freqs[j], &modeline->clock,
708&modeline->hsyncstart, &modeline->hsyncend,
709&modeline->hblank, &modeline->vsyncstart,
710&modeline->vsyncend, &modeline->vblank);
711if (htotal)
712modeline->htotal = htotal;
713else
714modeline->htotal = modeline->hblank;
715if (vtotal)
716modeline->vtotal = vtotal;
717else
718modeline->vtotal = modeline->vblank;
719
720modeline->timing_h = y-1;
721modeline->timing_v = x-1;
722}
723}
724break;
725}
726case BT_ATI_1:
727{
728edid_mode mode;
729
730ATOM_MODE_TIMING *mode_timing = (ATOM_MODE_TIMING *) map->ati_mode_table;
731
732//if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {
733if (!getMode(&mode)) {
734mode_timing->usCRTC_H_Total = mode.h_active + mode.h_blanking;
735mode_timing->usCRTC_H_Disp = mode.h_active;
736mode_timing->usCRTC_H_SyncStart = mode.h_active + mode.h_sync_offset;
737mode_timing->usCRTC_H_SyncWidth = mode.h_sync_width;
738
739mode_timing->usCRTC_V_Total = mode.v_active + mode.v_blanking;
740mode_timing->usCRTC_V_Disp = mode.v_active;
741mode_timing->usCRTC_V_SyncStart = mode.v_active + mode.v_sync_offset;
742mode_timing->usCRTC_V_SyncWidth = mode.v_sync_width;
743
744mode_timing->usPixelClock = mode.pixel_clock;
745}
746/*else
747{
748vbios_modeline_type2 modeline;
749
750cvt_timings(x, y, freqs[0], &modeline.clock,
751&modeline.hsyncstart, &modeline.hsyncend,
752&modeline.hblank, &modeline.vsyncstart,
753&modeline.vsyncend, &modeline.vblank, 0);
754
755mode_timing->usCRTC_H_Total = x + modeline.hblank;
756mode_timing->usCRTC_H_Disp = x;
757mode_timing->usCRTC_H_SyncStart = modeline.hsyncstart;
758mode_timing->usCRTC_H_SyncWidth = modeline.hsyncend - modeline.hsyncstart;
759
760mode_timing->usCRTC_V_Total = y + modeline.vblank;
761mode_timing->usCRTC_V_Disp = y;
762mode_timing->usCRTC_V_SyncStart = modeline.vsyncstart;
763mode_timing->usCRTC_V_SyncWidth = modeline.vsyncend - modeline.vsyncstart;
764
765mode_timing->usPixelClock = modeline.clock;
766 }*/
767
768break;
769}
770case BT_ATI_2:
771{
772edid_mode mode;
773
774ATOM_DTD_FORMAT *mode_timing = (ATOM_DTD_FORMAT *) map->ati_mode_table;
775
776/*if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {*/
777if (!getMode(&mode)) {
778mode_timing->usHBlanking_Time = mode.h_blanking;
779mode_timing->usHActive = mode.h_active;
780mode_timing->usHSyncOffset = mode.h_sync_offset;
781mode_timing->usHSyncWidth = mode.h_sync_width;
782
783mode_timing->usVBlanking_Time = mode.v_blanking;
784mode_timing->usVActive = mode.v_active;
785mode_timing->usVSyncOffset = mode.v_sync_offset;
786mode_timing->usVSyncWidth = mode.v_sync_width;
787
788mode_timing->usPixClk = mode.pixel_clock;
789}
790/*else
791{
792vbios_modeline_type2 modeline;
793
794cvt_timings(x, y, freqs[0], &modeline.clock,
795&modeline.hsyncstart, &modeline.hsyncend,
796&modeline.hblank, &modeline.vsyncstart,
797&modeline.vsyncend, &modeline.vblank, 0);
798
799mode_timing->usHBlanking_Time = modeline.hblank;
800 +mode_timing->usHActive = x;
801 +mode_timing->usHSyncOffset = modeline.hsyncstart - x;
802 +mode_timing->usHSyncWidth = modeline.hsyncend - modeline.hsyncstart;
803 +
804 +mode_timing->usVBlanking_Time = modeline.vblank;
805 +mode_timing->usVActive = y;
806 +mode_timing->usVSyncOffset = modeline.vsyncstart - y;
807 +mode_timing->usVSyncWidth = modeline.hsyncend - modeline.hsyncstart;
808 +
809 +mode_timing->usPixClk = modeline.clock;
810 +}*/
811
812
813break;
814}
815case BT_NVDA:
816{
817edid_mode mode;
818
819NV_MODELINE *mode_timing = (NV_MODELINE *) map->nv_mode_table;
820
821/*if (mode.pixel_clock && (mode.h_active == x) && (mode.v_active == y) && !force) {*/
822if (!getMode(&mode)) {
823mode_timing[i].usH_Total = mode.h_active + mode.h_blanking;
824mode_timing[i].usH_Active = mode.h_active;
825mode_timing[i].usH_SyncStart = mode.h_active + mode.h_sync_offset;
826mode_timing[i].usH_SyncEnd = mode.h_active + mode.h_sync_offset + mode.h_sync_width;
827
828mode_timing[i].usV_Total = mode.v_active + mode.v_blanking;
829mode_timing[i].usV_Active = mode.v_active;
830mode_timing[i].usV_SyncStart = mode.v_active + mode.v_sync_offset;
831mode_timing[i].usV_SyncEnd = mode.v_active + mode.v_sync_offset + mode.v_sync_width;
832
833mode_timing[i].usPixel_Clock = mode.pixel_clock;
834}
835/*else
836 {
837 vbios_modeline_type2 modeline;
838
839 cvt_timings(x, y, freqs[0], &modeline.clock,
840 &modeline.hsyncstart, &modeline.hsyncend,
841 &modeline.hblank, &modeline.vsyncstart,
842 &modeline.vsyncend, &modeline.vblank, 0);
843
844 mode_timing[i].usH_Total = x + modeline.hblank - 1;
845 mode_timing[i].usH_Active = x;
846 mode_timing[i].usH_SyncStart = modeline.hsyncstart - 1;
847 mode_timing[i].usH_SyncEnd = modeline.hsyncend - 1;
848
849 mode_timing[i].usV_Total = y + modeline.vblank - 1;
850 mode_timing[i].usV_Active = y;
851 mode_timing[i].usV_SyncStart = modeline.vsyncstart - 1;
852 mode_timing[i].usV_SyncEnd = modeline.vsyncend - 1;
853
854 mode_timing[i].usPixel_Clock = modeline.clock;
855 }*/
856break;
857}
858case BT_UNKWN:
859{
860break;
861}
862default:
863break;
864}
865//}
866//}
867}
868

Archive Download this file

Revision: 2112