Commit Graph

33556 Commits

Author SHA1 Message Date
Gleb Smirnoff
69db34c309 Fix build without SC_PIXEL_MODE defined. 2017-04-19 22:48:27 +00:00
Jung-uk Kim
2696ce471c Revert r316796. It is not necessary since r317173. 2017-04-19 22:43:11 +00:00
Jung-uk Kim
b249b33322 Always clear borders when the terminal is flushed.
PR:		202288
2017-04-19 22:41:24 +00:00
Jung-uk Kim
5971d9cf1c Micro-optimize vt_set_border(). 2017-04-19 22:21:15 +00:00
Bruce Evans
35ffedf6bc Fix missing support for drawing the mouse cursor in depth 24 of direct
mode.

Use the general DRAWPIXEL() macro with its bigger case statement
(twice) instead of our big case statement (once).  DRAWPIXEL() is more
complicated since it is not missing support for depth 24 or
complications for colors in depth 16 (we currently hard-code black and
white so the complications for colors are not needed).  DRAWPIXEL()
also does the bpp calculation in the inner loop.  Compilers optimize
DRAWPIXEL() well enough, and the main text drawing method always
depended on this.  In direct mode, mouse cursor drawing is now similar
to normal text drawing except it draws in 2 hard-coded colors instead
of 1 variable color.

This also fixes a nested hard-coding of colors.  DRAWPIXEL() uses the
palette in all cases, but the direct code didn't use the palette for
its hard-coded black.  This only had an effect in depth 8, since
changing the palette is not supported in other depths.
2017-04-19 18:35:34 +00:00
Bruce Evans
38862a5553 Stop using a saveunder method for mouse cursor drawing in the vga
direct mode renderer.  I thought that reads were not much slower than
writes, so that the method only tripled the time for the whole function,
but I recently measured that video memory reads can be up to 53 times
slower than writes in tighter loops than here.  Loop overheap here
reduces the multiplier to only 16-20 on Haswell.

Start cleaning up and fixing larger bugs in this function.  Only replace
the 22-line removal loop by a 3-line one for now, since adjusting the
old loop would have required many palette calculations which are better
done in the DRAW_PIXEL() macro.  This also fixes missing support for
depth 24, but only for removal.

Removal is currently sloppy at the right bottom corner.  It sometimes
leaks border color into the text window.  This is soon cleaned up by the
caller.  The planar renderer has complications to clip at the corner.
2017-04-19 16:24:51 +00:00
Bruce Evans
7b8306bcd2 When we don't use the parameter table in the BIOS, also don't use most
of our tweaked modes based on it.  In practice, this means limiting the
tweaked modes to at most 80x50 based on 80x25, so there are no 90-column,
80x30 or 80x60 modes.

This happens when the the initial mode is is not in the parameter
table.  We always detected this case, but assumed that the (necessarily
nonstandard) parameters of the initial mode could be tweaked just as
blindly as the probably-standard parameters of initial modes in the
table.

On 1 laptop system with near-VGA where the initial mode is nonstandard,
this is because the hardware apparently doesn't support 9-bit mode,
but otherwise has standard timing.  The initial mode has 8-bit mode
CRTC horizontal parameters similar to those in syscons' 90-column modes
and in EGA modes.  Tweaking these values for the 90-column modes has
little effect except to print the extra 10 columns off the screen.
Tweaking from 80x25 to 80x30 requires changing from 400 scan lines to
480.  This can probably be made to work, but syscons blindly applies
values based on standard timing.  This gives blank output.  Tweaking
from 80x25 to 80x50 doesn't change the CRTC timing and works.
2017-04-19 14:49:18 +00:00
Sepherosa Ziehau
9ba5e29c5c hyperv: Use kmem_malloc for hypercall memory due to NX bit change.
Reported by:	dexuan@
MFC after:	now
Sponsored by:	Microsoft
2017-04-19 02:39:48 +00:00
Alexander Motin
7ce9096841 Block FPDMA TRIM for ASMedia HBAs.
Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the
same SSDs working fine on Intel HBAs.

MFC after:	2 weeks
2017-04-18 08:04:15 +00:00
Gleb Smirnoff
9ed01c32e0 All these files need sys/vmmeter.h, but now they got it implicitly
included via sys/pcpu.h.
2017-04-17 17:07:00 +00:00
Gleb Smirnoff
6286dc78d4 Remove unneeded include of vm_phys.h. 2017-04-17 16:51:04 +00:00
Navdeep Parhar
46f48ee519 cxgbe: Add tunables to control the number of LRO entries and the number
of rx mbufs that should be presorted before LRO.  There is no change in
default behavior.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-17 09:00:20 +00:00
Mark Murray
150890b0c6 Replace the RC4 algorithm for generating in-kernel secure random
numbers with Chacha20. Keep the API, though, as that is what the
other *BSD's have done.

Use the boot-time entropy stash (if present) to bootstrap the
in-kernel entropy source.

Reviewed by: delphij,rwatson
Approved by: so(delphij)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10048
2017-04-16 09:11:02 +00:00
Ian Lepore
44c63714ce Add imx6ul SoC support, and get the PHY number from the FDT data. If there
is no phy-handle property, fall back to using MII_PHY_ANY.

This still doesn't support an mdio bus with multiple PHYs on it, or the
possibility that the PHY being used by this instance of ffec is on the
mdio bus of some other instance (which is now a possibility with imx6ul).
Adding that support will require changes in fdt_get_phyaddr(), which is
currently making some assumptions that don't work with modern fdt data.
2017-04-16 03:49:14 +00:00
Ian Lepore
e8b1516a8b Add support for the Micrel KSZ8081 ethernet PHY.
The only thing this phy needs that the ukphy driver doesn't provide is
that the value in the proprietary Phy Control 2 Register must be saved
before doing a soft reset and restored afterwards.  Most modern phys have
"sticky bits" for low-level config that survive a reset, but on this one
the values in all registers go back to defaults, wiping out any board-
specific config set up by the bootloader/bios/whatever.
2017-04-16 01:40:17 +00:00
Bruce Evans
f027ee38b7 Add a 10x16 mouse cursor and use it in all graphics (strictly, pixel)
modes if the font size is >= 14.

This is the X cursor XC_left_ptr (#68) (glyph #45 in an X cursor font).
Also found in vt.  The old 9x13 cursor is the 10x16 one trimmed not very
well.

8x8 fonts need a smaller cursor instead of a larger one, except when
the pixel size is small.  Text mode is still limited to width and height
1 more than the font (so the 9x13 is already 4 pixels too high for it).
2017-04-15 20:03:50 +00:00
Bruce Evans
e560b71d3b Structure the mouse cursor data so that it is easier to switch, and
access it via pointers (still to only 1 instance, now with a less
generic name).

Restructure the "and" and "or" masks as border and interior masks
(where the "and" mask was for the union of the border and the interior).
"and" and "or" were only a detail in a not very good implementation,
and after fixing that the union was only used to calculate the border
at runtime.

Use the metric data in more places to clip to active pixels earlier.
2017-04-15 19:27:39 +00:00
Navdeep Parhar
d491f8ca2f cxgbe: Add a tunable to configure the SGE time scaler, which is
available starting with T6.  The values in the timer holdoff registers
are multiplied by the scaling factor before use.

dev.<nexus>.<n>.holdoff_timers shows the final values of the
timers in microseconds.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-04-15 17:00:50 +00:00
Navdeep Parhar
e3951def25 cxgbe/iw_cxgbe: Report the actual values of various parameters as
configured by the firmware.

MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 20:15:17 +00:00
Navdeep Parhar
7f77a37048 cxgbe/iw_cxgbe: Report accurate page_size_cap in ib_query_device.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 19:18:50 +00:00
Navdeep Parhar
080491b13c cxgbe/iw_cxgbe: hw supports 64K (not 32K) Protection Domains.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-14 19:15:31 +00:00
Bruce Evans
42106dcc4b Oops, the previous revision was missing the update of the shift variable. 2017-04-14 17:38:43 +00:00
Bruce Evans
b95fde5020 Adjust shifting so that cursor widths up to 17 (was 9) work in vga planar
mode.

Direct mode always supported widths up to 32, except for its hard-coded
16s matching the pixmap size.  Text mode is still limited to 9 its 2x2
character cell method and missing adjustments for the gap between
characters, if any.

Cursor heights can be almost anything in graphics modes.
2017-04-14 17:02:24 +00:00
Kevin Lo
5d70641052 Remove RTL8153 quirk since ure(4) supports this chip. 2017-04-14 14:38:27 +00:00
Bruce Evans
a5126f539e Optimize drawing of the mouse cursor in vga planar mode almost as
much as possible, by avoiding null ANDs and ORs to the frame buffer.

Mouse cursors are fairly sparse, especially for their frame.  Pixels
are written in groups of 8 in planar mode and the per-group sparseness
is not as large, but it still averages about 40% with the current
9x13 mouse cursor.  The average drawing time is reduced by about this
amount (from 22 usec constant to 12.5 usec average on Haswell).

This optimization is relatively larger with larger cursors.  Width 10
requires 6 frame buffer accesses per line instead of 4 if not done
sparsely, but rarely more than 4 if done sparsely.
2017-04-14 14:00:13 +00:00
Bruce Evans
ddac85e5a0 Further unobfuscate the method of drawing the mouse cursor in vga planar
mode.

Don't manually unroll the 2 inner loops.  On Haswell, doing so gave a
speedup of about 0.5% (about 4 cycles per iteration out of 1400), but
hard-coded a limit of width 9 and made better better optimizations
harder to see.  gcc-4.2.1 -O does the unrolling anyway, unless tricked
with a volatile hack.  gcc's unrolling is not very good and gives a
a speedup of about half as much (about 2 cycles per iteration).  (All
timing on i386.)

Manual unrolling was only feasible because the inner loop only iterates
once or twice.  Usually twice, but a dynamic check is needed to decide,
and was not moved from the second-innermost loop manually or by gcc.
This commit basically adds another dynamic check in the inner loop.

Cursor widths of 10-17 require 3 iterations in the inner loop and this
is not so easy to unroll -- even gcc stops at 2.
2017-04-14 12:03:34 +00:00
Pyun YongHyeon
d2c2bbeaee Remove dead code. 2017-04-14 08:27:42 +00:00
Pyun YongHyeon
f9beb16729 Don't overwrite mapped bits.
Found by:	PVS-Studio
2017-04-14 08:11:50 +00:00
Pyun YongHyeon
9935c65a28 Remove unnecessary assignment.
Found by:	PVS-Studio
2017-04-14 07:27:23 +00:00
Sepherosa Ziehau
1e85137841 hyperv/kvp: Remove always false condition.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:29:27 +00:00
Sepherosa Ziehau
e25942b0eb hyperv/storvsc: Use ULL for 64bits value shift.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:25:21 +00:00
Sepherosa Ziehau
7737abe4f2 hyperv/kbd: Remove unnecessary assignment.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:18:42 +00:00
Pyun YongHyeon
8d16945419 Remove unnecessary check aginst NULL. txp_ext_command() with
TXP_CMD_WAIT argument allocates a response buffer.  If the allocation
fails, txp_ext_command() returns an error and it's handed in caller.

Found by:	PVS-Studio
2017-04-14 03:23:03 +00:00
Pyun YongHyeon
90b45a3200 Remove unnecessary comparison.
Found by:	PVS-Studio
2017-04-14 02:33:26 +00:00
Pyun YongHyeon
857b699d7e Fix a potentially forever loop.
Found by:	PVS-Studio
2017-04-14 02:24:02 +00:00
Jung-uk Kim
bae56e46c4 Attempt to clear logos more thoroughly.
PR:		202288
Reviewed by:	cem
2017-04-13 23:00:26 +00:00
Navdeep Parhar
0a600b6312 cxgbe: Query some more RDMA related parameters from the firmware.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-13 17:16:36 +00:00
Alexander Motin
35e492f3bd Update list of Conexant and Realtek codecs.
MFC after:	2 weeks
2017-04-13 14:40:48 +00:00
Conrad Meyer
b4cb6e275e drm2: Add some missing PCIIDs for some Haswell systems
Submitted by:	Jia-Shiun Li <jiashiun at gmail.com>
2017-04-13 01:56:15 +00:00
David C Somayajulu
d6d22a0555 Fix rss_ind_table entry for num_funcs > 1
MFC after:3 days
2017-04-13 01:17:49 +00:00
Bruce Evans
1b986d6aea Improve drawing of the vga planar mode mouse image a little. Unobfuscate
the method a lot.

Reduce the AND mask to the complement of the cursor's frame, so that area
inside the frame is not drawn first in black and then in lightwhite.  The
AND-OR method is only directly suitable for the text mouse image, since
it doesn't go to the hardware there.  Planar mode Mouse cursor drawing
takes 10-20 usec on my Haswell system (approx. 100 graphics accesses
at 130 nsec each), so the transient was not visible.

The method used the fancy read mode 1 and its color compare and color
don't care registers with value 0 in them so that all colors matched.
All that this did was make byte reads of frame buffer memory return 0xff,
so that the x86 case could obfuscate read+write as "and".  The read must
be done for its side effect on the graphics controller but is not used,
except it must return 0xff to avoid affecting the write when the write
is obfuscated as a read-modify-write "and".  Perhaps that was a good
optimization for 8088 CPUs where each extra instruction byte took as
long as a byte memory access.

Just use read+write after removing the fancy read mode.  Remove x86
ifdefs that did the "and".  After removing the "and" in the non-x86
part of the ifdefs, fix 4 of 6 cases where the shift was wrong.
2017-04-12 20:18:38 +00:00
Bruce Evans
8bae6e480d Fix removal of mouse image by the vga planar renderer in the right border
in unusual cases.  Optimize and significantly clean up removal in this
renderer.  Optimize removal in the vga direct renderer.

Removal only needs to be done in the border (the part with pixels) in
both cases.  The planar renderer used the condition scp->xoff > 0 to
test whether a right border exists.  This actually tests for a left
border, and when the total horizontal border is 8 pixels, rounding gives
only a right border.  This was the unusual broken case.  An example
is easy to configure using something like "vidcontrol -f 8x16 iso-8x16
-g 79x25 MODE_27".

Optimize the planar case a little by only removing 9x13 active pixels
out of 16x16.  Optimize it a lot by not doing anything if there is no
overlap with the border.  Don't unroll the main loop or hard-code so
many assumptions about font sizes in it.  On my Haswell system, graphics
memory and i/o accesses takes about 520 cycles each so optimizations from
unrolling are in the noise.

Optimize the direct case to not do anything if there is no overlap with
the border.  Do a sanity check on the saveunder's coordinates.  This
requires a previous change to pass non-rounded coordinates.
2017-04-12 18:52:06 +00:00
Bruce Evans
ac07ac7c74 Trival style fix to previous commit to add this detail.
The previous commit also fixed the coordinates passed to the mouse
removal renderer.  The coordinates were rounded down to a character
boundary, and thus essentially unusable.  The renderer had to keep
track of the previous position, or clear a larger area.  The latter
is only safe in the border, which is all that needs special handling
anyway.

I think no renderer depends on the bug.  They have the following
handling:
- gfb sparc64: this seems to assume non-rounded coordinates
- gfb other: does nothing (seems to be missing border handling)
- vga text: does nothing (doesn't need border handling)
- vga planar: clears extras in the border, with some bugs.  The fixes
  will use the precise coordinates to optimize.
- vga direct: clears at the previous position with no check that it
  is active, and clears everything.  Checking finds this bug.
- others: are there any?
2017-04-12 17:38:00 +00:00
Bruce Evans
accdee8d46 Fix removing of the mouse image in vga planar mode with 8x8 fonts, and
reduce hard-coded assumptions on font sizes so that the cursor size
can be more independent of the font size.  Moving the mouse in the
buggy mode left trails of garbage.

The mouse cursor currently has size 9x13 in all modes.  This can occupy
2x3 character cells with 8x8 fonts, but the algorithm was hard-coded
for only 2x2 character cells.  Rearrange to hard-code only a maximum
cursor size (now 10x16) and to not hard-code in the logic.  The number
of cells needed is now over-estimated in some cases.

2x3 character cells should also be used in text mode with 8x8 fonts
(except with large pixels, the cursor size should be reduced), but
hard-coding for 2x2 in the implementation makes it not very easy to
expand, and it practice it shifts out bits to reduce to 2x2.

In graphics modes, expansion is easier and there is no shifting out
for 9x13 cursors (but 9 is a limit for hard-coding for 2 8-bit VGA
cells wide).  A previous commit removed the same buggy hard-coding for
removal at a lower level in planar mode.  Another previous commit fixed
the much larger code for lower-level removal in direct mode; this is
independent of the font size so worked for 8x8 fonts.  Text mode always
depended on the higher-level removal here, and always worked since
everything was hard-coded consistently for 2x2 character cells.
2017-04-12 17:06:24 +00:00
Bruce Evans
af032a9dec Fix clobbering of the default attribute and the screen position in
scteken_init().  Move the internals of scteken_sync() into a local
function to help do this.

scteken_init() reset or adjusted the default attribute and screen
position at least 3 and 5 times, respectively.  Warm init shouldn't
do any more than reset the "input" state.
  (scterm-sc.c (which still works after minor editing), only resets
  the escape state and the saved cursor position, and then does a
  nearly-null sync of the current color.)

This mainly broke mode changes, and was most noticeable when the
background color is not teken's default (usually black).  Then the
screen gets cleared in the wrong color.  vidcontrol restores the
default normal attribute and tries to restore the default reverse
attribute.  vidcontrol doesn't clear the screen again after restoring
the attribute(s), and it is too late to do it there without flicker.
Now the default normal attribute is restored before the change affects
the rendering.

When the foreground color is not teken's default, clearing with the
wrong attributes gave strange cursor colors for some cursor types.

The default reverse attribute is not restored since it is unsupported.

2/3 of the clobbering was from 2 resetting window resizing calls.  The
second one is needed to restore the size, but must not reset.  Window
resizing also sanitizes the cursor position, and after the main reset
resets the window size, the cursor row would often be adjusted from
24 to 23 if it were not already reset to 0.  scteken_sync() is good
for restoring the window size and the cursor position in the correct
order, but was unusable at init time since scp->ts is not always
initialized then.  Adjust to use its internals.

I didn't notice any problems from the cursor reset.  The cursor should
be reset, and a previous fix was to reset it consistently a little
later.

Doing nothing for warm init works almost as well, if not better.  It
is not very useful to reset the escape state for mode changes, since
the reset is especially likely to be null then.  The escape state is
most likely to be non-initial and corrupted by its most normal uses
-- sloppy non-atomic output where a context switch or just mixing
stdout with stderr splits up escape sequences.
2017-04-12 16:21:55 +00:00
Andriy Voskoboinyk
6b322760df rtwn: remove out-of-bounds access + fix debug output.
Omit unused rates while initializing / dumping Tx power values.

They were not accessed anywhere (except for debugging), so this is
(mostly) no-op.

Tested with
 * RTL8188EU, STA mode.
 * RTL8812AU, STA mode.

Found by:	PVS-Studio
2017-04-12 07:21:54 +00:00
David C Somayajulu
54064a2fd3 Fix defects reported by Coverity
1. Deadcode in ecore_init_cache_line_size(), qlnx_ioctl() and
	qlnx_clean_filters()
2. ARRAY_VS_SINGLETON issue in qlnx_remove_all_mcast_mac() and
	qlnx_update_rx_prod()

MFC after:5 days
2017-04-12 00:52:09 +00:00
Bruce Evans
f3ac3a6e6f Special rendering methods for removing mouse cursors cannot be removed
like I hoped, since they are needed for removing parts over the border.
Continue fixing bugs in them.

In the vga planar mode renderer, remove removal of the part of the
image over the text window.  This was hard-coded for nearly 8x16 fonts
and in practice didn't remove enough for 8x8 fonts.  This used the
wrong attribute over cutmarked regions.  The caller refreshes with the
correct attribute later, so the attribute bug only caused flicker.
The caller uses the same hard-coding, so the refreshes fix up all the
spots with the wrong attribute, but keep missing the missed spots.
This still gives trails of bits of cursors for cursor motions in the
affected configurations (mainly depth 4 modes with 8x8) fonts.  8x14
fonts barely escape the problem since although the cursor is drawn
as 16x16, its active part is only 9x13 and the active part fits in
the hard-coded 2x2 character cell window for 8x14 fonts.  8x8 fonts
need a 2x3 window.

In the fb non-sparc64 renderer, the buggy image removal was buggier
and was already avoided by returning before it.  Remove it completely
and fix nearby style bugs.  It was essentially the same as for the vga
planar mode renderer (obfuscated by swapping x and y).  This was buggier
since fb should handle more types of hardware so the hard-coding is
wronger.

The remaining fb image removal is also buggier.  It never supported
software cursors drawn into the border, and the hardware cursor is
probably broken by other bugs to be fixed soon.
2017-04-10 06:19:09 +00:00
Alexander Motin
e9da70a35e Fix few minor issues found by Clang Analyzer.
MFC after:	2 weeks
2017-04-09 07:53:31 +00:00
Patrick Kelsey
67d955aab4 Corrected misspelled versions of rendezvous.
The MFC will include a compat definition of smp_no_rendevous_barrier()
that calls smp_no_rendezvous_barrier().

Reviewed by:	gnn, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10313
2017-04-09 02:00:03 +00:00