Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Feb 2010 16:43:07 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Marc UBM Bocklet <ubm.freebsd@googlemail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: vidcontrol / resolution problems with latest current
Message-ID:  <201002021643.09859.jkim@FreeBSD.org>
In-Reply-To: <20100202193413.a497dd9d.ubm.freebsd@gmail.com>
References:  <20100201184446.2325c04e.ubm.freebsd@gmail.com> <201002011617.31527.jkim@FreeBSD.org> <20100202193413.a497dd9d.ubm.freebsd@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_txJaL5Fl3j+6bE/
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 02 February 2010 01:34 pm, Marc UBM Bocklet wrote:
> On Mon, 1 Feb 2010 16:17:30 -0500
>
> Jung-uk Kim <jkim@freebsd.org> wrote:
> > On Monday 01 February 2010 12:44 pm, Marc UBM Bocklet wrote:
> > > Hiho! :-)
> > >
> > > Recently, I updated to the latest version of 9-current and
> > > found out that I cannot set my console resolution to 800x600
> > > anymore. If I try, it just goes blank or shows a few coloured,
> > > garbled lines in the upper third of my monitor. Starting X11
> > > blindly works, as does switching to X11.
> > >
> > > I'm suspecting the recent tty/xterm changes, but I am not sure.
> > >
> > >
> > > uname -a:
> > >
> > > FreeBSD xxx.yyy 9.0-CURRENT FreeBSD 9.0-CURRENT #17: Sat
> > > Jan 23 14:58:47 CET 2010
> > > sheep@ubm.mine.nu:/usr/obj/usr/src/sys/SUBMARINE_SMP  i386
> > >
> > >
> > > Relevant part of my rc.conf that I used to set console to
> > > 800x600:
> > >
> > > allscreens_flags="-g 100x37 VESA_800x600"
> > >
> > >
> > > Relevant kernel option that I use:
> > >
> > > # VESA support
> > >
> > > options         VESA
> > >
> > > # raster display support for 800x600 resolution
> > >
> > > options         SC_PIXEL_MODE
> > >
> > >
> > > Can anyone point me to a solution / is more info required?
> >
> > Hmm...  The attached patch should restore the previous behavior.
>
> No change, unfortunately. Anything I can provide to help?

How about the attached patch, then?

Jung-uk Kim

--Boundary-00=_txJaL5Fl3j+6bE/
Content-Type: text/plain;
  charset="iso-8859-1";
  name="vesa.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="vesa.diff"

--- sys/dev/fb/vesa.c
+++ sys/dev/fb/vesa.c
@@ -186,7 +186,9 @@ static int vesa_bios_load_palette2(int start, int
 #define STATE_ALL	(STATE_HW | STATE_DATA | STATE_DAC | STATE_REG)
 static ssize_t vesa_bios_state_buf_size(void);
 static int vesa_bios_save_restore(int code, void *p, size_t size);
+#if 0
 static int vesa_bios_get_line_length(void);
+#endif
 static int vesa_bios_set_line_length(int pixel, int *bytes, int *lines);
 #if 0
 static int vesa_bios_get_start(int *x, int *y);
@@ -195,7 +197,6 @@ static int vesa_bios_set_start(int x, int y);
 static int vesa_map_gen_mode_num(int type, int color, int mode);
 static int vesa_translate_flags(u_int16_t vflags);
 static int vesa_translate_mmodel(u_int8_t vmodel);
-static int vesa_get_line_width(video_info_t *info);
 static int vesa_bios_init(void);
 static void vesa_clear_modes(video_info_t *info, int color);
 static vm_offset_t vesa_map_buffer(u_int paddr, size_t size);
@@ -567,6 +568,7 @@ vesa_bios_save_restore(int code, void *p, size_t s
 	return (regs.R_AX != 0x004f);
 }
 
+#if 0
 static int
 vesa_bios_get_line_length(void)
 {
@@ -583,6 +585,7 @@ vesa_bios_get_line_length(void)
 
 	return (regs.R_BX);
 }
+#endif
 
 static int
 vesa_bios_set_line_length(int pixel, int *bytes, int *lines)
@@ -716,37 +719,6 @@ vesa_translate_mmodel(u_int8_t vmodel)
 	return (V_INFO_MM_OTHER);
 }
 
-static int
-vesa_get_line_width(video_info_t *info)
-{
-	int len;
-	int width;
-
-	width = info->vi_width;
-
-	if (info->vi_flags & V_INFO_GRAPHICS)
-		switch (info->vi_depth / info->vi_planes) {
-		case 1:
-			return (width / 8);
-		case 2:
-			return (width / 4);
-		case 4:
-			return (width / 2);
-		case 8:
-			return (width);
-		case 15:
-		case 16:
-			return (width * 2);
-		case 24:
-		case 32:
-			return (width * 4);
-		}
-
-	len = vesa_bios_get_line_length();
-
-	return (len > 0 ? len : width);
-}
-
 #define	VESA_MAXSTR		256
 
 #define	VESA_STRCPY(dst, src)	do {				\
@@ -933,10 +905,14 @@ vesa_bios_init(void)
 		/* XXX window B */
 		vesa_vmode[modes].vi_window_size = vmode.v_wsize*1024;
 		vesa_vmode[modes].vi_window_gran = vmode.v_wgran*1024;
-		if (vmode.v_modeattr & V_MODELFB)
+		if (vmode.v_modeattr & V_MODELFB) {
 			vesa_vmode[modes].vi_buffer = vmode.v_lfb;
-		else
+			vesa_vmode[modes].vi_line_width = vers >= 0x0300 ?
+			    vmode.v_linbpscanline : vmode.v_bpscanline;
+		} else {
 			vesa_vmode[modes].vi_buffer = 0;
+			vesa_vmode[modes].vi_line_width = vmode.v_bpscanline;
+		}
 		/* XXX */
 		vesa_vmode[modes].vi_buffer_size
 			= vesa_adp_info->v_memsize*64*1024;
@@ -987,8 +963,8 @@ vesa_bios_init(void)
 			= vesa_translate_flags(vmode.v_modeattr) | V_INFO_VESA;
 
 		/* Does it have enough memory to support this mode? */
-		bsize = vesa_get_line_width(&vesa_vmode[modes]);
-		bsize *= vesa_vmode[modes].vi_height;
+		bsize = (size_t)vesa_vmode[modes].vi_line_width *
+		    vesa_vmode[modes].vi_height;
 		if (bsize > vesa_vmode[modes].vi_buffer_size) {
 #if VESA_DEBUG > 1
 			printf(
@@ -1322,7 +1298,7 @@ vesa_set_mode(video_adapter_t *adp, int mode)
 		vesa_adp->va_window_gran = info.vi_window_gran;
 	}
 	vesa_adp->va_window_orig = 0;
-	vesa_adp->va_line_width = vesa_get_line_width(&info);
+	vesa_adp->va_line_width = info.vi_line_width;
 	vesa_adp->va_disp_start.x = 0;
 	vesa_adp->va_disp_start.y = 0;
 #if VESA_DEBUG > 0
--- sys/sys/fbio.h
+++ sys/sys/fbio.h
@@ -295,8 +295,10 @@ struct video_info {
     /* for MM_DIRECT only */
     int			vi_pixel_fields[4];	/* RGB and reserved fields */
     int			vi_pixel_fsizes[4];
+    /* XXX for VESA only */
+    int			vi_line_width;
     /* reserved */
-    u_char		vi_reserved[64];
+    u_char		vi_reserved[60];
     vm_offset_t		vi_registers;	/* physical address */
     vm_offset_t		vi_registers_size;
 };

--Boundary-00=_txJaL5Fl3j+6bE/--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002021643.09859.jkim>