Commit Graph

44 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
c3a05e5422 vt(4): Remove vt_buf->vb_dirtymask
This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

MFC after:	3 days
2014-09-19 11:02:44 +00:00
Aleksandr Rybalko
4f4b93ae98 Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
(forgetted in last commit)

Reviewed by:	dumbbell (as D755)
MFC after:	1 week
2014-09-12 14:16:10 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Aleksandr Rybalko
16aa1f0950 Hide debug messages under VT_DEBUG.
Sponsored by:	The FreeBSD Foundation
2014-05-08 22:52:05 +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
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
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
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
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
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
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
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
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