Date: Mon, 23 Jun 2008 08:11:10 GMT From: paradox <ddkprog@yahoo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/124902: patch to fix VESA modes and allow 8bit depth modes Message-ID: <200806230811.m5N8BAV2054722@www.freebsd.org> Resent-Message-ID: <200806230820.m5N8K1sC031663@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 124902
>Category: misc
>Synopsis: patch to fix VESA modes and allow 8bit depth modes
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Jun 23 08:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: paradox
>Release: RELENG_7
>Organization:
>Environment:
FreeBSD 7.0-STABLE #3: Sun Jun 22 09:33:03 EEST 2008
root@hack.org.ua:/usr/obj/work/cvsup/freebsd/7.0S/src/sys/KIR
>Description:
on FreeBSD console VESA modes not work
i'am recompile kernel with options
options VESA
options SC_PIXEL_MODE
#reboot
..
as example on my notebook
#vidcontrol -i mode
...
...
273 (0x111) 0x0000000f G 640x480x16 1 8x16 0xa0000 64k 64k 0xe8000000 15168k
274 (0x112) 0x0000000f G 640x480x32 1 8x16 0xa0000 64k 64k 0xe8000000 15168k
276 (0x114) 0x0000000f G 800x600x16 1 8x8 0xa0000 64k 64k 0xe8000000 15168k
277 (0x115) 0x0000000f G 800x600x32 1 8x8 0xa0000 64k 64k 0xe8000000 15168k
279 (0x117) 0x0000000f G 1024x768x16 1 8x16 0xa0000 64k 64k 0xe8000000 15168k
280 (0x118) 0x0000000f G 1024x768x32 1 8x16 0xa0000 64k 64k 0xe8000000 15168k
282 (0x11a) 0x0000000f G 1280x1024x16 1 8x16 0xa0000 64k 64k 0xe8000000 15168k
...
any of this mode not work!
fail or broken screen
>How-To-Repeat:
recompile kernel with options
options VESA
options SC_PIXEL_MODE
vidcontrol -i mode
to lists all support vesa video mode
try to use all graphics mode
>Fix:
Patch attached with submission follows:
--- src/sys/i386/isa/vesa.c.orig 2005-12-05 13:58:33.000000000 +0200
+++ src/sys/i386/isa/vesa.c 2008-06-22 00:52:26.000000000 +0300
@@ -1074,6 +1074,11 @@
(info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0;
vesa_adp->va_crtc_addr =
(vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC;
+
+ vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window);
+ vesa_adp->va_window_size = info.vi_window_size;
+ vesa_adp->va_window_gran = info.vi_window_gran;
+
if (info.vi_flags & V_INFO_LINEAR) {
#if VESA_DEBUG > 1
printf("VESA: setting up LFB\n");
@@ -1083,33 +1088,31 @@
vesa_adp_info->v_memsize*64*1024);
vesa_adp->va_buffer_size = info.vi_buffer_size;
vesa_adp->va_window = vesa_adp->va_buffer;
- vesa_adp->va_window_size = info.vi_buffer_size/info.vi_planes;
- vesa_adp->va_window_gran = info.vi_buffer_size/info.vi_planes;
} else {
vesa_adp->va_buffer = 0;
- vesa_adp->va_buffer_size = info.vi_buffer_size;
- vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window);
- vesa_adp->va_window_size = info.vi_window_size;
- vesa_adp->va_window_gran = info.vi_window_gran;
+ vesa_adp->va_buffer_size = 0;
}
+#if VESA_DEBUG > 1
+ printf("VESA: buffer %x, buffer_size %d, window %x, window_size %d\n",
+ vesa_adp->va_buffer,
+ vesa_adp->va_buffer_size,
+ vesa_adp->va_window,
+ vesa_adp->va_window_size);
+#endif
vesa_adp->va_window_orig = 0;
len = vesa_bios_get_line_length();
- if (len > 0) {
- vesa_adp->va_line_width = len;
- } else if (info.vi_flags & V_INFO_GRAPHICS) {
- switch (info.vi_depth/info.vi_planes) {
- case 1:
- vesa_adp->va_line_width = info.vi_width/8;
- break;
- case 2:
- vesa_adp->va_line_width = info.vi_width/4;
- break;
+ if (info.vi_flags & V_INFO_GRAPHICS) {
+ switch (info.vi_depth) {
case 4:
- vesa_adp->va_line_width = info.vi_width/2;
+ vesa_adp->va_line_width = info.vi_width;
break;
case 8:
- default: /* shouldn't happen */
- vesa_adp->va_line_width = info.vi_width;
+ case 15:
+ case 16:
+ case 24:
+ case 32:
+ default:
+ vesa_adp->va_line_width = info.vi_width * (info.vi_depth / 8);
break;
}
} else {
@@ -1118,8 +1121,8 @@
vesa_adp->va_disp_start.x = 0;
vesa_adp->va_disp_start.y = 0;
#if VESA_DEBUG > 0
- printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n",
- info.vi_width, len, vesa_adp->va_line_width);
+ printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d vi_mem_model:%d\n",
+ info.vi_width, len, vesa_adp->va_line_width, info.vi_mem_model);
#endif
bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info));
--- src/sys/dev/syscons/scvgarndr.c.orig 2008-03-03 02:56:08.000000000 +0200
+++ src/sys/dev/syscons/scvgarndr.c 2008-06-22 01:33:00.000000000 +0300
@@ -193,6 +193,8 @@
case 15: \
writew(pos, vga_palette15[color]); \
break; \
+ case 8: \
+ writeb(pos, (uint8_t)color); \
}
static uint32_t vga_palette32[16] = {
@@ -215,6 +217,7 @@
#ifndef SC_NO_CUTPASTE
static uint32_t mouse_buf32[256];
static uint16_t mouse_buf16[256];
+static uint8_t mouse_buf8[256];
#endif
#endif
@@ -503,7 +506,9 @@
scp->rndr->draw_cursor = vga_pxlcursor_planar;
scp->rndr->blink_cursor = vga_pxlblink_planar;
scp->rndr->draw_mouse = vga_pxlmouse_planar;
- } else if (scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_DIRECT) {
+ } else
+ if (scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_DIRECT ||
+ scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_PACKED) {
scp->rndr->clear = vga_pxlclear_direct;
scp->rndr->draw_border = vga_pxlborder_direct;
scp->rndr->draw = vga_vgadraw_direct;
@@ -1153,6 +1158,7 @@
int i, j;
uint32_t *u32;
uint16_t *u16;
+ uint8_t *u8;
int bpp;
if (!on)
@@ -1184,6 +1190,10 @@
u16 = (uint16_t*)(p + j * pixel_size);
writew(u16, mouse_buf16[i * 16 + j]);
break;
+ case 8:
+ u8 = (uint8_t*)(p + j * pixel_size);
+ writeb(u8, mouse_buf8[i * 16 + j]);
+ break;
}
}
@@ -1219,6 +1229,14 @@
else if (mouse_and_mask[i] & (1 << (15 - j)))
writew(u16, 0);
break;
+ case 8:
+ u8 = (uint8_t*)(p + j * pixel_size);
+ mouse_buf8[i * 16 + j] = *u8;
+ if (mouse_or_mask[i] & (1 << (15 - j)))
+ writeb(u8, 15);
+ else if (mouse_and_mask[i] & (1 << (15 - j)))
+ writeb(u8, 0);
+ break;
}
}
--- src/sys/dev/syscons/scvidctl.c.orig 2008-03-03 02:56:09.000000000 +0200
+++ src/sys/dev/syscons/scvidctl.c 2008-06-22 01:27:10.000000000 +0300
@@ -397,6 +397,10 @@
(info.vi_depth != 15) && (info.vi_depth != 16) &&
(info.vi_depth != 24) && (info.vi_depth != 32))
return ENODEV;
+ } else if (info.vi_mem_model == V_INFO_MM_PACKED) {
+ if (!(info.vi_flags & V_INFO_LINEAR) &&
+ (info.vi_depth != 8))
+ return ENODEV;
} else
return ENODEV;
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806230811.m5N8BAV2054722>
