Commit Graph

247 Commits

Author SHA1 Message Date
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
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
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
54927e051c creator_fb: Implement vd_bitblt_text_t
MFC after:	1 week
2014-08-23 15:04:20 +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
2cf9e30b6e fbd: Fix a bug where vt_fb_attach() success would be considered a failure
vt_fb_attach() currently always returns 0, but it could return a code
defined in errno.h. However, it doesn't return a CN_* code. So checking
its return value against CN_DEAD (which is 0) is incorrect, and in this
case, a success becomes a failure.

The consequence was unimportant, because the caller (drm_fb_helper.c)
would only log an error message in this case. The console would still
work.

Approved by:	nwhitehorn
2014-08-10 14:55:39 +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
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
Nathan Whitehorn
c529ffef57 Add a simple unaccelerated vt(4) framebuffer driver for Sun framebuffers
handled by creator(4) (Sun Creator 3D, Elite 3D, etc.). This provides
vt(4) consoles on all devices currently supported by syscons on sparc64.
The driver should also be easily adaptable to support newer Sun framebuffers
such as the XVR-500 and higher.

Many thanks to dumbbell@ (Jean-Sebastien Pedron) for testing this remotely
during development.
2014-08-05 18:19:51 +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
Aleksandr Rybalko
79b647995d Should check fb_read method presence instead of double check for fb_write.
Pointed by:     emaste

Sponsored by:	The FreeBSD Foundation
2014-07-09 21:55:34 +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
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
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
Dimitry Andric
2994da7d3c Remove more superfluous const specifiers. 2014-02-23 18:36:45 +00:00
Ed Maste
e279f478f2 Clean up license text
- Renumber Regents clauses
- Remove clause 3 and 4 from TNF license, following upstream change
2013-12-29 18:44:12 +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
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
Jung-uk Kim
10f1472e41 Reduce diff against stable/9 slightly. 2013-08-28 20:10:56 +00:00
Jung-uk Kim
663593f19f Do not save/restore video memory if we are not using linear frame buffer.
Note this partially revert r233896.
2013-08-28 19:06:22 +00:00
Jung-uk Kim
b1bba126f0 Make sure to free stale buffer before allocating new one for safety. 2013-08-28 18:13:37 +00:00
Jung-uk Kim
7afb475f63 Avoid unnecessary signedness conversion. 2013-08-28 17:58:30 +00:00
Jung-uk Kim
ba9855e380 Limit the amount of video memory we map for the driver to the maximum value.
This basically restores the spirit of r203535, which was partially reverted
in r205557, while we still map fixed amount to work around transient issues
we experienced with r203535.

Prodded by:	avg
Tested by:	avg
MFC after:	1 week
2013-03-27 18:06:28 +00:00
Oleksandr Tymoshenko
e1f04cd024 Piggyback MIPS changes and add ARM syscons support for devices with
framebuffer

While here - sort #if defined() order alphabetically
2012-08-25 23:59:31 +00:00
Robert Watson
8122a592ee Provide basic glue to allow syscons to be used on MIPS, modelled
on PowerPC support.  This was clearly not something syscons was
designed to do (very specific assumptions about the nature of VGA
consoles on PCs), but fortunately others have long since blazed
the way on making it work regardless of that.

Sponsored by:	DARPA, AFRL
2012-08-25 08:09:37 +00:00
Poul-Henning Kamp
00c5291f29 Fix the previous commit to only copy the data we were asked to and not
twice as much.

Spotted by:	Taku YAMAMOTO
2012-06-18 07:54:10 +00:00
Poul-Henning Kamp
fc9174db51 On certain newer Intel Atom based motherboards, for instance the
D2500CC which I have, syscons in text-mode fails to show the expected
contents due to write errors into video-memory.

At least one of the causes is that we copy from syscons internal buffer
to the video memory with optimized bcopy(9) which uses >16bit operations.

Until now, 32bit and wider operations have always worked on the video
memory, but since I cannot find a single source which says that this
SHALL work, and since these chipsets/bugs are now out there, this
commit changes syscons to always use 16bit copies on i386 & amd64.

This may be relevevant for PR's:
	166262
	166639
and various other bug reports floating elsewhere on the net, but
I lack hardware to test those.
2012-06-17 21:02:48 +00:00
Jung-uk Kim
5cf2cbca3f Fix a Clang warning.
Submitted by:	arundel
2012-04-16 23:29:12 +00:00
Jung-uk Kim
4db9b6c3c6 Save and restore VGA display memory between suspend and resume. 2012-04-04 22:02:54 +00:00
Jung-uk Kim
4c7a7f266f Do not copy VESA state buffer if the VBE call has failed for any reason.
Do not unnecessarily clear the state buffer before calling the function.
2012-04-04 21:38:26 +00:00
Jung-uk Kim
a3ad2822c4 Remove a useless warning. The mode information is unused for very long time
and this function may be used with VESA mode since r232069.
2012-04-04 21:19:55 +00:00
Jung-uk Kim
cd283487cc Do not reuse the previous address when restoring linear frame buffer. 2012-03-19 17:14:12 +00:00
Jung-uk Kim
9f5242849d Save and restore linear frame buffer between suspend and resume.
MFC after:	1 week
2012-03-17 00:00:33 +00:00
Jung-uk Kim
0b01dbd70b Remove unnecessary static variable initializations and duplicate codes.
Consistently use bcopy(9) over memcpy(9).
2012-03-16 23:54:23 +00:00
Jung-uk Kim
b1a499f3d8 Do not unnecessarily clear display memory when switching modes.
MFC after:	3 days
2012-03-16 19:22:29 +00:00
Jung-uk Kim
7e330e8220 If the VBE implementation does not support save/restore function, defer to
VGA methods.  Unconditionally reset the VESA adapter before restoring state.
2012-02-23 20:54:22 +00:00
Jung-uk Kim
e7d5cd47c5 Update my copyright date. 2012-02-23 19:16:05 +00:00
Jung-uk Kim
257e5645da Probe supported states for save/restore function. Some VBE implementation
refuses to save/restore states if an unsupported bit is set.
2012-02-23 19:05:57 +00:00
Jung-uk Kim
3dd6e888c0 Fix a typo introduced in r231843. 2012-02-23 18:59:32 +00:00
Jung-uk Kim
1556e63481 Set the initial mode for the adapter after executing VESA BIOS POST.
There is no need to set initial mode for BIOS.
2012-02-16 22:51:44 +00:00
Jung-uk Kim
2f18ee9d47 Make sure the VESA mode number is between 256 and 511 inclusive. 2012-02-16 22:46:00 +00:00
Jung-uk Kim
60474b7b97 Properly check VESA video mode number. 2012-02-16 22:33:53 +00:00
Ulrich Spörlein
62355ca27f Convert files to UTF-8 2012-01-15 13:23:43 +00:00
Ulrich Spörlein
9a14aa017b Convert files to UTF-8 2012-01-15 13:23:18 +00:00
Eitan Adler
dca400f352 - Add support for ASCII art splash screens in TheDraw format
PR:		kern/143370
Submitted by:	Antony Mawer <antony@mawer.org>
Reviewed by:	gjb (doc)
Reviewed by:	des (style)
Approved by:	ed
MFC after:	1 month
2011-12-12 21:12:07 +00:00
Marius Strobl
4b7ec27007 - There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.
2011-11-22 21:28:20 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Marius Strobl
bda8e754a1 Make sparc64 compatible with NEW_PCIB and enable it:
- Implement bus_adjust_resource() methods as far as necessary and in non-PCI
  bridge drivers as far as feasible without rototilling them.
- As NEW_PCIB does a layering violation by activating resources at layers
  above pci(4) without previously bubbling up their allocation there, move
  the assignment of bus tags and handles from the bus_alloc_resource() to
  the bus_activate_resource() methods like at least the other NEW_PCIB
  enabled architectures do. This is somewhat unfortunate as previously
  sparc64 (ab)used resource activation to indicate whether SYS_RES_MEMORY
  resources should be mapped into KVA, which is only necessary if their
  going to be accessed via the pointer returned from rman_get_virtual() but
  not for bus_space(9) as the later always uses physical access on sparc64.
  Besides wasting KVA if we always map in SYS_RES_MEMORY resources, a driver
  also may deliberately not map them in if the firmware already has done so,
  possibly in a special way. So in order to still allow a driver to decide
  whether a SYS_RES_MEMORY resource should be mapped into KVA we let it
  indicate that by calling bus_space_map(9) with BUS_SPACE_MAP_LINEAR as
  actually documented in the bus_space(9) page. This is implemented by
  allocating a separate bus tag per SYS_RES_MEMORY resource and passing the
  resource via the previously unused bus tag cookie so we later on can call
  rman_set_virtual() in sparc64_bus_mem_map(). As a side effect this now
  also allows to actually indicate that a SYS_RES_MEMORY resource should be
  mapped in as cacheable and/or read-only via BUS_SPACE_MAP_CACHEABLE and
  BUS_SPACE_MAP_READONLY respectively.
- Do some minor cleanup like taking advantage of rman_init_from_resource(),
  factor out the common part of bus tag allocation into a newly added
  sparc64_alloc_bus_tag(), hook up some missing newbus methods and replace
  some homegrown versions with the generic counterparts etc.
- While at it, let apb_attach() (which can't use the generic NEW_PCIB code
  as APB bridges just don't have the base and limit registers implemented)
  regarding the config space registers cached in pcib_softc and the SYSCTL
  reporting nodes set up.
2011-10-02 23:22:38 +00:00
Marcel Moolenaar
01f7b6dad3 Use the preload_fetch_addr() and preload_fetch_size() convenience
functions to obtain the address and size of the bitmap splash image.

Sponsored by: Juniper Networks.
2011-02-13 19:25:48 +00:00