Re: [AD] Linux patch: more on mode timings with fbcon

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Sorry for the flood of patches.  I got the fbset source code,
and from that the manpage for fb.modes, and this patch adds
support for all the other options (including interlacing and
doublescanning).

Please Cc any replies to me.

-- 
George

diff -urN allegro-3.9.24-7/src/linux/fbcon.c allegro-3.9.24-8/src/linux/fbcon.c
--- allegro-3.9.24-7/src/linux/fbcon.c	Sun Jul 25 00:34:52 1999
+++ allegro-3.9.24-8/src/linux/fbcon.c	Sun Jul 25 01:46:09 1999
@@ -645,6 +645,7 @@
    char *mode_id = NULL;
    char *geometry = NULL;
    char *timings = NULL;
+   int sync = 0, vmode = 0;
    char *s, *t;
    FILE *fbmodes;
    int ret = 0;
@@ -656,7 +657,12 @@
       s = get_line (fbmodes);
       if (!s) break;
       t = strchr (s, ' ');
-      if (t) *t++ = '\0';
+      if (t) {
+	 *t++ = '\0';
+	 while (isspace(*t)) t++;
+      } else {
+	 t = strchr (s, '\0');
+      }
 
       if (!strcmp (s, "mode")) {
 	 free (mode_id);
@@ -664,6 +670,8 @@
 	 free (timings);
 	 mode_id = strdup (t);
 	 geometry = timings = NULL;
+	 sync = 0;
+	 vmode = FB_VMODE_NONINTERLACED;
       } else if (!strcmp (s, "endmode")) {
 	 if (geometry && timings) {
 	    int mw, mh;
@@ -678,6 +686,8 @@
 		  &temp_timings.hsync_len,
 		  &temp_timings.vsync_len
 	       );
+	       temp_timings.sync = sync;
+	       temp_timings.vmode = vmode;
 	       temp_timings.xres = w;
 	       temp_timings.yres = h;
 	       ret = 1;
@@ -694,6 +704,23 @@
       } else if (!strcmp (s, "timings")) {
 	 free (timings);
 	 timings = strdup (t);
+      } else if (!strcmp (s, "hsync")) {
+	 #define set_bit(var,bit,on) var = ((var) &~ (bit)) | ((on) ? bit : 0)
+	 set_bit (sync, FB_SYNC_HOR_HIGH_ACT, t[0] == 'h');
+      } else if (!strcmp (s, "vsync")) {
+	 set_bit (sync, FB_SYNC_VERT_HIGH_ACT, t[0] == 'h');
+      } else if (!strcmp (s, "csync")) {
+	 set_bit (sync, FB_SYNC_COMP_HIGH_ACT, t[0] == 'h');
+      } else if (!strcmp (s, "gsync")) {
+	 set_bit (sync, FB_SYNC_ON_GREEN, t[0] == 'h');
+      } else if (!strcmp (s, "extsync")) {
+	 set_bit (sync, FB_SYNC_EXT, t[0] == 't');
+      } else if (!strcmp (s, "bcast")) {
+	 set_bit (sync, FB_SYNC_BROADCAST, t[0] == 't');
+      } else if (!strcmp (s, "laced")) {
+	 if (t[0] == 't') vmode = FB_VMODE_INTERLACED;
+      } else if (!strcmp (s, "double")) {
+	 if (t[0] == 't') vmode = FB_VMODE_DOUBLE;
       }
    } while (s);
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/