/[gentoo-src]/Xorgautoconfig/Xorgautoconfig.c
Gentoo

Contents of /Xorgautoconfig/Xorgautoconfig.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (show annotations) (download) (as text)
Wed Jan 18 18:30:34 2006 UTC (8 years, 9 months ago) by josejx
Branch: MAIN
Changes since 1.18: +1 -1 lines
File MIME type: text/x-csrc
Fixed false nvidia positive on ATI Radeon NV cards.

1 /* Xorgautoconfig: versatile xorg.conf creation tool for PowerPC
2 *
3 * Copyright (C) 2005 Lars Weiler <pylon@gentoo.org>
4 * Copyright (C) 2005 Joseph Jezak <josejx@gentoo.org>
5 *
6 * This xorg.conf creation tool is a fork from Xautoconfig-0.23
7 * (http://ftp.penguinppc.org/projects/xautocfg/)
8 *
9 * The original header-comment contained:
10 * Copyright (C) 2002-2004 Dan Burcaw <dan@ydl.net>
11 * Copyright (C) 1999-2001 Tom Rini <trini@kernel.crashing.org>
12 *
13 * Thanks for this good start for an X.Org configurator!
14 *
15 */
16
17 #define _GNU_SOURCE
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <assert.h>
21 #include <ctype.h>
22 #include <signal.h>
23 #include <fcntl.h>
24 #include <string.h>
25 #include <unistd.h>
26 #include <sys/ioctl.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <sys/syscall.h>
30 #include <sys/mman.h>
31 #include <netinet/in.h>
32 #include <linux/fb.h>
33 #include <byteswap.h>
34 #include <dirent.h>
35 #include <sys/utsname.h>
36 #include <pci/pci.h>
37
38 #include "ddcprobe/common.h"
39 #include "ddcprobe/vesamode.h"
40 #include "Xorgtext.h"
41
42 extern int bus, dev, func;
43 extern void findVideoDevice(void);
44 extern void help();
45 extern void usage();
46 extern char * macMachineType(void);
47
48 struct monitor_sync
49 {
50 int h_min;
51 int h_max;
52 int v_min;
53 int v_max;
54 };
55
56 int main(int argc, char **argv) {
57 FILE * f;
58 int i, depth, fd;
59 int rc = 0, offb = 0, fbdepth = 0, fbdev = 0, nv = 0, forcebus = 0;
60 unsigned int xsstart, xsend, xtotal = 0;
61 unsigned int ysstart, ysend, ytotal = 0;
62 double drate, vrate, hrate;
63 unsigned int htotal, vtotal;
64 char manufacturer[4];
65
66 struct monitor_sync sync;
67 struct fb_fix_screeninfo fix;
68 struct fb_var_screeninfo var;
69 struct edid1_info *edid_info = NULL;
70
71 const char * name = "/dev/fb0";
72 unsigned char *mem;
73 char *macid;
74 char *eisaid;
75 char keyboard_layout[32];
76 memset(keyboard_layout, 0, 32);
77
78 DIR *testdir; /* Test if path is a directory */
79 char *busid_input; /* BusID input test */
80 char path[256]; /* Font Path */
81 char videobuf[MAX_VIDEO_LEN]; /* Video Card Device section */
82 int videolen = MAX_VIDEO_LEN - 1; /* How many chars we have left */
83 char dri = FALSE; /* DRI on or off */
84 char dump = FALSE; /* Dump debugging info? */
85 char quiet = FALSE; /* Be quiet */
86 struct utsname kern; /* Get the kernel version */
87 char kern_new = FALSE;
88 char kern_ver [3];
89
90 uname(&kern);
91 if(strlen(kern.release) > 6) {
92 strncpy(kern_ver, (const char *)(&kern.release) + 4, 2);
93 kern_ver[2] = (char) NULL;
94
95 if(atoi(kern_ver) >= 12)
96 kern_new = TRUE;
97 }
98
99 if (!(fd = open(name, O_RDONLY)))
100 rc = 2; /* Failure */
101
102 if (!rc && ioctl(fd, FBIOGET_FSCREENINFO, &fix))
103 rc = 2; /* Failure */
104
105 if (!rc && ioctl(fd, FBIOGET_VSCREENINFO, &var))
106 rc = 2; /* Failure */
107
108 close(fd);
109
110 if (rc) {
111 fprintf(stderr, "Can't access %s. Exiting.\n", name);
112 return -1;
113 }
114
115 /* 640x480 framebuffer typically implies a CRT, so lets bump */
116 /* the resolution up to 800x600 to be a bit more sane */
117 if (var.xres == 640 && var.yres == 480) {
118 var.xres = 800;
119 var.yres = 600;
120 }
121
122 if (argc > 1) {
123 int args;
124 for(args = 1; args<argc; args++) {
125 if (!strncmp(argv[args], "--fbdepth",9))
126 fbdepth = 1;
127 else if (!strncmp(argv[args], "--fbdev",7))
128 fbdev = 1;
129 else if (!strncmp(argv[args], "--dump",6))
130 dump = TRUE;
131 else if (!strncmp(argv[args], "--safe",6))
132 fbdev = fbdepth = 1;
133 else if (!strncmp(argv[args], "--quiet",7))
134 quiet = TRUE;
135 else if (!strncmp(argv[args], "--keymap=", 9)) {
136 strncpy(keyboard_layout, argv[args] + 9 , 29);
137 strcat(keyboard_layout, "\"\n");
138 }
139 else if (!strncmp(argv[args], "--force-bus=",12)) {
140 /* Bus */
141 busid_input = strtok(argv[args] + 12, ":");
142 if(busid_input != NULL)
143 bus = atoi(busid_input);
144 /* Dev */
145 busid_input = strtok(NULL, ":");
146 if(busid_input != NULL)
147 bus = atoi(busid_input);
148 /* Func */
149 busid_input = strtok(NULL, ":");
150 if(busid_input != NULL)
151 func = atoi(busid_input);
152 forcebus = TRUE;
153 }
154 else if (!strncmp(argv[args], "--version",9)) {
155 printf("Xorgautoconfig v" XAC_VER "\n");
156 exit(0);
157 }
158 else if (!strcmp(argv[args], "--list-keymaps")) {
159 printf("%s", keymap_list);
160 exit(0);
161 } else {
162 usage();
163 exit(0);
164 }
165 }
166 }
167
168 /* Check to see what type of Mac we're on.*/
169 /* e.g. PowerBook1,1 */
170 macid = macMachineType();
171
172 sync.h_min = 0;
173 sync.h_max = 0;
174 sync.v_min = 0;
175 sync.v_max = 0;
176
177 /* Check to see if EDID is available */
178 if ( (sizeof(struct edid1_info) == 256) &&
179 (sizeof(struct edid_monitor_descriptor) == 18) &&
180 get_edid_supported())
181 {
182 edid_info = get_edid_info();
183
184 if ( !(edid_info == NULL) &&
185 !(edid_info->version == 0) &&
186 !(edid_info->version == 0xff && edid_info->revision == 0xff) &&
187 !(edid_info->version == 0 && edid_info->revision == 0))
188 {
189 manufacturer[0] = edid_info->manufacturer_name.char1 + 'A' - 1;
190 manufacturer[1] = edid_info->manufacturer_name.char2 + 'A' - 1;
191 manufacturer[2] = edid_info->manufacturer_name.char3 + 'A' - 1;
192 manufacturer[3] = '\0';
193 eisaid = malloc(sizeof(manufacturer) + sizeof(edid_info->product_code));
194 sprintf(eisaid, "%s%04x", manufacturer, edid_info->product_code);
195
196 for (i = 0; i < 4; i++)
197 {
198 struct edid_monitor_descriptor *monitor = NULL;
199
200 monitor = &edid_info->monitor_details.monitor_descriptor[i];
201
202 if (monitor->type == edid_monitor_descriptor_range)
203 {
204 sync.h_min = monitor->data.range_data.horizontal_min;
205 sync.h_max = monitor->data.range_data.horizontal_max;
206 sync.v_min = monitor->data.range_data.vertical_min;
207 sync.v_max = monitor->data.range_data.vertical_max;
208 }
209 }
210 /* On certain Apple LCD panels, set vertical min and max */
211 if ((eisaid) && (!strcmp(eisaid, "APP1592") ||
212 !strcmp(eisaid, "APPf401") ||
213 !strcmp(eisaid, "APP1792") ||
214 !strcmp(eisaid, "APP1992") ||
215 !strcmp(eisaid, "APP1692") ||
216 !strcmp(eisaid, "APP1892")))
217 sync.v_min = 50;
218 sync.v_max = 60;
219 }
220 }
221
222 /* More or less taken from Geert Uytterhoeven's fbset (GPL'ed as well..) */
223 htotal = var.left_margin+var.xres+var.right_margin+var.hsync_len;
224 vtotal = var.upper_margin+var.yres+var.lower_margin+var.vsync_len;
225 drate = (1E12/var.pixclock);
226 hrate = drate/htotal;
227 vrate = hrate/vtotal;
228 xsstart = var.xres+var.right_margin;
229 xsend = xsstart+var.hsync_len;
230 xtotal = xsend+var.left_margin;
231 ysstart = var.yres+var.lower_margin;
232 ysend = ysstart+var.vsync_len;
233 ytotal = ysend+var.upper_margin;
234 if (var.bits_per_pixel == 8)
235 depth = 8;
236 else
237 depth = var.red.length+var.green.length+var.blue.length;
238
239 /* look for nvidia and offb */
240 if (fix.id)
241 {
242 mem = strdup(fix.id);
243 while(((i = strlen(mem)) > 0) && isspace(mem[i - 1])) {
244 mem[i - 1] = '\0';
245 }
246 if (strstr(fix.id, "NV") != NULL && strstr(fix.id, "ATI") == NULL)
247 nv = 1;
248 if (!strncmp(fix.id, "OFfb", 4))
249 offb = 1;
250 }
251
252 /* For BusID */
253 if(forcebus == 0)
254 findVideoDevice();
255
256 /* Work out the card specifics to figure out if we need DRI, etc. */
257 depth = 16;
258 memset(videobuf, 0, MAX_VIDEO_LEN);
259 if (nv) {
260 if (!strncmp(macid, "PowerMac4,2", 11) || !strncmp(macid, "PowerMac4,5", 11))
261 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Option \"FlatPanel\"\n");
262 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_nv);
263 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"nv\"\n");
264 dri = FALSE;
265 } else if((fbdev) || (bus == 0 && dev == 0 && func == 0)) {
266 if (!fbdev) {
267 videolen -= snprintf(videobuf + strlen(videobuf),
268 videolen, "\t# We couldn't determine the BusID of your ");
269 videolen -= snprintf(videobuf + strlen(videobuf),
270 videolen, "video card. So we will use\n#\tthe fbdev driver\n");
271 }
272 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " #Option \"ShadowFB\" \"true\"\n");
273 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " #Option \"fbdev\" \"%s\"\n", name);
274 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"fbdev\"\n");
275 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " #BusID \"0:0:0\"\n");
276 depth = 15;
277 dri = FALSE;
278 } else {
279 /* Try and guess what video card is behind /dev/fb0 */
280 switch(fix.accel) {
281 /* ATI Mach64 Family cards */
282 case 6:
283 case 8:
284 case 9:
285 case 10:
286 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_on_opts);
287 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"ati\"\n");
288 dri = FALSE; /* Can this be enabled? */
289 break;
290 /* IMS Twin Turbo */
291 case 14:
292 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_off_opts);
293 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"imstt\"\n");
294 dri = FALSE; /* Can this be enabled? */
295 break;
296 /* Matrox Family */
297 case 16:
298 case 17:
299 case 18:
300 case 20:
301 case 21:
302 case 26:
303 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_off_opts);
304 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"mga\"\n");
305 dri = FALSE; /* Can this be enabled? */
306 break;
307 /* Chips&Technology 6555x */
308 /* Is this still broken?
309 case 30:
310 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_off_opts);
311 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"chips\"\n");
312 dri = FALSE;
313 break;
314 */
315 /* VooDoo 3 / Banshee */
316 case 31:
317 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_off_opts);
318 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"tdfx\"\n");
319 dri = FALSE; /* Can this be enabled? */
320 break;
321 /* ATI Rage 128 Family */
322 case 32:
323 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_r128);
324 if(kern_new)
325 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"False\"\n");
326 else
327 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"True\"\n");
328 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"r128\"\n");
329 dri = TRUE;
330 break;
331 /* ATI Radeon */
332 case 38:
333 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_radeon);
334 if(!strncmp(macid + 5, "Pegasos", 7))
335 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", "\tOption\t\"BusType\"\t\"PCI\"\n");
336 if(kern_new)
337 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"False\"\n");
338 else
339 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"True\"\n");
340 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"radeon\"\n");
341 dri = TRUE;
342 break;
343 default:
344 if (!strncmp(fix.id, "ATI Radeon", 10)) {
345 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_radeon);
346 if(!strncmp(macid + 5, "Pegasos", 7))
347 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", "\tOption\t\"BusType\"\t\"PCI\"\n");
348 if(kern_new)
349 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"False\"\n");
350 else
351 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"True\"\n");
352 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"radeon\"\n");
353 dri = TRUE;
354 } else if (!strncmp(fix.id, "Rage128", 7)) {
355 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_r128);
356 if(kern_new)
357 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"False\"\n");
358 else
359 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"True\"\n");
360 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"r128\"\n");
361 dri = TRUE;
362 } else if (!strncmp(fix.id, "Rage Mobility M3", 16)) {
363 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "%s", driver_r128);
364 if(kern_new)
365 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"False\"\n");
366 else
367 videolen -= snprintf(videobuf + strlen(videobuf), videolen, "\tOption\t\"UseFBDev\"\t\"True\"\n");
368 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"r128\"\n");
369 dri = TRUE;
370 } else {
371 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " #Option \"ShadowFB\" \"true\"\n");
372 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " Driver\t\"fbdev\"\n");
373 dri = FALSE;
374 depth = 15;
375 }
376 break;
377 }
378 videolen -= snprintf(videobuf + strlen(videobuf), videolen, " BusID \"PCI:%d:%d:%d\"\n", bus, dev, func);
379 }
380
381 if(dump) {
382 printf("Dumping Debugging Information:\n");
383 printf("\tMachine ID:\t%s\n", macid);
384 if(edid_info == NULL)
385 printf("\tNo EDID Information present\n");
386 else
387 printf("\tEDID Tag:\t%s\n", eisaid);
388 printf("\tH-Min: %i H-Max: %i V-Min: %i V-Max: %i\n", sync.h_min, sync.h_max, sync.v_min, sync.v_max);
389 printf("\tCard Dump:\n");
390 printf("\t\tFramebuffer Id:\t\t%s\n", fix.id);
391 printf("\t\tFramebuffer Type:\t%i\n", fix.accel);
392 printf("\t\tFramebuffer Depth:\t%i\n", depth);
393 return 0;
394 }
395
396 /* Let's be nice and backup an existing xorg.conf */
397 if ((f = fopen("/etc/X11/xorg.conf", "r"))) {
398 system("mv /etc/X11/xorg.conf /etc/X11/xorg.conf.autobak");
399 if(!quiet)
400 printf("The current xorg.conf has been copied into /etc/X11/xorg.conf.autobak\n");
401 }
402
403 /* Check the permissions for writing */
404 if (!(f = fopen("/etc/X11/xorg.conf", "w"))) {
405 fprintf(stderr, "Can't write to /etc/X11/xorg.conf. Exiting.\n");
406 return -1;
407 }
408
409 /*** BEGIN xorg.conf ***/
410 fprintf(f, "%s", header);
411
412 /* Set fontpaths */
413 DIR *fontdir = opendir(FONTPATH);
414 struct dirent *fontpath;
415
416 /* Add x fontserver note */
417 fprintf(f, "%s", fontpath_xfs);
418 if(fontdir != NULL) {
419 while ((fontpath = readdir (fontdir))) {
420 if((fontpath->d_name)[0] != '.') {
421 /* Only add directories */
422 strcpy(path, FONTPATH);
423 strcat(path, fontpath->d_name);
424 strcat(path, "/");
425 testdir = opendir(path);
426 if(testdir != NULL) {
427 fprintf(f, "\tFontPath\t\"%s\"\n",
428 path);
429 if(!strncmp(fontpath->d_name,"75dpi",5) ||
430 !strncmp(fontpath->d_name,"100dpi",6)){
431 fprintf(f, "\tFontPath\t\"%s:unscaled\"\n",
432 path);
433 }
434 closedir(testdir);
435 }
436 }
437 }
438 closedir(fontdir);
439 }
440 else {
441 fprintf(f, "%s", fontpath_gentoo);
442 }
443 fprintf(f, "EndSection\n\n");
444
445 /* modules section */
446 fprintf(f, "%s", modules_section_start);
447 if(!dri) fprintf(f, "%s", "#");
448 fprintf(f, "%s", modules_section_end);
449
450 /* extensions section */
451 fprintf(f, "%s", extensions_section);
452
453 /* serverflags section */
454 fprintf(f, "%s", serverflags_section);
455
456 /* input dev section */
457 fprintf(f, "%s", inputdev_section);
458
459 /* keyboard */
460 if(0 == keyboard_layout[0])
461 strcpy(keyboard_layout, "us\"\n");
462 fprintf(f, "%s", keyboard_linux_start);
463 fprintf(f, "%s", keyboard_layout);
464 fprintf(f, "%s", keyboard_linux_end);
465
466 /* mouse */
467 fprintf(f, "%s", mouse_section);
468
469 /* monitor section */
470 if (!offb)
471 fprintf(f, "%s", monitor_section);
472 else
473 fprintf(f, "%s", monitor_section_nomodes);
474
475 /* Check for bogus sync values */
476 if (sync.v_min > sync.v_max){
477 int swap;
478 swap = sync.v_min;
479 sync.v_min = sync.v_max;
480 sync.v_max = swap;
481 }
482 /* Use EDID's horizsync / vert refresh first, otherwise try to be sane */
483 if (sync.h_min && sync.h_max && sync.v_min && sync.v_max)
484 {
485 fprintf(f, "\tHorizSync %d-%d\n\tVertRefresh %d-%d\n",
486 sync.h_min, sync.h_max, sync.v_min, sync.v_max);
487 } else if (!strncmp(macid, "PowerMac4,2", 11)) {
488 fprintf(f, "\tHorizSync 28-49 \n\tVertRefresh 50-60\n");
489 } else if (sync.v_min && sync.v_max) {
490 /* Apple Studio/Cinema Display case */
491 fprintf(f, "\tHorizSync 30-130\n\tVertRefresh %d-%d\n",
492 sync.v_min, sync.v_max);
493 } else {
494 if(var.xres <= 640)
495 fprintf(f, " HorizSync 28-33\n VertRefresh 43-72\n");
496 else if(var.xres <= 800)
497 fprintf(f, " HorizSync 28-50\n VertRefresh 43-75\n");
498 else if(var.xres <= 1024)
499 fprintf(f, " HorizSync 30-70\n VertRefresh 50-160\n");
500 else if(var.xres <= 1152)
501 fprintf(f, " HorizSync 30-100\n VertRefresh 50-160\n");
502 else
503 fprintf(f, " HorizSync 30-130\n VertRefresh 50-160\n");
504 }
505
506 if (!offb)
507 {
508 fprintf(f, "%s", modes_section);
509 fprintf(f, " # D: %5.3f MHz, H: %5.3f kHz, V: %5.3f Hz\n", drate/1E6,
510 hrate/1E3, vrate);
511 fprintf(f, " Modeline \"%dx%d\" %5.3f %d %d %d %d %d %d %d %d ",
512 var.xres, var.yres, drate/1E6, var.xres, xsstart, xsend,
513 xtotal, var.yres, ysstart, ysend, ytotal);
514 if (var.vmode & FB_VMODE_INTERLACED)
515 fprintf(f, " Interlace");
516 if (var.vmode & FB_VMODE_DOUBLE)
517 fprintf(f, " DoubleScan");
518 if (var.sync & FB_SYNC_HOR_HIGH_ACT)
519 fprintf(f, " +HSync");
520 else
521 fprintf(f, " -HSync");
522 if (var.sync & FB_SYNC_VERT_HIGH_ACT)
523 fprintf(f, " +VSync");
524 else
525 fprintf(f, " -VSync");
526 if (var.sync & FB_SYNC_COMP_HIGH_ACT)
527 fprintf(f, " Composite");
528 if (var.sync & FB_SYNC_BROADCAST)
529 fprintf(f, " bcast");
530 }
531 fprintf(f, "%s", device_start);
532 fprintf(f, "%s", videobuf);
533 fprintf(f, "%s", screen_section);
534 fprintf(f, "%d\n", depth);
535 if(fbdepth && depth != var.bits_per_pixel)
536 fprintf(f," DefaultFbBpp %d\n", var.bits_per_pixel);
537
538 /* Print this out for 8 / 16 / 24 */
539 for (i = 8;i <= 24;i = i + 8)
540 {
541 fprintf(f, " SubSection \"Display\"\n");
542 fprintf(f, " Depth %d\n", i);
543
544 /* If they've got 32bit use it, otherwise use 24 */
545 if (depth == 24 && depth != var.bits_per_pixel)
546 fprintf(f, " FbBpp %d\n",
547 var.bits_per_pixel);
548
549 fprintf(f, " Modes \"%dx%d\"\n", var.xres,
550 var.yres);
551 fprintf(f, " EndSubSection\n");
552 }
553
554 /* To catch depth = 15, common :( */
555 if(depth == 15) {
556 fprintf(f, " SubSection \"Display\"\n");
557 fprintf(f, " Depth %d\n", depth);
558
559 fprintf(f, " FbBpp %d\n",
560 var.bits_per_pixel);
561
562 fprintf(f, " Modes \"%dx%d\"\n", var.xres,
563 var.yres);
564 fprintf(f, " EndSubSection\n");
565 }
566
567 fprintf(f, "EndSection\n");
568 fprintf(f, "%s", dri_section);
569 /*** END Xorg.conf ***/
570
571 fclose(f);
572
573 if(!quiet) {
574 fprintf(stdout, "Wrote /etc/X11/xorg.conf\n");
575 fprintf(stdout, "Please check the configuration file for additional options\n");
576 }
577
578 return 0;
579 }

  ViewVC Help
Powered by ViewVC 1.1.20