Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a081d1e4 authored by Harm Hanemaaijer's avatar Harm Hanemaaijer Committed by alexax66
Browse files

Optimize kernel cfbfillrect function



This is a  patch to speed up the kernel
cfbfillrect function used for clearing the screen or filling an area
with a solid color.

The previous implementation was doing reads from the uncached framebuffer,
in certain circumstances, even for simple fills, which for performance
reasons, on most platforms, is ill-advised unless strictly necessary to
conform to the raster operation. In these circumstances, doing 64-bit
access on 64-bit systems does not serve much purpose except for probing
for corner-case bugs and race conditions in the hardware's framebuffer
bus implementation. On all systems, for 16bpp, it is better to take
advantage of write-combining features of the framebuffer and write a
half-word if required for the left and right edges.

Additionally, on most platforms, integer divides are relatively slow so are
best avoided, especially in inner loops.

This patch implements optimizations for 16bpp and 32bpp that avoid
framebuffer read operations during cfbfillrect if the raster-operation
is GXcopy. This applies to both 32-bit (BITS_PER_LONG) and 64-bit
systems (BITS_PER_LONG == 64). Although cfbfillrect is not usually a
bottleneck for the console text framebuffer (because regions filled
usually are aligned to a multiple of 2 or 4 x-coordinate and reads
are avoided), in some use-cases this patch could deliver a significant
speed-up.

Signed-off-by: default avatarHarm Hanemaaijer <fgenfb@yahoo.com>
parent e3b764d3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment