Date: Tue, 23 Jan 2001 16:00:09 +0200 From: Maxim Sobolev <sobomax@FreeBSD.org> To: yokota@FreeBSD.org, sos@FreeBSD.org Cc: current@FreeBSD.org, audit@FreeBSD.org Subject: [RFC] Configurable text geometry in VESA_800x600 raster text mode Message-ID: <3A6D8E67.8ED56EE5@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------53C3D4175924CB963590EC2D Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Hi, With this message I'm attaching a patch for vidcontrol(1) and vgl(3) to allow a user select his own text geometry (i.e. number of rows and number of columns) in a raster text modes (currently only VESA_800x600 is supported). This should make VESA_800x600 more usable, as the 80x25, which is currently default geometry for this mode, covers only 50% (80 * 16 * 25 * 8 / (800 * 600)) of the usable screen area in this mode. Furthermore, there also should be a possibility to use with raster modes configurable font sizes other than default 16, but unfortunately existing set of console ioctl's doesn't allow to get font size being used currently, so there is no way to restore text console properly after it was switched into a graphics mode. Therefore this feature may be provided later after console ioctl's set has been properly adjusted. -Maxim --------------53C3D4175924CB963590EC2D Content-Type: text/plain; charset=koi8-r; name="vidcontrol.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vidcontrol.diff" Index: libvgl/main.c =================================================================== RCS file: /home/ncvs/src/lib/libvgl/main.c,v retrieving revision 1.8 diff -d -u -r1.8 main.c --- libvgl/main.c 2001/01/13 11:30:16 1.8 +++ libvgl/main.c 2001/01/23 13:09:41 @@ -57,6 +57,7 @@ static int VGLOnDisplay; static unsigned int VGLCurWindow; static int VGLInitDone = 0; +static struct winsize VGLOldWSize; void VGLEnd() @@ -79,8 +80,8 @@ ioctl(0, _IO('V', VGLOldMode - M_VESA_BASE), 0); if (VGLOldMode == M_VESA_800x600) { int size[3]; - size[0] = 80; - size[1] = 25; + size[0] = VGLOldWSize.ws_col; + size[1] = VGLOldWSize.ws_row; size[2] = 16; ioctl(0, KDRASTER, size); } @@ -143,6 +144,11 @@ VGLModeInfo.vi_mode = mode & 0x0ff; if (ioctl(0, CONS_MODEINFO, &VGLModeInfo)) /* FBIO_MODEINFO */ return -1; + + /* If current mode is VESA_800x600 then save its geometry to restore later */ + if ((VGLOldMode >= M_VESA_BASE) && (VGLOldMode == M_VESA_800x600)) + if (ioctl(0, TIOCGWINSZ, &VGLOldWSize)) + return -1; VGLDisplay = (VGLBitmap *)malloc(sizeof(VGLBitmap)); if (VGLDisplay == NULL) Index: vidcontrol/vidcontrol.1 =================================================================== RCS file: /home/ncvs/src/usr.sbin/vidcontrol/vidcontrol.1,v retrieving revision 1.27 diff -d -u -r1.27 vidcontrol.1 --- vidcontrol/vidcontrol.1 2000/11/17 11:44:16 1.27 +++ vidcontrol/vidcontrol.1 2001/01/23 13:09:41 @@ -25,6 +25,7 @@ .Op Fl c Ar appearance .Op Fl d .Op Fl f Ar size Ar file +.Op Fl g Ar geometry .Op Fl i Cm adapter | mode .Op Fl l Ar screen_map .Op Fl L @@ -159,6 +160,18 @@ .Sx EXAMPLES below and the man page for .Xr syscons 4 . +.It Fl g Ar geometry +Set the +.Ar geometry +of the text mode for the modes with selectable +geometry. Currently only raster modes, such as +.Ar VESA_800x600 , +support this option. +See also +.Sx Video Mode Support +and +.Sx EXAMPLES +below. .It Fl s Ar number Set the current vty to .Ar number . @@ -283,6 +296,11 @@ .Pp The above command will load .Pa /usr/share/syscons/scrnmaps/iso-8859-1_to_cp437.scm . +.Pp +The following command will set-up a 100x37 raster text mode (useful for +some LCD models): +.Pp +.Dl vidcontrol -g 100x37 VESA_800x600 .Sh SEE ALSO .Xr kbdcontrol 1 , .Xr vidfont 1 , Index: vidcontrol/vidcontrol.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/vidcontrol/vidcontrol.c,v retrieving revision 1.33 diff -d -u -r1.33 vidcontrol.c --- vidcontrol/vidcontrol.c 2000/10/08 21:34:00 1.33 +++ vidcontrol/vidcontrol.c 2001/01/23 13:09:42 @@ -44,6 +44,10 @@ #include "path.h" #include "decode.h" +#define _VESA_800x600_DFL_COLS 80 +#define _VESA_800x600_DFL_ROWS 25 +#define _VESA_800x600_DFL_FNSZ 16 + char legal_colors[16][16] = { "black", "blue", "green", "cyan", "red", "magenta", "brown", "white", @@ -52,6 +56,8 @@ }; int hex = 0; int number; +int vesa_cols = _VESA_800x600_DFL_COLS; +int vesa_rows = _VESA_800x600_DFL_ROWS; char letter; struct vid_info info; @@ -62,8 +68,8 @@ fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]", " [-i adapter | mode] [-L] [-M char] [-m on|off]", -" [-f size file] [-s number] [-t N|off] [-x] [mode]", -" [fgcol [bgcol]] [show]"); +" [-f size file] [-s number] [-t N|off] [-x] [-g geometry]", +" [mode] [fgcol [bgcol]] [show]"); exit(1); } @@ -318,9 +324,25 @@ if (ioctl(0, mode, NULL) < 0) warn("cannot set videomode"); if (mode == SW_VESA_800x600) { - size[0] = 80; /* columns */ - size[1] = 25; /* rows */ - size[2] = 16; /* font size */ + /* columns */ + if ((vesa_cols * 8 > 800) || (vesa_cols <= 0)) { + warnx("incorrect number of columns: %d", + vesa_cols); + size[0] = _VESA_800x600_DFL_COLS; + } else { + size[0] = vesa_cols; + } + /* rows */ + if ((vesa_rows * _VESA_800x600_DFL_FNSZ > 600) || + (vesa_rows <=0)) { + warnx("incorrect number of rows: %d", + vesa_rows); + size[1] = _VESA_800x600_DFL_ROWS; + } else { + size[1] = vesa_rows; + } + /* font size */ + size[2] = _VESA_800x600_DFL_FNSZ; if (ioctl(0, KDRASTER, size)) { ioerr = errno; if (cur_mode >= M_VESA_BASE) @@ -574,7 +596,7 @@ info.size = sizeof(info); if (ioctl(0, CONS_GETINFO, &info) < 0) err(1, "must be on a virtual console"); - while((opt = getopt(argc, argv, "b:c:df:i:l:LM:m:r:s:t:x")) != -1) + while((opt = getopt(argc, argv, "b:c:df:g:i:l:LM:m:r:s:t:x")) != -1) switch(opt) { case 'b': set_border_color(optarg); @@ -588,6 +610,13 @@ case 'f': load_font(optarg, nextarg(argc, argv, &optind, 'f')); + break; + case 'g': + if (sscanf(optarg, "%dx%d", &vesa_cols, + &vesa_rows) != 2) { + warnx("incorrect geometry: %s", optarg); + usage(); + } break; case 'i': show_info(optarg); --------------53C3D4175924CB963590EC2D-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A6D8E67.8ED56EE5>