fbdev: Improve performance of cfb_imageblit()
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 23 Feb 2022 19:38:03 +0000 (20:38 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 2 Mar 2022 19:22:33 +0000 (20:22 +0100)
commit0d03011894d23241db1a1cad5c12aede60897d5e
tree5730baad2f6dd3c954e923837ffe731f6135f3ba
parent3c54c95bd917d43d12fe1b192df9aa4c5973449b
fbdev: Improve performance of cfb_imageblit()

Improve the performance of cfb_imageblit() by manually unrolling
the inner blitting loop and moving some invariants out. The compiler
failed to do this automatically. This change keeps cfb_imageblit()
in sync with sys_imagebit().

A microbenchmark measures the average number of CPU cycles
for cfb_imageblit() after a stabilizing period of a few minutes
(i7-4790, FullHD, simpledrm, kernel with debugging).

cfb_imageblit(), new: 15724 cycles
cfb_imageblit(): old: 30566 cycles

In the optimized case, cfb_imageblit() is now ~2x faster than before.

v3:
* fix commit description (Pekka)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220223193804.18636-5-tzimmermann@suse.de
drivers/video/fbdev/core/cfbimgblt.c