video: Use VIDEO_DAMAGE for VIDEO_COPY
authorAlexander Graf <agraf@csgraf.de>
Thu, 9 Jun 2022 22:59:21 +0000 (00:59 +0200)
committerSimon Glass <sjg@chromium.org>
Thu, 1 May 2025 10:32:45 +0000 (04:32 -0600)
commit70dfd674782adb47a641288925484d6edc8df963
treeb724faa2e63804c31a98e8b6fac815650d963b90
parent4aaa19bd181adf9556b31c3dcd66635ae6594c70
video: Use VIDEO_DAMAGE for VIDEO_COPY

CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we
print a single character, it will always copy the full range of bytes
from the top left corner of the character to the lower right onto the
uncached frame buffer. This includes pretty much the full line contents
of the printed character.

Since we now have proper damage tracking, let's make use of that to reduce
the amount of data we need to copy. With this patch applied, we will only
copy the tiny rectangle surrounding characters when we print them,
speeding up the video console.

After this, changes to the main frame buffer are not immediately copied
to the copy frame buffer, but postponed until the next video device
sync. So issue an explicit sync before inspecting the copy frame buffer
contents for the video tests.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
[Alper: Rebase for fontdata->height/w, fill_part(), fix memmove(dev),
        drop from defconfig, use damage.xstart/yend, use IS_ENABLED(),
        call video_sync() before copy_fb check, update video_copy test]
Co-developed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/u-boot/20230821135111.3558478-12-alpernebiyasak@gmail.com/
configs/sandbox_defconfig
drivers/video/Kconfig
drivers/video/console_normal.c
drivers/video/console_rotate.c
drivers/video/console_truetype.c
drivers/video/vidconsole-uclass.c
drivers/video/video-uclass.c
drivers/video/video_bmp.c
include/video.h
include/video_console.h
test/dm/video.c