[PATCH v3 9/9] video console: add 12x22 console simple font test

Simon Glass sjg at chromium.org
Sat Feb 18 00:49:23 CET 2023


Hi Dzmitry,

On Fri, 17 Feb 2023 at 07:13, Dzmitry Sankouski <dsankouski at gmail.com> wrote:
>
> How does CONSOLE_TRUETYPE interfere with CONFIG_VIDEO_FONT_SUN12X22?
>

I don't mean that.

I tried resyncing the sandbox defconfig, and found that the defconfig
additions in this patch went away, meaning they are not used.

I think I know what is needed:

vidconsole_get_font_size()
 - implement this in vidconsole-uclass.c by calling the method for the
driver. See how this is done with vidconsole_putc_xy(), for example.
You can see this problem if you enable CMD_SELECT_FONT but don't
enable CONSOLE_TRUETYPE

config CMD_SELECT_FONT
- the 'bool' needs to be indented with a tab. I think it is is being
ignored with Kconfig which is why it doesn't work

resync configs with 'make savedefconfig'
- patches should have the CONFIG options (in defconfigs) in the
correct order, and this is how you check it.

>
> I've got all video tests passed:
>
> make sandbox_defconfig && make -j4 && ./u-boot -T -c 'ut dm'
> (...)
> Test: dm_test_video_ansi: video.c
> Test: dm_test_video_base: video.c
> Test: dm_test_video_base: video.c (flat tree)
> Test: dm_test_video_bmp: video.c
> Test: dm_test_video_bmp16: video.c
> Test: dm_test_video_bmp24: video.c
> Test: dm_test_video_bmp24_32: video.c
> Test: dm_test_video_bmp32: video.c
> Test: dm_test_video_bmp8: video.c
> Test: dm_test_video_bmp_comp: video.c
> Test: dm_test_video_chars: video.c
> Test: dm_test_video_comp_bmp32: video.c
> Test: dm_test_video_comp_bmp8: video.c
> Test: dm_test_video_context: video.c
> Test: dm_test_video_rotation1: video.c
> Test: dm_test_video_rotation2: video.c
> Test: dm_test_video_rotation3: video.c
> Test: dm_test_video_text: video.c
> Test: dm_test_video_text_12x22: video.c
> Test: dm_test_video_truetype: video.c
> Test: dm_test_video_truetype_bs: video.c
> Test: dm_test_video_truetype_scroll: video.c
> Test: dm_test_virtio_all_ops: virtio_device.c
> Test: dm_test_virtio_all_ops: virtio_device.c (flat tree)
> Test: dm_test_virtio_base: virtio_device.c
> (...)
>

Yes, as you say, the tests pass and look good. I think my problem was
the above issues.

Regards,
Simon




> чт, 16 февр. 2023 г. в 02:50, Simon Glass <sjg at chromium.org>:
> >
> > Hi Dzmitry,
> >
> > On Wed, 15 Feb 2023 at 04:43, Dzmitry Sankouski <dsankouski at gmail.com> wrote:
> > >
> > > Tests fonts wider than a byte.
> > >
> > > Signed-off-by: Dzmitry Sankouski <dsankouski at gmail.com>
> > > Reviewed-by: Simon Glass <sjg at chromium.org>
> >
> > I found a problem with this
> >
> > > ---
> > > Changes for v2: N/A
> > > Changes for v2: none
> > >
> > >  configs/sandbox_defconfig |  3 +++
> > >  test/dm/video.c           | 41 +++++++++++++++++++++++++++++++++++++++
> > >  2 files changed, 44 insertions(+)
> > >
> > > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> > > index 34c342b6f5..625ca35f5c 100644
> > > --- a/configs/sandbox_defconfig
> > > +++ b/configs/sandbox_defconfig
> > > @@ -337,3 +337,6 @@ CONFIG_TEST_FDTDEC=y
> > >  CONFIG_UNIT_TEST=y
> > >  CONFIG_UT_TIME=y
> > >  CONFIG_UT_DM=y
> > > +CONFIG_CMD_SELECT_FONT=y
> > > +CONFIG_VIDEO_FONT_8X16=y
> > > +CONFIG_VIDEO_FONT_SUN12X22=y
> >
> > I don't think you can enable this, since sandbox uses
> > CONSOLE_TRUETYPE. Can we perhaps use sandbox_flattree to run this
> > test?
> >
> > Also, for me the tests crash with signal 8 (I think).
> >
> > > diff --git a/test/dm/video.c b/test/dm/video.c
> > > index 17a33cc7af..30778157d9 100644
> > > --- a/test/dm/video.c
> > > +++ b/test/dm/video.c
> > > @@ -151,6 +151,8 @@ static int dm_test_video_text(struct unit_test_state *uts)
> > >
> > >         ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > >         ut_assertok(video_get_nologo(uts, &dev));
> > > +       ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > >         ut_asserteq(46, compress_frame_buffer(uts, dev));
> > >
> > >         ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > @@ -175,6 +177,42 @@ static int dm_test_video_text(struct unit_test_state *uts)
> > >  }
> > >  DM_TEST(dm_test_video_text, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > >
> > > +static int dm_test_video_text_12x22(struct unit_test_state *uts)
> > > +{
> > > +       struct udevice *dev, *con;
> > > +       int i;
> > > +
> > > +#define WHITE          0xffff
> > > +#define SCROLL_LINES   100
> > > +
> > > +       ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > > +       ut_assertok(video_get_nologo(uts, &dev));
> > > +       ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       ut_assertok(vidconsole_select_font(con, "12x22", 0));
> > > +       ut_asserteq(46, compress_frame_buffer(uts, dev));
> > > +
> > > +       ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       vidconsole_putc_xy(con, 0, 0, 'a');
> > > +       ut_asserteq(89, compress_frame_buffer(uts, dev));
> > > +
> > > +       vidconsole_putc_xy(con, 0, 0, ' ');
> > > +       ut_asserteq(46, compress_frame_buffer(uts, dev));
> > > +
> > > +       for (i = 0; i < 20; i++)
> > > +               vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
> > > +       ut_asserteq(363, compress_frame_buffer(uts, dev));
> > > +
> > > +       vidconsole_set_row(con, 0, WHITE);
> > > +       ut_asserteq(46, compress_frame_buffer(uts, dev));
> > > +
> > > +       for (i = 0; i < 20; i++)
> > > +               vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
> > > +       ut_asserteq(363, compress_frame_buffer(uts, dev));
> > > +
> > > +       return 0;
> > > +}
> > > +DM_TEST(dm_test_video_text_12x22, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
> > > +
> > >  /* Test handling of special characters in the console */
> > >  static int dm_test_video_chars(struct unit_test_state *uts)
> > >  {
> > > @@ -184,6 +222,7 @@ static int dm_test_video_chars(struct unit_test_state *uts)
> > >         ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > >         ut_assertok(video_get_nologo(uts, &dev));
> > >         ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > >         vidconsole_put_string(con, test_string);
> > >         ut_asserteq(466, compress_frame_buffer(uts, dev));
> > >
> > > @@ -201,6 +240,7 @@ static int dm_test_video_ansi(struct unit_test_state *uts)
> > >         ut_assertok(select_vidconsole(uts, "vidconsole0"));
> > >         ut_assertok(video_get_nologo(uts, &dev));
> > >         ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > >
> > >         /* reference clear: */
> > >         video_clear(con->parent);
> > > @@ -249,6 +289,7 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot,
> > >
> > >         ut_assertok(video_get_nologo(uts, &dev));
> > >         ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
> > > +       ut_assertok(vidconsole_select_font(con, "8x16", 0));
> > >         ut_asserteq(46, compress_frame_buffer(uts, dev));
> > >
> > >         /* Check display wrap */
> > > --
> > > 2.30.2
> > >
> > Regards,
> > Simon


More information about the U-Boot mailing list