From: zippel@fh-brandenburg.de (Roman Zippel) Subject: L68K: fb fix To: linux-m68k@lists.linux-m68k.org Date: Tue, 3 Feb 1998 09:40:51 +0100 (MET) Sender: owner-linux-m68k@phil.uni-sb.de Hi, Command line option should now work again as they should: - it makes only sense for the depth parameter to work without predefined frame buffer given, for other paramaters a mode must be given that will be modified. - get_video_mode() was anyway the wrong place to this modification - the values in amifb_default must be corrected, too, otherwise certain modes don't work Roman --- linux-2.1.79/drivers/video/amifb.c.old Sat Jan 31 23:43:23 1998 +++ linux-2.1.79/drivers/video/amifb.c Sun Feb 1 02:39:06 1998 @@ -985,6 +985,7 @@ static int amifb_ilbm = 0; /* interleaved or normal bitplanes */ static int amifb_inverse = 0; static int amifb_usermode __initdata = 0; +static int amifb_userdepth __initdata = -1; /* * Some default modes @@ -1254,21 +1255,6 @@ amifb_pan_display, amifb_ioctl }; -static struct useropts { - long xres; - long yres; - long xres_virtual; - long yres_virtual; - long bits_per_pixel; - long left_margin; - long right_margin; - long upper_margin; - long lower_margin; - long hsync_len; - long vsync_len; -} useropts __initdata = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; __initfunc(void amifb_setup(char *options, int *ints)) { @@ -1296,51 +1282,51 @@ else if (!strncmp(this_opt, "fstart:", 7)) min_fstrt = simple_strtoul(this_opt+7, NULL, 0); else if (!strncmp(this_opt, "depth:", 6)) - useropts.bits_per_pixel = simple_strtoul(this_opt+6, NULL, 0); + amifb_userdepth = simple_strtoul(this_opt+6, NULL, 0); else if (!strncmp(this_opt, "size:", 5)) { p = this_opt + 5; if (*p != ';') - useropts.xres = simple_strtoul(p, NULL, 0); + amifb_default.xres = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p != ';') - useropts.yres = simple_strtoul(p, NULL, 0); + amifb_default.yres = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p != ';') - useropts.xres_virtual = simple_strtoul(p, NULL, 0); + amifb_default.xres_virtual = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p != ';') - useropts.yres_virtual = simple_strtoul(p, NULL, 0); + amifb_default.yres_virtual = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p) - useropts.bits_per_pixel = simple_strtoul(p, NULL, 0); + amifb_default.bits_per_pixel = simple_strtoul(p, NULL, 0); } else if (!strncmp(this_opt, "timing:", 7)) { p = this_opt + 7; if (*p != ';') - useropts.left_margin = simple_strtoul(p, NULL, 0); + amifb_default.left_margin = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p != ';') - useropts.right_margin = simple_strtoul(p, NULL, 0); + amifb_default.right_margin = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p != ';') - useropts.upper_margin = simple_strtoul(p, NULL, 0); + amifb_default.upper_margin = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p) - useropts.lower_margin = simple_strtoul(p, NULL, 0); + amifb_default.lower_margin = simple_strtoul(p, NULL, 0); } else if (!strncmp(this_opt, "sync:", 5)) { p = this_opt + 5; if (*p != ';') - useropts.hsync_len = simple_strtoul(p, NULL, 0); + amifb_default.hsync_len = simple_strtoul(p, NULL, 0); if (!(p = strchr(p, ';'))) continue; if (*++p) - useropts.vsync_len = simple_strtoul(p, NULL, 0); + amifb_default.vsync_len = simple_strtoul(p, NULL, 0); } else get_video_mode(this_opt); } @@ -1817,6 +1803,8 @@ * Replace the Tag Values with the Real Pixel Clock Values */ + if (amifb_userdepth != -1) + amifb_default.bits_per_pixel = amifb_userdepth; for (i = 0; i < NUM_TOTAL_MODES; i++) { struct fb_var_screeninfo *var = &amifb_predefined[i].var; tag = var->pixclock; @@ -1826,6 +1814,12 @@ var->bits_per_pixel = maxdepth[tag]; } } + tag = amifb_default.pixclock; + if (tag == TAG_SHRES || tag == TAG_HIRES || tag == TAG_LORES) { + amifb_default.pixclock = pixclock[tag]; + if (amifb_default.bits_per_pixel > maxdepth[tag]) + amifb_default.bits_per_pixel = maxdepth[tag]; + } strcpy(fb_info.modename, amifb_name); fb_info.changevar = NULL; @@ -2027,30 +2021,6 @@ for (i = 0; i < NUM_TOTAL_MODES; i++) { if (!strcmp(name, amifb_predefined[i].name)) { amifb_default = amifb_predefined[i].var; - - if (useropts.xres != -1) - amifb_default.xres = useropts.xres; - if (useropts.yres != -1) - amifb_default.yres = useropts.yres; - if (useropts.xres_virtual != -1) - amifb_default.xres_virtual = useropts.xres_virtual; - if (useropts.yres_virtual != -1) - amifb_default.yres_virtual = useropts.yres_virtual; - if (useropts.bits_per_pixel != -1) - amifb_default.bits_per_pixel = useropts.bits_per_pixel; - if (useropts.left_margin != -1) - amifb_default.left_margin = useropts.left_margin; - if (useropts.right_margin != -1) - amifb_default.right_margin = useropts.right_margin; - if (useropts.upper_margin != -1) - amifb_default.upper_margin = useropts.upper_margin; - if (useropts.lower_margin != -1) - amifb_default.lower_margin = useropts.lower_margin; - if (useropts.hsync_len != -1) - amifb_default.hsync_len = useropts.hsync_len; - if (useropts.vsync_len != -1) - amifb_default.vsync_len = useropts.vsync_len; - amifb_usermode = i; return; }