Commit Graph

683 Commits

Author SHA1 Message Date
Jung-uk Kim
4a9b63a454 Improve VESA mode switching via loader tunable `hint.sc.0.vesa_mode'.
The most notable change is history buffer is fully saved/restored now.
2010-02-24 20:13:34 +00:00
Jung-uk Kim
8d521790d0 Yet another attempt to make palette loading more safer:
- Add a separate palette data for 8-bit DAC mode when SC_PIXEL_MODE is set
and fill it up with default gray-scale palette data for text.  Now we don't
have to set `hint.sc.0.vesa_mode' to get the default palette data.
- Add a new adapter flag, V_ADP_DAC8 to track whether the controller is
using 8-bit palette format and load correct palette when switching modes.
- Set 8-bit DAC mode only for non-VGA compatible graphics mode.
2010-02-23 21:51:14 +00:00
Ivan Voras
b8bba24e06 The New and Improved snake_server - Service Pack 1: now even more
sensitive to load average variations!
2010-02-23 15:27:07 +00:00
Ivan Voras
c0414ca779 Upgrade the "snake" syscons screensaver to the new, multimedia version!
Now, with color! And system load averages!

Amused by it:	gnn
2010-02-23 15:12:41 +00:00
Robert Noland
cfd7bacef2 Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by:	jhb@
MFC after:	Not in this lifetime...
2009-12-29 21:51:28 +00:00
Ed Schouten
5b19140604 Include <sys/ttydefaults.h>, instead of doing it through <sys/termios.h>.
I want to prevent the header polution of <sys/termios.h> eventually.
2009-11-28 16:25:55 +00:00
Konstantin Belousov
07ff915720 Fix pgsignal() call after signature change in r199355.
Reported and tested by:	bf1783 googlemail com
MFC after:	1 month
2009-11-17 19:24:26 +00:00
Ed Schouten
4b2361f811 Convert syscons on i386 to TERM=xterm.
TEKEN_XTERM is now gone. Because we always use xterm mode now, we only
need a TEKEN_CONS25 switch to go back to cons25.
2009-11-13 11:28:54 +00:00
Ed Schouten
e42fc36867 Switch the default terminal emulation style to xterm for most platforms.
Right now syscons(4) uses a cons25-style terminal emulator. The
disadvantages of that are:

- Little compatibility with embedded devices with serial interfaces.
- Bad bandwidth efficiency, mainly because of the lack of scrolling
  regions.
- A very hard transition path to support for modern character sets like
  UTF-8.

Our terminal emulation library, libteken, has been supporting
xterm-style terminal emulation for months, so flip the switch and make
everyone use an xterm-style console driver.

I still have to enable this on i386. Right now pc98 and i386 share the
same /etc/ttys file. I'm not going to switch pc98, because it uses its
own Kanji-capable cons25 emulator.

IMPORTANT: What to do if things go wrong (i.e. graphical artifacts):

- Run the application inside script(1), try to reduce the problem and
  send me the log file.
- In the mean time, you can run `vidcontrol -T cons25' and `export
  TERM=cons25' so you can run applications the same way you did before.
  You can also build your kernel with `options TEKEN_CONS25' to make all
  virtual terminals use the cons25 emulator by default.

Discussed on:	current@
2009-11-13 05:54:55 +00:00
Ed Schouten
3a8a07eadd Allow Syscons terminal emulators to provide function key strings.
xterm and cons25 have some incompatibilities when it comes to escape
sequences for special keys, such as F1 to F12, home, end, etc. Add a new
te_fkeystr() that can be used to override the strings.

scterm-sck won't do anything with this, but scterm-teken will use
teken_get_sequences() to obtain the proper sequence.
2009-11-11 08:20:19 +00:00
Jung-uk Kim
761eeb5fff Fix VESA color palette corruption:
- VBE 3.0 says palette format resets to 6-bit mode when video mode changes.
We simply set 8-bit mode when we switch modes if the adapter supports it.
- VBE 3.0 also says if the mode is not VGA compatible, we must use VBE
function to save/restore palette.  Otherwise, VGA function may be used.
Thus, reinstate the save/load palette functions only for non-VGA compatible
modes regardless of its palette format.
- Let vesa(4) set VESA modes even if vga(4) claims to support it.
- Reset default palette if VESA pixel mode is set initially.
- Fix more style nits.
2009-11-03 20:22:09 +00:00
Jung-uk Kim
974f3534c0 Search for default 800x600 graphics mode from supported VESA mode list.
Many video controllers do not support 800x600x24 mode any more.
2009-10-23 18:53:21 +00:00
Ed Schouten
53e69c0c2a Add support for VT200-style mouse input.
Right now if applications want to use the mouse on the command line,
they use sysmouse(4) and install a signal handler in the kernel to
deliver signals when mouse events arrive. This conflicts with my plan to
change to TERM=xterm, so implement proper VT200-style mouse input.

Because mouse input is now streamed through the TTY, it means you can
now SSH to another system on the console and use the mouse there as
well. The disadvantage of the VT200 mouse protocol, is that it doesn't
seem to generate events when moving the cursor. Only when pressing and
releasing mouse buttons.

There are different protocols as well, but this one seems to be most
commonly supported.

Reported by:	Paul B. Mahol <onemda gmail com>
Tested with:	vim(1)
2009-09-27 18:19:41 +00:00
Ed Schouten
56a4365bde Add 256 color support.
It is quite inconvenient that if an application for xterm uses 256 color
mode, text suddenly starts to blink (because of ;5; in the middle).
We'd better just implement 256 color mode and add a conversion routine
from 256 to 8 color mode, which doesn't seem to be too bad in practice.

Remapping colors is done quite simple. If one of the channels is most
actively represented, primary colors are used. If two channels are most
actively represented, secondary colors are used. If all three channels
are equal (gray), it picks between black and white.

Reported by:	Paul B. Mahol <onemda gmail com>
2009-09-26 15:26:32 +00:00
Ed Schouten
790dd1b5af Just use ttydisc_rint_simple() instead of doing it ourselves.
This code seems to do exactly the same as ttydisc_rint_simple() does
nowadays. Just remove it.

Obtained from:	//depot/user/ed/newcons/sys/dev/syscons/syscons.c
2009-09-18 15:39:09 +00:00
Ed Schouten
94dc815e34 Make sure we never place the cursor outside the screen.
For some vague reason, it may be possible that scp->cursor_pos exceeds
scp->ysize * scp->xsize. This means that teken_set_cursor() may get
called with an invalid position. Just ignore the old cursor position in
this case.

Reported by:	Paul B. Mahol <onemda gmail com>
MFC after:	1 month
2009-09-13 18:45:59 +00:00
Ed Schouten
87da28e914 Commit a change that I missed in the previous commit.
I ran `svn commit' in sys/teken/, instead of sys/.
2009-09-12 14:46:22 +00:00
Ed Schouten
e06d84fc49 Make 8-bit support run-time configurable.
Now to do the same for xterm support. This means people can eventually
toy around with xterm+UTF-8 without recompiling their kernel.
2009-09-12 10:34:34 +00:00
Xin LI
7ec7f6d5ed Make use of the more flexable device hints by adding a new field,
vesa_mode to specify VESA mode, as suggested by jhb@.
2009-09-12 00:12:47 +00:00
Xin LI
493d6f54bc Extend the usage of sc(4)'s hint variable 'flag'. Bit 0x80 now means
"set vesa mode" and higher 16bits of the flag would be the desired mode.

One can now set, for instance, hint.sc.0.flags=0x01680180, which means
that the system should set VESA mode 0x168 upon boot.

Submitted by:	paradox <ddkprog yahoo com>, swell k at gmail.com with
		some minor changes.
2009-09-11 02:07:24 +00:00
John Baldwin
9425bee7a0 Don't malloc a buffer while holding the prison0 mutex. Instead, use a loop
where we figure out the hostname length under the lock, malloc the buffer
with the lock dropped, then recheck the length under the lock and loop again
if the buffer is now too small.

Tested by:	Norbert Koch  nkoch  demig de
MFC after:	3 days
2009-09-10 12:58:37 +00:00
Xin LI
ee5e90dab2 - Teach vesa(4) and dpms(4) about x86emu. [1]
- Add vesa kernel options for amd64.
 - Connect libvgl library and splash kernel modules to amd64 build.
 - Connect manual page dpms(4) to amd64 build.
 - Remove old vesa/dpms files.

Submitted by:	paradox <ddkprog yahoo com> [1], swell k at gmail.com
		(with some minor tweaks)
2009-09-09 09:50:31 +00:00
Ed Schouten
4a6ecf078b Expose the TF_REVERSE flag to the console driver.
Right now libteken processes TF_REVERSE internally and returns the
toggled colors to the console driver. This isn't entirely correct. This
means that the bold flag is always processed by the foreground color,
while reversing should be done after the foreground color has been set
to a brighter version by the bold flag.

This is no problem with the syscons driver, because with VGA it only
supports 16 foreground and 8 background colors. My WIP console driver
reconfigures the graphics hardware to disable the blink functionality
and uses 16 foreground and 16 background colors. This means that this
driver will handle the TF_REVERSE flag a little different from what
syscons does right now.
2009-09-03 16:31:11 +00:00
Ed Schouten
9b934d0930 Move libteken out of the syscons directory.
I initially committed libteken to sys/dev/syscons/teken, but now that
I'm working on a console driver myself, I noticed this was not a good
decision. Move it to sys/teken to make it easier for other drivers to
use a terminal emulator.

Also list teken.c in sys/conf/files, instead of listing it in all the
files.arch files separately.
2009-09-03 09:33:57 +00:00
Xin LI
c5bebef869 Fix VESA modes and allow 8bit depth modes.
PR:		i386/124902
Submitted by:	paradox <ddkprog yahoo com>
MFC after:	2 months
2009-08-24 22:35:53 +00:00
Ed Schouten
706b8a103a Small fixes to Unicode handling:
- Add more mappings for Greek characters and the Euro sign.
- Print UTF-8 characters in the log file as hexadecimal.
2009-06-16 14:55:13 +00:00
Ed Schouten
324f7abb7f Add more entries to the Unicode-to-CP437 table.
Characters between 0x07 and 0x0d are now also mapped, which means we can
display almost 256 different characters. Also remap certain types of
dashes and quotes, which means we can finally read our manual pages
without red question marks in them.

Submitted by:	Christoph Mallon
2009-06-14 12:04:34 +00:00
Jamie Gritton
c1f192193d Rename the host-related prison fields to be the same as the host.*
parameters they represent, and the variables they replaced, instead of
abbreviated versions of them.

Approved by:	bz (mentor)
2009-06-13 15:39:12 +00:00
Ed Schouten
b32dcb662a Make the proof-of-concept UTF-8 support in Syscons less useless.
Add a small Unicode-to-CP437 remapping table to at least demonstrate
that the terminal emulator is perfectly capable of handling UTF-8. This
will of course break if the user loads a different font map, but it at
least allows people to give it a try.

I can now see the box drawing in dialog(1) and the arrows in mutt(1)
correctly.
2009-06-13 12:23:31 +00:00
Ed Schouten
e8857e9cd4 Make the demo/stress tools build again, after my changes to param(). 2009-06-10 18:26:02 +00:00
Ed Schouten
ec034df134 Restore support for bell pitch/duration.
Because we only support a single argument to tf_param, use 16 bits for
the pitch and 16 bits for the duration. While there, make the argument
unsigned. There isn't a single param call that needs a signed integer.

Submitted by:	danfe (modified)
2009-05-31 19:35:41 +00:00
Jamie Gritton
76ca6f88da Place hostnames and similar information fully under the prison system.
The system hostname is now stored in prison0, and the global variable
"hostname" has been removed, as has the hostname_mtx mutex.  Jails may
have their own host information, or they may inherit it from the
parent/system.  The proper way to read the hostname is via
getcredhostname(), which will copy either the hostname associated with
the passed cred, or the system hostname if you pass NULL.  The system
hostname can still be accessed directly (and without locking) at
prison0.pr_host, but that should be avoided where possible.

The "similar information" referred to is domainname, hostid, and
hostuuid, which have also become prison parameters and had their
associated global variables removed.

Approved by:	bz (mentor)
2009-05-29 21:27:12 +00:00
Ed Schouten
c5e30cc02b Last minute TTY API change: remove mutex argument from tty_alloc().
I don't want people to override the mutex when allocating a TTY. It has
to be there, to keep drivers like syscons happy. So I'm creating a
tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex()
should eventually be removed.

The advantage of this approach, is that we can just remove a function,
without breaking the regular API in the future.
2009-05-29 06:41:23 +00:00
Ed Schouten
983d12f39b Turn consolectl into a simple device node, not a TTY.
Apart from the 16 virtual terminals, Syscons allocates two device nodes
that should not really be TTYs, even though they are. One of them is
consolectl. In RELENG_7 and before, these device nodes are used in
single user mode. After I simplified input path, we only use this device
node to call ioctl() on (moused, Xorg, vidcontrol).

When you call ioctl() on consolectl, it will behave the same as being
called on the first window.
2009-05-15 14:30:37 +00:00
Maksim Yevmenkin
af60af2dc0 Remove obsolete/bogus layering.
Reviewed by:	freebsd-current@, freebsd-hackers@
MFC after:	1 week
2009-04-09 18:22:51 +00:00
Ed Schouten
d50321fd3a Small cleanup to previous commit.
Just use % 8, instead of & 0x7. This makes it easier to understand.
2009-03-20 14:32:51 +00:00
Ed Schouten
3e1720f5e0 Just use default behaviour on tabstops when using too many columns.
It seems I didn't fix this issue before committing teken to the tree. My
initial idea was to somehow add an error mechanism to instruct the video
driver author to increase T_NUMCOL when using very big terminals. It
turns out we have platforms where we have gigantic consoles on systems
like the Apple PowerMac G5, which means we crash there right now.

Just ignore tabstops placed beyond column 160. Just force tabs to be
placed on each 8 columns.

Reported by:	nwhitehorn
2009-03-20 14:31:08 +00:00
Ed Schouten
630b9bf23f Make a 1:1 mapping between syscons stats and terminal emulators.
After I imported libteken into the source tree, I noticed syscons didn't
store the cursor position inside the terminal emulator, but inside the
virtual terminal stat. This is not very useful, because when you
implement more complex forms of line wrapping, you need to keep track of
more state than just the cursor position.

Because the kernel messages didn't share the same terminal emulator as
ttyv0, this caused a lot of strange things, like kernel messages being
misplaced and a missing notification to resize the terminal emulator for
kernel messages never to be resized when using vidcontrol.

This patch just removes kernel_console_ts and adds a special parameter
to te_puts to determine whether messages should be printed using regular
colors or the ones for kernel messages.

Reported by:	ache
Tested by:	nyan, garga (older version)
2009-03-10 11:28:54 +00:00
Ed Schouten
8ddd1f723d Don't call into the TTY layer when inside kdb.
We should just leave the underlying TTY objects alone when scrolling
around in KDB. It should be handled by Syscons exclusively.

Reported by:	pluknet gmail com
2009-03-09 19:46:19 +00:00
Ed Schouten
1356a0807f Remove unneeded variable assignment.
The ts variable is always initialized a few lines below.

Found by:	LLVM scan-build
2009-02-26 12:02:38 +00:00
Ed Schouten
3b31c19691 Properly implement GIO_ATTR and CONS_GETINFO.
It seems I didn't implement these two ioctl()'s properly, which meant
vidcontrol couldn't properly obtain certain terminal parameters.
2009-02-09 15:55:21 +00:00
Ed Schouten
2dfc3551a6 Add Unicode rendering to the teken demo application.
Some time ago I tried adding Unicode rendering to the teken demo
application, but I didn't get it working. It seems I forgot to call
setlocale(). Polish this code and make sure it doesn't get lost.

Also a small fix for my previous commit: all Unicode characters in
teken_boxdrawing are below 0x10000, so store them as 16-bit values.
2009-01-21 19:43:10 +00:00
Ed Schouten
4873b07e2a Properly implement the VT100 SCS sequences in xterm-mode.
Even though VT100-like devices can display non-ASCII characters, they do
not use an 8-bit character set. Special escape sequences allow the VT100
to switch character maps. The special graphics character set stores the
box drawing characters, starting at 0x60, ending at 0x7e. This means
we now pass the character map tests in vttest, even the save/restore
cursor test, combined with character maps. dialog(1) also works a lot
better now.

This commit also includes some other minor fixes:

- Default to 24 lines in teken_demo when using xterm emulation.
- Make white foreground and background work in teken_demo.
2009-01-20 11:34:28 +00:00
Ed Schouten
fcf1ff110a Don't forget to mark the color translation array as const.
Spotted by:	Christoph Mallon <christoph mallon gmx de>
2009-01-18 09:44:33 +00:00
Ed Schouten
6cecf41bf7 Fix for my previous commit: color mapping is not 1:1.
Cons25 doesn't seem to use a straight 1:1 mapping to the ANSI colors,
but uses the same color numbers as at least used by syscons on i386. I
suspect if you change the definitions on a different architecture,
things may break? Not sure.

Add a small array to convert syscons-style color codes to ANSI
equivalents, which are used by libteken internally. I didn't notice this
bug, because I only tested my code with black, white and green, all of
them shared the same numbers.
2009-01-17 23:01:40 +00:00
Ed Schouten
ec9037a258 Make vidcontrol's color setting work again.
It turns out I forgot to implement two escape sequences that allows the
user to change the default foreground and background colors. I thought
they were implemented by syscons itself, but vidcontrol just generates
some escape sequences, which get interpreted by the terminal emulator.

Reported by:	mgp (forums)
2009-01-17 22:53:53 +00:00
Ed Schouten
83409a55ec Allow experimental libteken features to be tested without changing code.
The teken library already supports UTF-8 handling and xterm emulation,
but we have reasons to disable this right now. Because we should make it
easy and interesting for people to experiment with these features, allow
them to be set in kernel configuration files.

Before this commit we had a flag called `TEKEN_CONS25' to enable
cons25-style emulation. I'm calling it the opposite now, `TEKEN_XTERM',
because we want to enable it in kernel configuration files explicitly.

Requested by:	kib
2009-01-17 16:37:13 +00:00
Ed Schouten
2056b4c79b Import yet some more small fixes to libteken sources:
- Implement NP (ASCII 12, Form Feed). When used with cons25, it should
  clear the screen and place the cursor at the top of the screen. When
  used with xterm, it should just simulate a newline.

- When we want to use xterm emulation, make teken_demo set TERM to
  xterm.

Spotted by:	Paul B. Mahol <onemda@gmail.com>
2009-01-05 22:09:46 +00:00
Ed Schouten
1259994283 Fix rendering glitch in cons25 emulation.
Because we now have cons25-style linewrapping, we must also use cons25-
style reverse linewrapping. This means that a ^H on column 0 will move
the cursor one line up.

Also fix a small regression: if the user invokes a RIS (Reset to Initial
State), we must show the cursor again.

Spotted by:	Paul B. Mahol <onemda gmail com>
2009-01-04 22:24:47 +00:00
Ed Schouten
67ac7fd748 Print control characters, even though they are normally not visible.
With cons25, there are printable characters below 0x1B. This is not the
case with ASCII, UTF-8, etc. but in this case we just have to.

Also don't set LC_CTYPE to UTF-8 when libteken is compiled without UTF-8
in the demo-application.
2009-01-04 00:20:18 +00:00