[PATCH 2/5] video console: refactoring and optimization

Dzmitry Sankouski dsankouski at gmail.com
Wed Jan 4 12:17:09 CET 2023


Regarding code-size there's a gain with CONFIG_CONSOLE_ROTATION
enabled, and penalty with disabled:

New:
CONFIG_VIDEO_CONSOLE=y
CONFIG_CONSOLE_ROTATION=y
dzmitry at debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
108208  drivers/video/console_simple.o

CONFIG_VIDEO_CONSOLE=y
# CONFIG_CONSOLE_ROTATION is not set
dzmitry at debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
53848   drivers/video/console_simple.o

Old:
dzmitry at debian:~/side/u-boot$ du --bytes drivers/video/console_normal.o
44728   drivers/video/console_normal.o
dzmitry at debian:~/side/u-boot$ du --bytes drivers/video/console_rotate.o
85424   drivers/video/console_rotate.o

In theory, there should be a small performance penalty for the `if
(direction)` statement -
for every row, and for each pixel. For an 8x16 font, it'll be 144 if statements.

I'll comment on functions in the next patch versions.

пт, 30 дек. 2022 г. в 01:41, Simon Glass <sjg at chromium.org>:
>
> Hi Dzmitry,
>
> On Mon, 26 Dec 2022 at 13:50, Dzmitry Sankouski <dsankouski at gmail.com> wrote:
> >
> > - get rid of code duplications in switch across bpp values
> > - extract common pixel fill logic in two functions one per
> > horizontal and vertical filling
> > - rearrange statements in put_xy* methods in unified way
> > - replace types - uint*_t to u*
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski at gmail.com>
> > ---
> >  drivers/video/console_simple.c | 508 ++++++++++++---------------------
> >  1 file changed, 184 insertions(+), 324 deletions(-)
>
> This looks like a nice tidy up.
>
> Is there a code-size or performance penalty with this? E.g. with
> CONFIG_CONSOLE_ROTATION disabled
>
> Please can you comment the functions property so we know what they do?
>
> Regards,
> Simon


More information about the U-Boot mailing list