Commit Graph

304 Commits

Author SHA1 Message Date
Aleksandr Rybalko
dd0de63eab Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
Reviewed by:	dumbbell (as D755)
MFC after:	1 week
2014-09-12 14:14:50 +00:00
Aleksandr Rybalko
2204db863d Remove stray whitespaces. 2014-09-12 14:07:20 +00:00
Aleksandr Rybalko
f7f6c6024d Fix one more spelling mistake.
Pointed by:	danfe
2014-09-10 11:48:13 +00:00
Aleksandr Rybalko
13c6f8a053 spelling fixes
Submitted by:	"Sam Fourman Jr." <sfourman@gmail.com>
MFC after:	1 week
2014-09-10 11:27:33 +00:00
Aleksandr Rybalko
ab763ff846 o Add sysctls to enable/disable potentially dengerous key combinations, like
reboot/halt/debug.
o Add support for most key combinations supported by syscons(4).

Reviewed by:	dumbbell, emaste (prev revision of D747)
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2014-09-10 11:13:13 +00:00
Aleksandr Rybalko
8a6a589219 Revert r269474. Special keyboard combinations should be handled by separate
sysctls.
2014-09-09 14:18:56 +00:00
Jean-Sébastien Pédron
313ef9368f vt(4): Change the terminal and buffer sizes, even without a font
This fixes a bug where scroll lock would not work for tty #0 when using
vt_vga's textmode. The reason was that this window is created with a
static 256x100 buffer, larger than the real size of 80x25.

Now, in vt_change_font() and vt_compute_drawable_area(), we still
perform operations even of the window has no font loaded (this is the
case in textmode here vw->vw_font == NULL). One of these operation
resizes the buffer accordingly.

In vt_compute_drawable_area(), we take the terminal size as is (ie.
80x25) for the drawable area.

The font argument to vt_set_border() is removed (it was never used) and
the code now uses the computed drawable area instead of re-doing its own
calculation.

Reported by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
Tested by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
MFC after:	3 days
2014-09-08 07:37:03 +00:00
Jean-Sébastien Pédron
6cbf3f62e0 vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode
MFC after:	3 days
2014-09-05 18:11:39 +00:00
Jean-Sébastien Pédron
ba572d1a95 vt(4): Indicate that KDSETRAD case falls through the next case
CID:		1229953
MFC after:	1 week
2014-08-29 08:20:03 +00:00
Jean-Sébastien Pédron
b7fe496196 vt(4): Change vb_history_size from "int" to "unsigned int"
CID:		1230002, 1230003
MFC after:	1 week
2014-08-29 08:16:31 +00:00
Jean-Sébastien Pédron
fa2694eec8 vt(4): If the terminal shrinks, make sure the mouse is inside the new area
MFC after:	1 week
2014-08-27 17:16:52 +00:00
Jean-Sébastien Pédron
84d623c61e vt(4): Fix mouse cursor handling in vt_fb/creator_vt/ofwfb
There were two issues:
    1. The area given to vt_is_cursor_in_area() was adding the drawable
       area offset, something already handled by this function.
    2. The cursor was shifted on the screen by the offset of this area
       and thus was misplaced or not erased. Furthermore, when reaching
       the bottom or right borders, the cursor was either totally
       removed or not erased correctly.

MFC after:	1 week
2014-08-27 15:10:28 +00:00
Jean-Sébastien Pédron
c0b72c11ea vt(4): Recompute the drawable area when the resolution changes
This was only done when the font changed.

MFC after:	1 week
2014-08-27 11:27:48 +00:00
Jean-Sébastien Pédron
fba582e5f4 vt(4): Pause the vt_flush() timer when the screen is up-to-date
The timer is restarted whenever a window buffer is marked as dirty or
the mouse cursor moves.

There's still room for improvement. For instance, we should not mark a
window buffer as dirty when this window isn't displayed.

Review:		https://reviews.freebsd.org/D683
Reviewed by:	ray@
Approved by:	ray@
MFC after:	1 week
2014-08-27 11:08:09 +00:00
Jean-Sébastien Pédron
3e206539a1 vt(4): Add cngrab() and cnungrab() callbacks
They are used when a panic occurs or when entering a DDB session for
instance.

cngrab() forces a vt-switch to the console window, no matter if the
original window is another terminal or an X session. However, cnungrab()
doesn't vt-switch back to the original window currently.

MFC after:	1 week
2014-08-27 10:04:10 +00:00
Jean-Sébastien Pédron
d3773c6e8e vt(4): Implement basic support for KDSETMODE ioctl
With the current implementation, this allows an X11 server to tell
the console it switches a particular window in "graphics mode". This
information is used by the mouse handling code to ignore sysmouse events
in the window taken by the X server: only him should receive those
events.

Reported by:	flo@, glebius@, kan@
Tested by:	flo@
Reviewed by:	kan@
MFC after:	1 week
2014-08-27 09:34:41 +00:00
Jean-Sébastien Pédron
cb81897a72 vt(4): When creating a window buffer, fill it entirely
... not just the visible part.

This fixes a bug where, when switching from eg. vt_vga to vt_fb (ie. the
resolution goes up), the originally hidden, uninitialized area of the
buffer is displayed on the screen. This leads to a missing text cursor
when it's over an unitialized area.

This was also visible when selecting text: the uninitialized area was
not highlighted.

Internally, this area was zeroed: characters were all 0x00000000,
meaning the foreground and background color was black. Now, everything
is filled with a space with a gray foreground color, like the visible
area.

While here, remove the check for the mute flag and always use
TERMINAL_NORM_ATTR as the character attribute (ie. gray foreground,
black background).

MFC after:	1 week
2014-08-26 17:48:05 +00:00
Jean-Sébastien Pédron
af9f67ea3d vt_vga: Use Write Mode 0 to draw group of 8 pixels using 3 or more colors
This replaces the method based on Write Mode 3, which required reads
from the video memory to load the latches.

MFC after:	1 week
2014-08-25 20:15:19 +00:00
Jean-Sébastien Pédron
a8ca6ae235 vt(4): Intialize drawable area rectangle each time a font is loaded
This also fixes a problem where early in boot, the area was zero,
leading to nothing displayed for a few seconds.

MFC after:	1 week
2014-08-25 19:52:13 +00:00
Jean-Sébastien Pédron
83fbb296a9 vt(4): Store a rectangle for the drawable area, not just the top-left corner
This allows backends to verify they do not draw outside of this area.
This fixes a bug in vt_vga where the text was happily drawn over the
right and bottom margins, when using the Gallant font.

MFC after:	1 week
2014-08-25 19:06:31 +00:00
Jean-Sébastien Pédron
7e802e4968 vt(4): The cursor coordinates are relative to the drawn area
... not the whole screen. Don't use font offsets in
vt_mark_mouse_position_as_dirty().

This fixes a bug where the mouse position wasn't marked as dirty when
approaching the borders of the drawn area.

MFC after:	1 week
2014-08-25 17:08:38 +00:00
Jean-Sébastien Pédron
0878762c5b vt(4): Take font offset into account in vt_is_cursor_in_area()
This fixes a "General protection fault" in vt_vga, where
vt_is_cursor_in_area() erroneously reported that the cursor was over the
text. This led to negative integers stored in "unsigned int" and chaos.

MFC after:	1 week
2014-08-25 16:56:33 +00:00
Jean-Sébastien Pédron
7e1770a7bb vt_vga: Fix the display of the splash screen
MFC after:	1 week
2014-08-24 14:39:33 +00:00
Jean-Sébastien Pédron
b0187490a8 vt(4): Fix order of arguments (x <-> y) when showing the splash screen
MFC after:	1 week
2014-08-24 09:47:39 +00:00
Jean-Sébastien Pédron
9de6b2c587 vt(4): Remove vd_bitbltchr_t
It's replaced by vd_bitblt_text_t, which gives more context to the
backend and allows it to perform more efficiently when redrawing a given
area.

MFC after:	1 week
2014-08-24 09:22:03 +00:00
Jean-Sébastien Pédron
631bb572ba vt(4): Add vd_bitblt_bmp_t callback
The code was already there in all backends, we just expose it. This is
used to display the splash screen.

MFC after:	1 week
2014-08-23 20:35:33 +00:00
Jean-Sébastien Pédron
5a7d2743bf ofwfb: Implement vd_bitblt_text_t
MFC after:	1 week
2014-08-23 15:05:11 +00:00
Jean-Sébastien Pédron
c285e4a5e9 vt_fb: Implement vd_bitblt_text_t for vt_fb and derivatives
MFC after:	1 week
2014-08-23 15:00:47 +00:00
Jean-Sébastien Pédron
946d0288f2 vt(4): Fix cursor handling in vt_flush()
There were situations where the cursor was not erased/redrawn or its
position was marked as dirty even though it's not displayed. The code is
now more straightforward.

At the same, add a function to determine if the cursor covers a given
area. This is used by backends to know if they need to draw the cursor.

This new function should be paired with a new state in struct vt_device,
called vd_mshown, which indicates if the cursor should be displayed.
This again simplifies vd_bitblt_text_t callback's API.

MFC after:	1 week
2014-08-23 11:46:52 +00:00
Jean-Sébastien Pédron
835ceac677 vt(4): Fix a crash in vt_mark_mouse_position_as_dirty() when in textmode
In textmode, no font is loaded, thus the page fault in
vt_mark_mouse_position_as_dirty() when it wants the font width/height.

For now, create a fake area for the textmode. This needs to be modified
if vt_vga gains mouse support in textmode.

While here, fix a build failure when SC_NO_CUTPASTE is defined:
vt_mark_mouse_position_as_dirty() must not be included in this case.

MFC after:	1 week
2014-08-23 07:41:08 +00:00
Jean-Sébastien Pédron
81788a2b59 vt_vga: Give only the character part of term_char_t to vga_get_cp437()
This fixes a bug where vga_get_cp437() was called with an invalid
argument. The screen was then filled with '?' instead of the actual
character.

MFC after:	1 week
2014-08-23 07:02:57 +00:00
Jean-Sébastien Pédron
1f9c1db5f5 vt(4): Remove "FIXME" about multiple locking of vt_buf in vt_flush()
After some testing, it appears that acquiring the lock once and keeping
it longer is slower than taking it multiple times.

While here, fix a typo in another comment.

MFC after:	1 week
2014-08-22 17:49:24 +00:00
Jean-Sébastien Pédron
82276bbb00 vt(4): Use the actual size of the mouse when marking its position as dirty
This fixes a bug where part of the cursor was not erased.

MFC after:	1 week
2014-08-22 17:09:31 +00:00
Jean-Sébastien Pédron
523473b8f7 vt_vga: Remove a "FIXME" comment; the issue was solved in r270338
MFC after:	1 week
2014-08-22 17:05:41 +00:00
Jean-Sébastien Pédron
15c6d8f590 vt(4): Don't run vt_set_border() and vt_flush() concurrently
In the case of vt_vga, the two concurrent calls were writing to the same
VGA registers, causing incorrect refresh of the screen.

MFC after:	1 week
2014-08-22 16:30:26 +00:00
Jean-Sébastien Pédron
ccd5615a33 vt(4): The offset to center the text area is per-window now
The previous global offset, based on the last loaded font, had no
meaning for other windows. This caused a shifted text area, often partly
out-of-screen.

MFC after:	1 week
2014-08-22 15:36:57 +00:00
Jean-Sébastien Pédron
ab06c77688 vt(4): Give the window to vd_bitblt_text_t callback
... instead of both the buffer and the font. Again, this simplifies the
API.

MFC after:	1 week
2014-08-22 15:16:41 +00:00
Jean-Sébastien Pédron
3235c9eb55 vt(4): Store cursor bitmap & colors in struct vt_device
This removes the need to specify them to each call to vd_bitblt_text_t
and, therefore, simplifies the API.

MFC after:	1 week
2014-08-22 14:31:53 +00:00
Jean-Sébastien Pédron
e2eb041785 vt(4): Mark new mouse position as dirty only when it's actually displayed
MFC after:	1 week
2014-08-22 13:48:33 +00:00
Jean-Sébastien Pédron
37fcd2911e vt_vga: Clip the draw area to never draw offscreen
This fixes a bug when two windows use different fonts, but a longer-term
solution is required. The dirty area should be stored as pixels, not
character cells, because such coordinates don't have the same meaning in
all windows, when using different fonts.

MFC after:	1 week
2014-08-22 10:49:51 +00:00
Jean-Sébastien Pédron
bdcaf97c3e vt(4): Add new vd_bitblt_text_t callback, and implement it for vt_vga
Compared to the deprecated vd_bitbltchr_t callback, vd_bitblt_text_t
receives:
    o  the whole text buffer
    o  the dirty area
    o  the mouse cursor (map, position, colors)

This allows the backend to perform optimization on how to draw things.
The goal is to remove vd_bitbltchr_t and vd_putchar_t, once all driver
are converted (only vt_vga is included in this commit).

In vt_vga, this allows to draw the text and the cursor in one pass,
without ever reading from video memory (because it has all the context).
The main benefit is the speed improvement: no more slideshow during
boot!

Other bugs fixed in vt_vga are:
    o  left-most characters are drawn properly (the left-most pixels were
       missing with bold characters and some wide letters such as 'm')
    o  no more black square around the cursor
    o  no cursor flickering when the text is scrolling

There are still many problems to fix: the known issues are marked with
"FIXME" inside the code.

MFC after:	1 week
2014-08-22 08:22:40 +00:00
Jean-Sébastien Pédron
0c1c6af438 vt_vga: When clearing video memory, don't read from it
The goal is to clear the video memory, in case an application drew to
it. So the content shouldn't be loaded in the latches, it can't be
trusted anyway.

This improves a bit the window switch speed.

MFC after:	1 week
2014-08-21 20:10:05 +00:00
Jean-Sébastien Pédron
02ebdd502d vt(4): Rename the "mouse_cursor" structure to "vt_mouse_cursor"
At the same time, "w" and "h" members are now called "width" and
"height". The goal is to have a more "public" structure, because it will
soon be passed as argument to a new callback, replacing vd_bitbltchr_t.

MFC after:	1 week
2014-08-21 19:42:24 +00:00
Jean-Sébastien Pédron
943c702a1b vt(4): Test if the cursor is shown only once
Later, we just see if the "struct mouse_cursor" pointer is set. This
avoids the need to mess with all the conditions several times; this has
been error prone.

While here, rename the variable "m" to a more meaningful "cursor", like
it's done elsewhere in the code.

MFC after:	1 week
2014-08-21 19:15:22 +00:00
Jean-Sébastien Pédron
c6e1a98786 vt(4): Constify vt_buf argument of vtbuf_iscursor()
MFC after:	1 week
2014-08-21 18:26:32 +00:00
Jean-Sébastien Pédron
52ff33d967 vt(4): Pause the flush timer while swithing window
This fixes bad looking refresh when switching window: squares instead
of text, flashing screen, and so on. In the worst case, vt_flush() came
at a very inappropriate timing and the screen was not refreshed at all
(leaving squares all over the place).

This doesn't fix the flickering of the screen with vt_vga, because the
sync signal is temporarily stopped and the video memory is cleared.

MFC after:	1 week
2014-08-21 15:55:18 +00:00
Jean-Sébastien Pédron
353ad09fad vt(4): Mark cursor position as dirty when we enable/disable it
MFC after:	1 week
2014-08-21 15:14:54 +00:00
Jean-Sébastien Pédron
7e6dfdd6e5 vt(4): Mark the current cursor position as dirty
Like r270273, this has no effect for now, because the cursor is always
drawn. This is in preparation of future changes to vd_bitbltchr_t API.

MFC after:	1 week
2014-08-21 15:00:21 +00:00
Jean-Sébastien Pédron
608b7ceace vt(4): If the cursor didn't move, don't mark its position as dirty
Currently, this has no effect, because the cursor is always redrawn
anyway. But this will be useful after improvements to the vd_bitbltchr_t
callback API.

The vt_device structure members used to store the position of the cursor
as of the last redraw are renamed from vd_mdirty{x,y} to vd_mold{x,y}.
The associated comment is fixed too. Also, their value is now expressed
in pixels, not in character columns/row.

MFC after:	1 week
2014-08-21 14:54:37 +00:00
Jean-Sébastien Pédron
e861fb376a vt(4): If the cursor is globally disabled, don't mark its position as dirty
This avoids unnecessary redraw. In particular, during boot, where the
cursor is disabled and its fake position is [0;0], this triggered a
refresh of the whole screen each time vt_flush() is called.

MFC after:	1 week
2014-08-21 14:12:11 +00:00
Jean-Sébastien Pédron
c5dabe0780 vt(4): Mark cursor old position as dirty before reading the dirty area
Otherwise, the redraw is done during the next vt_flush run.

MFC after:	1 week
2014-08-21 13:28:48 +00:00
Jean-Sébastien Pédron
c4ad232a03 vt(4): Handle global and per-window mouse cursor toggle in one place
Before the global flag was set/unset using the CONS_MOUSECTL ioctl, and
the per-window flag through the MOUSE_SETLEVEL or MOUSE_SETMODE ioctls.

Also, if the cursor is already enabled/disabled, return immediatly. This
avoids to reset the cursor's position to the center of the screen.

This matches syscons' behavior.

While here, remove a trailing space and a redundant variable
declaration.
2014-08-21 13:04:34 +00:00
Jean-Sébastien Pédron
a5d099afa9 vt(4): Fix an inconsistency between the mouse cursor bitmap and its mask
MFC after:	1 week
2014-08-21 10:54:39 +00:00
Jean-Sébastien Pédron
19e2ce2d83 vt(4): Colors are indexed against a console palette, not a VGA palette
Rename vt_generate_vga_palette() to vt_generate_cons_palette() and
change it to build a palette where the color index is the same than in
terminal escape codes, not the VGA index. That's what TCHAR_CREATE()
uses and passes to vt(4).

The main differences between both orders are:
    o  Blue and red are swapped (1 <-> 4)
    o  Yellow and cyan are swapped (3 <-> 6)

The problem remained unnoticed, because the RGB bit indexes passed to
vt_generate_vga_palette() were reversed. This inversion was cancelled
by the colors inversions in the generated palette. For instance, red
(0xff0000) and blue (0x0000ff) have bytes in opposite order, but were
swapped in the palette. But after changing the value of blue (see last
paragraph), the modified color was in fact the red one.

This commit includes a fix to creator_vt.c, submitted by Nathan
Whitehorn: fb_cmsize is set to 16. Before this, the generated palette
would be overwritte. This fixes colors on sparc64 with a Creator3D
adapter.

While here, tune the palette to better match console colors and improve
the readability (especially the dark blue).

Submitted by:	nwhitehorn (fix to creator_vt.c)
MFC after:	1 week
2014-08-10 17:04:10 +00:00
Jean-Sébastien Pédron
00c33067e1 vt(4): Add vtbuf_dirty*_locked() to lock vtbuf once, not twice
In several functions, vtbuf_putchar() in particular, the lock on vtbuf
is acquired twice:
    1. once by the said functions;
    2. once in vtbuf_dirty().

Now, vtbuf_dirty_locked() and vtbuf_dirty_cell_locked() allow to
acquire that lock only once.

This improves the input speed of vt(4). To measure the gain, a
50,000-lines file was displayed on the console using cat(1). The time
taken by cat(1) is reported below:
    o  On amd64, with vt_vga:
        - before: 1.0"
	- after:  0.5"
    o  On sparc64, with creator_vt:
        - before: 13.6"
	- after:  10.5"

MFC after:	1 week
2014-08-10 15:02:51 +00:00
Nathan Whitehorn
0f3ec4da2f Retire vd_maskbitbltchr. The same functionality can be obtained by testing
for mask != NULL in vd_bitbltchr, which all implementations of vd_bitbltchr()
were doing anyway.
2014-08-07 21:00:16 +00:00
Nathan Whitehorn
f051baa008 Set fb_pbase properly on PowerPC in the case where we have to guess at
the right register bank for the framebuffer. Disable the assigned-addresses
path on SPARC since it is just a hack for IBM PPC systems and was neither
relevant for nor worked on SPARC anyway.
2014-08-06 18:13:09 +00:00
Nathan Whitehorn
9ed297c83c Retire various intertwined bits of fbd(4) and vt_fb, in particular the
pixel modification indirection. No actual drivers use it and those that
might (e.g. creatorfb) use custom implementations of vd_bitbltchr().
2014-08-06 00:35:48 +00:00
Aleksandr Rybalko
45dc370059 Allow to disable some special key combinations handled by vt(4), like debug
request, reboot request.

Requested by:	Claude Buisson

Sponsored by:	The FreeBSD Foundation
2014-08-03 13:07:25 +00:00
Aleksandr Rybalko
34cb8c9fb5 Fix vt_vga driver to draw not-8-bit-aligned fonts correctly.
Still one bug here: mouse left some gaps on track when moving left.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-08-03 11:01:35 +00:00
Nathan Whitehorn
2661dd32df Don't assume that the framebuffer driver is using vt_fb_blank() when blanking
the screen during init.

MFC after:	1 week
2014-08-02 17:45:08 +00:00
Nathan Whitehorn
232490c660 Make mmap() of the console device when using ofwfb work like other supported
framebuffer drivers. This lets ofwfb work with xf86-video-scfb and makes
the driver much more generic and less PCI-centric. This changes some
user-visible behavior and will require updates to the xorg-server port
on PowerPC when using ATI graphics cards.
2014-07-29 23:11:05 +00:00
Aleksandr Rybalko
eeadf17a21 Revise font initialization handling.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:41:22 +00:00
Aleksandr Rybalko
ba5c073ae3 Update comments.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:37:59 +00:00
Aleksandr Rybalko
5cc762d4c0 Remove special handling of console window size. It's done in vt_upgrade() for
all windows.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:35:21 +00:00
Aleksandr Rybalko
9a0f8af7d4 Avoid embedding buffers into static virtual terminal window.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:22:34 +00:00
Aleksandr Rybalko
8b1932a845 o Remove useless debug string.
o Fix indent.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:15:41 +00:00
Aleksandr Rybalko
3f71a6b88a Remove unused macro VT_CONSDEV_DECLARE. Join console device now declared in one
place.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-07-28 14:14:33 +00:00
Ed Maste
4a87818e07 Hide syscons-specific workaround under DEV_SC
This change is a bit ugly, but so is the coupling between the i915
driver and syscons.  It isn't worth developing a more elegant solution
only to support the legacy syscons console.
2014-07-21 16:38:05 +00:00
Nathan Whitehorn
35e6436e38 Fix embarassing typos I made.
Submitted by:	rayddteam
2014-07-17 12:47:34 +00:00
Nathan Whitehorn
351e92cc2d Allow efifb to be used with xf86-video-scfb. This is important for EFI
systems without either a CSM or real graphics drivers, such as my Lenovo
Haswell laptop.

This provides working X with the small complication of a console cursor
permanently overlaid on the upper-left corner of the screen that will be
dealt with later.

Also remove some redundant screen clearing.
2014-07-16 18:52:21 +00:00
Nathan Whitehorn
60d7ea3d32 Allow console drivers active from early boot to be used with xf86-video-scfb,
rather than only drivers attached later on. This involves a small amount of
code duplication with dev/fb/fbd.c, which will fixed later on.

Also improve performance of vt_blank() by making it not read from the
framebuffer unnecessarily.
2014-07-16 18:49:46 +00:00
Nathan Whitehorn
b85beee188 On my Lenovo laptop, the firmware maps the EFI framebuffer with MTRRs set
to uncacheable. This leads to execrable console performance. Once PMAP is
up, remap the framebuffer as write-combining. This reduces boot time on my
laptop by 60% when booting with EFI.

MFC after:	2 weeks
2014-07-14 17:42:22 +00:00
Aleksandr Rybalko
97f3c4e8a4 Fix inconsistent token parameters for kbd_allocate() and kbd_release() in vt(4).
PR:		191306
Submitted by:	jau789@gmail.com
Sponsored by:	The FreeBSD Foundation
2014-07-09 14:36:03 +00:00
Marcel Moolenaar
e7d939bda2 Remove ia64.
This includes:
o   All directories named *ia64*
o   All files named *ia64*
o   All ia64-specific code guarded by __ia64__
o   All ia64-specific makefile logic
o   Mention of ia64 in comments and documentation

This excludes:
o   Everything under contrib/
o   Everything under crypto/
o   sys/xen/interface
o   sys/sys/elf_common.h

Discussed at: BSDcan
2014-07-07 00:27:09 +00:00
Nathan Whitehorn
00cf40b0ca Use common vt_fb parts in ofwfb as far as we are able without sacrificing
performance.

MFC after:	2 weeks
2014-07-07 00:12:18 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Marius Strobl
7344ee184b In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to
SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the
default colors of normal and kernel text respectively.
Note on the naming: Although affecting the output of vt(4), technically
kern/subr_terminal.c is primarily concerned with changing default colors
so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR.
Actually, if the architecture and abstraction of terminal+teken+vt would
be perfect, dev/vt/* wouldn't be touched by this commit at all.

Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-06-27 19:57:57 +00:00
Ed Maste
59644098f8 Use a common tunable to choose between vt(4)/sc(4)
With this change and previous work from ray@ it will be possible to put
both in GENERIC, and have one enabled by default, but allow the other to
be selected via the loader.

(The previous implementation had separate kern.vt.disable and
hw.syscons.disable tunables, and would panic if both drivers were
compiled in and neither was explicitly disabled.)

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-06-27 17:50:33 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Aleksandr Rybalko
b229e4727b Suspend vt(4) initialization if "kern.vt.disable" kenv is set.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-06-18 22:30:22 +00:00
Aleksandr Rybalko
c358638038 syscons(4) and vt(4) can be built together now.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-06-18 22:18:58 +00:00
Aleksandr Rybalko
a401c53acb Rename vt(4) vga module to dismiss interference with syscons(4) vga module.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-06-18 22:10:10 +00:00
Ed Maste
4163c83ff6 Correct unicode map for VGA ROM character 0x0e
The character is a beamed pair of sixteenth notes, so should be U+266C
not U+266B (beamed eighth notes).
2014-06-10 01:19:48 +00:00
Ed Maste
44a63e4aec Clarify statement on font origin
Submitted by:	Dimitar Zhekov
2014-06-06 18:32:05 +00:00
Ed Maste
29743a4117 Update vt(4) "Terminus BSD Console" font
"Terminus BSD Console" is a derivative of Terminus that is provided
by Mr. Dimitar Zhekov under the 2-clause BSD license for use by the             FreeBSD vt(4) console.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-06-05 13:49:37 +00:00
Ed Maste
733301bf97 Remove extra copy of old email address.
MFC after:	3 days
2014-06-04 20:05:52 +00:00
Ed Maste
6f7ba220bc Update vt(4) console font author's email address
MFC after:	3 days
2014-06-04 19:42:47 +00:00
Aleksandr Rybalko
bfc00339de Fix case when vt(4) started w/o driver assigned.
o Always init locks and cv ASAP.
o Initialize driver-independent parts even if driver probing fail.
o Allow to call vt_upgrade anytime, for later loaded drivers.
o New window flag VWF_READY, to track if window already initialized.
Other updates:
o Pass vd as a cookie for kbd_allocate.
o Do not blank window on driver replacement.

Tested by:	hselasky (RPi), emaste(VGA, EFIFB, KMS), me

MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-06-03 13:33:43 +00:00
Ed Maste
c6317b8376 Correct vt(4) border calculations on font switch
If a vt(4) font does not exactly fit the screen dimensions, the console
window is offset so that it is centered.  A rectangle is drawn at the
top, left, right, and bottom of the screen, to erase any leftovers that
are outside of the new usable console area.

If the x offset or y offset is 0 then the left border or top border
respectively is not drawn.  The right and bottom borders may be one
pixel larger than necessary due to rounding, and are always drawn.

Prior to this change a 0 offset would result in a panic when calling
vt_drawrect with an x or y coordinate of -1.

Sponsored by:	The FreeBSD Foundation
2014-05-29 21:52:42 +00:00
Ed Maste
7cd5ec40cf Update size in vt_grow if we don't have to reallocate
vt_grow may be called with a new size that's larger than previous but
does not require reallocation - for example, when the number of columns
is the same and new number of rows is less than the history size.
Prior to this change we would fail to update vb_scr_size, and then hit
a KASSERT when trying to write to the newly visible rows.

Sponsored by:	The FreeBSD Foundation
2014-05-29 21:10:33 +00:00
Ed Maste
ba23b43576 Correct KASSERT strings
Rows refer to height and cols to width.
2014-05-29 20:26:01 +00:00
Aleksandr Rybalko
bf03576620 Remove driver as unused.
MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-05-29 12:29:58 +00:00
Aleksandr Rybalko
c23c960364 Proper fix of VT_LOCKSWITCH ioctl.
Sponsored by:	The FreeBSD Foundation
2014-05-22 09:31:18 +00:00
Aleksandr Rybalko
7ee92f6e08 Fix tty locking.
o Correct expected values for VT_LOCKSWITCH ioctl.
o Check current window for locked state.

Sponsored by:	The FreeBSD Foundation
2014-05-21 11:15:38 +00:00
Aleksandr Rybalko
ae866603c7 Update terminal sizes in any case when new vt(4) driver arrive.
(Plus remove one unused newline)

Sponsored by:	The FreeBSD Foundation
2014-05-12 19:29:38 +00:00
Nathan Whitehorn
0ee4b22d75 Port over mmap routine from syscons. This lets X11 work on PowerPC with vt.
The last obstacle to switching PowerPC entirely to vt is that the Playstation 3
framebuffer driver needs to be ported over. This only applies for powerpc64,
however.
2014-05-11 02:16:08 +00:00
Nathan Whitehorn
015ac42e4b Make ofwfb not be painfully slow. This reduces the time for a verbose boot
on my G4 iBook by more than half. Still 10% slower than syscons, but that's
much better than a factor of 2.

The slowness had to do with pathological write performance on 8-bit
framebuffers, which are almost universally used on Open Firmware systems.
Writing 1 byte at a time, potentially nonconsecutively, resulted in many
extra PCI write cycles. This patch, in the common case where it's writing
one or several characters in an 8x8 font, gangs the writes together into
a set of 32-bit writes. This is a port of r143830 to vt(4).

The EFI framebuffer is also extremely slow, probably for the same reason,
and the same patch will likely help there.
2014-05-11 01:58:56 +00:00
Nathan Whitehorn
bdf49e3953 Make ofwfb actually work again. Apparently the API it was written against
still exists but is now silently ignored by the VT core. At least xboxfb
needs similar changes.
2014-05-11 01:19:55 +00:00
Aleksandr Rybalko
16aa1f0950 Hide debug messages under VT_DEBUG.
Sponsored by:	The FreeBSD Foundation
2014-05-08 22:52:05 +00:00
Aleksandr Rybalko
8a25d54521 Fix scrollback.
Sponsored by:	The FreeBSD Foundation
2014-05-08 13:46:36 +00:00
Aleksandr Rybalko
7273a5307a No need to assign fields required and checked on probe.
Sponsored by:	The FreeBSD Foundation
2014-05-08 13:38:29 +00:00
Aleksandr Rybalko
4efec7a83d Fix possible divide by zero.
Spotted by:	many

Sponsored by:	The FreeBSD Foundation
2014-05-07 13:53:38 +00:00
Aleksandr Rybalko
bf8ed13db7 Implement KDMKTONE ioctl.
Submitted by:	Matthew D.Fuller <fullermd@over-yonder.net> (original version)
MFC:		7 days
PR:		kern/189170

Sponsored by:	The FreeBSD Foundation
2014-05-06 13:52:13 +00:00
Aleksandr Rybalko
f3d2e242ec Switch vga drivers to use names and new vt(4) driver probe method.
Sponsored by:	The FreeBSD Foundation
2014-05-05 22:12:46 +00:00
Aleksandr Rybalko
5a0e08fb31 Revert r264997 and r265026. It is not required anymore.
Sponsored by:	The FreeBSD Foundation
2014-05-05 22:10:31 +00:00
Aleksandr Rybalko
ac7073a9d5 Add vt(4) driver name for ofwfb driver.
Sponsored by:	The FreeBSD Foundation
2014-05-05 21:49:31 +00:00
Aleksandr Rybalko
4dde16408c Switch fb and efifb drivers to use names and new vt(4) driver probe method.
Sponsored by:	The FreeBSD Foundation
2014-05-05 21:48:19 +00:00
Aleksandr Rybalko
1928c49270 Set of updates to vt(4) core part.
o Declare vt(4) drivers dataset.
o Create single static structures for all early drivers.
o Add vt(4) to be by default in the kernel consoles list.
o Create one more sysinit point, to be able to initialize memory and lock
	requirement of early drivers.
o Implement early drivers select. (Only best available will be selected).
o Fix one missed "return (0)" for VTYLOCK.
o Improve locking for cases when one driver replace another.
o Make driver replacement notification less debug-look-like.

Minor spell fixes.

Sponsored by:	The FreeBSD Foundation
2014-05-05 21:44:53 +00:00
Aleksandr Rybalko
90fdc1c6c2 Create dataset for vt(4) drivers.
Sponsored by:	The FreeBSD Foundation
2014-05-05 21:31:00 +00:00
Aleksandr Rybalko
f06a81663f Define a new method for probing vt(4) driver before attach it at early stage.
Sponsored by:	The FreeBSD Foundation
2014-05-05 21:29:56 +00:00
Nathan Whitehorn
43336b6385 No EFI on i386. This unbreaks the i386 VT kernel build. 2014-04-27 20:36:19 +00:00
Nathan Whitehorn
b2d52f78cf Increase the maximum framebuffer size to more reasonable values reflecting
the high-resolution boot consoles present on Open Firmware and EFI systems.
2014-04-27 02:20:51 +00:00
Nathan Whitehorn
7ff9cf1d06 Disable vga if EFI framebuffer present. vt(9) should handle this internally
based on efifb's higher priority, but it doesn't, and this at least lets
us build a kernel that boots on both BIOS and EFI systems for now.
2014-04-27 02:19:53 +00:00
Aleksandr Rybalko
faff39aaef Update to fix at r264244.
o Unmute terminal when done with driver replacement.
o Move init fonts to early point.
o Minor cleanup.

MFC after:	6 days
X-MFC-with:	r264244 r264242
Sponsored by:	The FreeBSD Foundation
2014-04-08 14:18:39 +00:00
Aleksandr Rybalko
187a54a1db Fix cursor color in reverse video mode.
PR:		kern/188196
Submitted by:	Claude Buisson <clbuisson@orange.fr> (original version)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-04-08 14:14:25 +00:00
Aleksandr Rybalko
248fe734f5 Fix panic on load new driver while vt(4) is in VGA textmode.
o Mute terminal while vt(4) driver change in progress.
o Reset VDF_TEXTMODE before init new driver.
o Assign default font, if new driver is not in TEXTMODE.
o Do not update screen while driver changing.

Resolved by:	adrian
Reported by:	tyler
MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-04-07 22:49:41 +00:00
Rui Paulo
916d4d8692 Need to include machine/fdt.h. 2014-04-05 23:20:49 +00:00
Aleksandr Rybalko
1da9f0d73a o Add new vd_driver method to do bitblt with mask, named vd_maskbitbltchr.
o Move vd_bitbltchr vga's driver method to vd_maskbitbltchr.
o Implement new vd_bitbltchr method for vga driver. (It do single write for 8
	pixels, have to be a bit faster).

MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-03-28 22:04:27 +00:00
Ed Maste
d1d4f00e9a Update EFI framebuffer handoff from loader
Sponsored by:	The FreeBSD Foundation
2014-03-27 19:43:38 +00:00
Aleksandr Rybalko
fe930c5220 Revert r263321.
vt(9) crash on resume fixed, but Xorg still have damaged screen on resume (at
least with i915kms), so better to switch to VT0 before suspend and back on
resume.

Sponsored by:	The FreeBSD Foundation
2014-03-27 14:07:36 +00:00
Aleksandr Rybalko
231f843f55 Fix crash on resume in vt(9).
Statically allocated terminal window have not initialized callout handler, so we
have to initialize it even for existing window if it is console window.

Reported by:	gjb and many
Tested by:	gjb
MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-03-27 09:24:09 +00:00
Aleksandr Rybalko
b3ea9d99ed Switch kern.vt.suspendswitch to 0 by default (disabled).
kern.vt.suspendswitch - sysctl/tunable which enable switch to VT0 before going
to suspend and switch back after resume.

MFC after:	7 days
2014-03-18 22:22:47 +00:00
Ed Maste
58df20d29d Use the existence of module metadata to indicate framebuffer presence 2014-03-14 19:37:37 +00:00
Aleksandr Rybalko
1a89eaf224 Add efifb driver. Driver uses the data passed by UEFI compatible loader/BIOS and
enable to use framebuffer created by those loader.
2014-03-05 14:37:45 +00:00
Aleksandr Rybalko
06716ffd17 Implement vd_drawrect and vd_setpixel for vt(9)'s VGA driver.
Sponsored by:	The FreeBSD Foundation
2014-02-07 12:39:58 +00:00
Aleksandr Rybalko
4d55a4250e Add vt_set_border function to help to change border color.
Use vt_set_border to reset color after font changed (different font size may
change border sizes)

Sponsored by:	The FreeBSD Foundation
2014-02-06 15:16:38 +00:00
Aleksandr Rybalko
9e497e7b04 Add two new vt(9) driver methods: vd_drawrect and vd_setpixel.
Implement vd_drawrect and vd_setpixel for vt_fb driver.

Sponsored by:	The FreeBSD Foundation
2014-02-06 15:12:44 +00:00
Justin Hibbits
17661cc725 Micro-optimize 8-bit blanking. This is the same as in ofw_syscons.
Reviewed by:	ray
MFC after:	1 week
2014-01-29 15:50:01 +00:00
Aleksandr Rybalko
5beb07abdd Style(9) fix.
No functional changes.

Sponsored by:	The FreeBSD Foundation
2014-01-20 23:36:16 +00:00
Aleksandr Rybalko
c3fbb0d11a Update xboxfb driver to actual state.
NOTE: Not tested.

Sponsored by:	The FreeBSD Foundation
2014-01-15 12:35:28 +00:00
Aleksandr Rybalko
92762d566e Restore VGA mode on vt switch. It fix VESA mode left by Xorg on exit.
Sponsored by:	The FreeBSD Foundation
2014-01-08 14:42:26 +00:00
Robert Millan
57a9b881a3 Fix build of vt_xboxfb. 2014-01-08 14:36:35 +00:00
Ed Maste
98457e0bb5 Increase vt(9) max glyph data to 1MB for CJK fonts with many glyphs
Sponsored by:	The FreeBSD Foundation
2014-01-01 19:38:15 +00:00
Aleksandr Rybalko
19e314e7c3 Fix AltGr, we should not only skip RAlt key release if enable_altgr is set, but
also process RAlt key press same way.

Sponsored by:	The FreeBSD Foundation
2013-12-26 14:25:37 +00:00
Aleksandr Rybalko
650c134f19 Use statndard (syscons) way to disable bell.
Testesd by:	markj

Sponsored by:	The FreeBSD Foundation
2013-12-25 19:07:14 +00:00
Aleksandr Rybalko
7a1a32c4ef o Add virtual terminal mmap request handler.
o Forward termianl framebuffer ioctl to fbd.
o Forward terminal mmap request to fbd.
o Move inclusion of sys/conf.h to vt.h.

Sponsored by:	The FreeBSD Foundation
2013-12-23 18:09:10 +00:00
Ed Maste
ddc31191a4 Update whitespace to match mkkfont output
Sponsored by:	The FreeBSD Foundation
2013-12-23 17:49:12 +00:00
Aleksandr Rybalko
a01571e0a7 Update names from newcons to vt(9).
Sponsored by:	The FreeBSD Foundation
2013-12-22 15:33:15 +00:00
Ed Maste
41fb066511 Support double-width characters in vt(9)
Normal and bold fonts each have a glyph map for single or left half-
glyphs, and right half glyphs.  The flag TF_CJK_RIGHT in term_char_t
requests the right half-glyph.

Reviewed by:	ed@
Sponsored by:	The FreeBSD Foundation
2013-12-21 13:58:55 +00:00
Ed Schouten
a6c26592f1 Extend libteken to support CJK fullwidth characters.
Introduce a new formatting bit (TF_CJK_RIGHT) that is set when putting a
cell that is the right part of a CJK fullwidth character. This will
allow drivers like vt(9) to support fullwidth characters properly.

emaste@ has a patch to extend vt(9)'s font handling to increase the
number of Unicode -> glyph maps from 2 ({normal,bold)} to 4
({normal,bold} x {left,right}). This will need to use this formatting
bit to determine whether to draw the left or right glyph.

Reviewed by:	emaste
2013-12-20 21:31:50 +00:00
Aleksandr Rybalko
008f5a254f Enable AltGr key by default.
Asked by:	many
Sponsored by:	The FreeBSD Foundation
2013-12-20 15:45:22 +00:00
Aleksandr Rybalko
d454a052df Set mouse level per window, instead of global.
Sponsored by:	The FreeBSD Foundation
2013-12-20 15:37:57 +00:00
Aleksandr Rybalko
0a036e525d Enable mouse support for terminal clients (like dialog(1)).
Sponsored by:	The FreeBSD Foundation
2013-12-19 15:31:20 +00:00
Aleksandr Rybalko
fdc3c84b5b Skip processing of R.Alt as a second Alt key, if sysctl kern.vt.enable_altgr is
not zero.

Submitted by:	andreast
Sponsored by:	The FreeBSD Foundation
2013-12-18 00:14:58 +00:00
George V. Neville-Neil
8528c7c86e Fix a panic when booting with kernels that have FREEBBSD_COMPAT
4, 5, 6 or 43 by only thunking the data parameter for old ioctls
compatability ioctls instead of doing it for all of them.

Submitted by:	jhb@
2013-12-11 17:18:10 +00:00
Konstantin Belousov
68a9d67c29 The opt_*.h headers must be included before any system header, except
sys/cdefs.h.  In particular, in case of COMPAT_43, param.h includes
sys/types.h, which includes sys/select.h, which includes
sys/_sigset.h.  The _sigset.h customizes the provided definions based
on COMPAT_43, eliminating osigset_t if symbol is not defined.  The
sys/proc.h is included after opt_compat.h and needs osigset_t.

Move opt_compat.h inclusion into the right place.

Sponsored by:	The FreeBSD Foundation
2013-12-10 22:33:02 +00:00
Aleksandr Rybalko
00f4f023f1 Break build with error in case when both syscons and newcons are enabled.
Sponsored by:	The FreeBSD Foundation
2013-12-10 15:36:29 +00:00
Aleksandr Rybalko
c323f8035b o Compat options have to be defined before sys/ioccom.h included, so move
inclusion of right after sys/param.h.
o Only vt_core module use compat options, move it from common header to module.

Reported by:	Larry Rosenman ler at lerctr dot org

Sponsored by:	The FreeBSD Foundation
2013-12-09 15:28:34 +00:00
Aleksandr Rybalko
0f49db6e47 Respect SC_NO_CUTPASTE option. It disable mouse cursor and cut/paste support
for vt(9). Note: /dev/sysmouse not affected.

Sponsored by:	The FreeBSD Foundation
2013-12-09 15:01:34 +00:00
Aleksandr Rybalko
37fd54ff81 o Build syscons(9)'s splash support if both sc and splash are enabled.
o Include opt_splash.h for vt(9) to know when splash device is enabled.
o Build logo_freebsd.c only if splash and vt are enabled.
o Include opt_compat.h to know when we have to respect compatibility.

Sponsored by:	The FreeBSD Foundation
2013-12-08 22:49:12 +00:00
Aleksandr Rybalko
5ffea144c7 Fix td_frame flags for i386.
Submitted by:	jilles

Sponsored by:	The FreeBSD Foundation
2013-12-06 23:12:21 +00:00
Aleksandr Rybalko
27cf7d04ef Merge VT(9) project (a.k.a. newcons).
Reviewed by:	nwhitehorn
MFC_to_10_after:	re approval

Sponsored by:	The FreeBSD Foundation
2013-12-05 22:38:53 +00:00