]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
staging: fbtft: Optimize partial write()
authorNam Cao <namcao@linutronix.de>
Mon, 16 Feb 2026 00:57:30 +0000 (07:57 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Feb 2026 14:08:54 +0000 (15:08 +0100)
commit5c05c1ac4baa600f4b6743dabb18e1fb6d64c048
tree31fee10a22b01c45feca7c5bdbbb2c38117a633f
parent6bb9204e2995c9cecf9a5c3051dcdb6ad589423e
staging: fbtft: Optimize partial write()

When user write() only to part of the screen, the driver still updates the
entire screen. That wastes CPU cycles.

Optimize by updating only the changed lines.

Also remove a "special case" in fbtft_mkdirty() as its only user is removed
in this patch.

Tested with an Adafruit ILI9340 (drivers/staging/fbtft/fb_ili9340.c).
Improvement is measured by a pair of trace_printk() at the beginning of
fb_write() and at the end of fbtft_deferred_io().

Update type         Before     After
====================================
full screen         196ms      200ms
half screen         200ms      124ms
quarter screen      193ms       81ms
one pixel           199ms       43ms

It is interesting to note that if the deferred IO's delay time (40ms) is
subtracted, then the time amount scales linearly with the write size.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Link: https://patch.msgid.link/20260216005730.4535-1-namcao@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft-core.c