Speed up console framebuffer imageblit function
authorHarm Hanemaaijer <fgenfb@yahoo.com>
Thu, 20 Jun 2013 18:21:39 +0000 (20:21 +0200)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:32:36 +0000 (16:32 +0100)
commit45338cebd3fb5f12066a116ea7692a0f2cde50d4
tree57448e1b14822e8efc2c0bacdc11efdbee4f3e55
parentd9c3b92805abdb4cd21c7b3655a0baa19a9a6a2c
Speed up console framebuffer imageblit function

Especially on platforms with a slower CPU but a relatively high
framebuffer fill bandwidth, like current ARM devices, the existing
console monochrome imageblit function used to draw console text is
suboptimal for common pixel depths such as 16bpp and 32bpp. The existing
code is quite general and can deal with several pixel depths. By creating
special case functions for 16bpp and 32bpp, by far the most common pixel
formats used on modern systems, a significant speed-up is attained
which can be readily felt on ARM-based devices like the Raspberry Pi
and the Allwinner platform, but should help any platform using the
fb layer.

The special case functions allow constant folding, eliminating a number
of instructions including divide operations, and allow the use of an
unrolled loop, eliminating instructions with a variable shift size,
reducing source memory access instructions, and eliminating excessive
branching. These unrolled loops also allow much better code optimization
by the C compiler. The code that selects which optimized variant is used
is also simplified, eliminating integer divide instructions.

The speed-up, measured by timing 'cat file.txt' in the console, varies
between 40% and 70%, when testing on the Raspberry Pi and Allwinner
ARM-based platforms, depending on font size and the pixel depth, with
the greater benefit for 32bpp.

Signed-off-by: Harm Hanemaaijer <fgenfb@yahoo.com>
drivers/video/fbdev/core/cfbimgblt.c