[SeaBIOS] Re: Bootsplash.jpg encoding question.

2022-03-31 Thread Daniel Maslowski via SeaBIOS
Hey,

I've been there and ported lodepng to SeaBIOS because I wanted full
resolution graphics:

https://github.com/orangecms/seabios/tree/png

Might need some rebase and adjustments by now. I tried to upstream this,
but mailing list and git turned out a bit tough for me; there was also a
question on the license. You'd find that here in the archives.

Cheers! :-)

On Thu, 31 Mar 2022, 18:19 Michał Żygowski, 
wrote:

> Hi,
>
> On 31.03.2022 15:25, AreYouLoco? via SeaBIOS wrote:
> > Hi,
> >
> > I am trying to make SeaBIOS on Thinkpad T420 running coreboot display
> bootsplash but I am failing to prepare the file.
> >
> > I tried to export file using GIMP and this info:
> >
> https://puri.sm/wp-content/uploads/2017/02/coreboot-splash-gimp-export-options-annotated.png
> >
> > Relevant part of the coreboot log is:
> > 1508[INFO ] Setting up bootsplash in 1366x768@32
> > 1509[INFO ] CBFS: Found 'bootsplash.jpg' @0x46480 size 0x48e5 in mcache
> @0x7ffdd1c8
> > 1510[DEBUG] Bootsplash image resolution: 1366x768
> > 1511[ERROR] Bootsplash could not be decoded. jpeg_decode returned 4.
> >
> > I also tried to add bootsplash.bmp but then it says it didnt found
> bootsplash.jpg.
> >
> > Any hints?
>
> This is actually a little bit tricky. JPEG decoder in SeaBIOS and
> coreboot allows only images which size granularity is 16 bytes. Sooo:
> 768 pixels / 16 = 48 OK. But 1366 pixels / 16 = 85.375 NOT OK.
>
> You are basically hitting ERR_WIDTH_MISMATCH:
> https://github.com/coreboot/coreboot/blob/master/src/lib/jpeg.c#L292
>
> If you have a nice BMP file, it doesn't have the width/height
> granularity constraints unlike JPEG. coreboot will not decode
> bootsplash.bmp, but SeaBIOS gladly consumes BMP files. Additionally I
> recommend compressing it with LZMA (BMPs are heavy). So on your coreboot
> image I would execute:
>
> cbfstool coreboot.rom add -f path/to/bootsplash.bmp -t raw -n
> bootsplash.bmp.lzma -c lzma -r COREBOOT
>
> The command will add the path/to/bootsplash.bmp file to CBFS under the
> name bootsplash.bmp.lzma with LZMA compression enabled. SeaBIOS is able
> to detect .lzma extension in CBFS files and automatically decompresses
> the files if needed.
>
> Additionally compile SeaBIOS with some debug level, SeaBIOS should be
> able to put it into cbmem console:
> https://github.com/coreboot/seabios/blob/master/src/output.c#L46 in case
> you would need to inspect further issues (BMP may have problem with
> incorrect bpp format - bits per pixel, you need to set a correct one in
> GIMP:
> https://github.com/coreboot/seabios/blob/master/src/bootsplash.c#L178).
>
> Good luck.
> --
> Michał Żygowski
> Firmware Engineer
> GPG: 6B5BA214D21FCEB2
> https://3mdeb.com | @3mdeb_com
> ___
> SeaBIOS mailing list -- seabios@seabios.org
> To unsubscribe send an email to seabios-le...@seabios.org
>
___
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org


[SeaBIOS] Re: Bootsplash.jpg encoding question.

2022-03-31 Thread Michał Żygowski

Hi,

On 31.03.2022 15:25, AreYouLoco? via SeaBIOS wrote:

Hi,

I am trying to make SeaBIOS on Thinkpad T420 running coreboot display 
bootsplash but I am failing to prepare the file.

I tried to export file using GIMP and this info:
https://puri.sm/wp-content/uploads/2017/02/coreboot-splash-gimp-export-options-annotated.png

Relevant part of the coreboot log is:
1508[INFO ] Setting up bootsplash in 1366x768@32
1509[INFO ] CBFS: Found 'bootsplash.jpg' @0x46480 size 0x48e5 in mcache 
@0x7ffdd1c8
1510[DEBUG] Bootsplash image resolution: 1366x768
1511[ERROR] Bootsplash could not be decoded. jpeg_decode returned 4.

I also tried to add bootsplash.bmp but then it says it didnt found 
bootsplash.jpg.

Any hints?


This is actually a little bit tricky. JPEG decoder in SeaBIOS and 
coreboot allows only images which size granularity is 16 bytes. Sooo: 
768 pixels / 16 = 48 OK. But 1366 pixels / 16 = 85.375 NOT OK.


You are basically hitting ERR_WIDTH_MISMATCH:
https://github.com/coreboot/coreboot/blob/master/src/lib/jpeg.c#L292

If you have a nice BMP file, it doesn't have the width/height 
granularity constraints unlike JPEG. coreboot will not decode 
bootsplash.bmp, but SeaBIOS gladly consumes BMP files. Additionally I 
recommend compressing it with LZMA (BMPs are heavy). So on your coreboot 
image I would execute:


cbfstool coreboot.rom add -f path/to/bootsplash.bmp -t raw -n 
bootsplash.bmp.lzma -c lzma -r COREBOOT


The command will add the path/to/bootsplash.bmp file to CBFS under the 
name bootsplash.bmp.lzma with LZMA compression enabled. SeaBIOS is able 
to detect .lzma extension in CBFS files and automatically decompresses 
the files if needed.


Additionally compile SeaBIOS with some debug level, SeaBIOS should be 
able to put it into cbmem console: 
https://github.com/coreboot/seabios/blob/master/src/output.c#L46 in case 
you would need to inspect further issues (BMP may have problem with 
incorrect bpp format - bits per pixel, you need to set a correct one in 
GIMP:

https://github.com/coreboot/seabios/blob/master/src/bootsplash.c#L178).

Good luck.
--
Michał Żygowski
Firmware Engineer
GPG: 6B5BA214D21FCEB2
https://3mdeb.com | @3mdeb_com
___
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org


[SeaBIOS] Bootsplash.jpg encoding question.

2022-03-31 Thread AreYouLoco? via SeaBIOS
Hi,

I am trying to make SeaBIOS on Thinkpad T420 running coreboot display 
bootsplash but I am failing to prepare the file.

I tried to export file using GIMP and this info:
https://puri.sm/wp-content/uploads/2017/02/coreboot-splash-gimp-export-options-annotated.png

Relevant part of the coreboot log is:
1508[INFO ] Setting up bootsplash in 1366x768@32
1509[INFO ] CBFS: Found 'bootsplash.jpg' @0x46480 size 0x48e5 in mcache 
@0x7ffdd1c8
1510[DEBUG] Bootsplash image resolution: 1366x768
1511[ERROR] Bootsplash could not be decoded. jpeg_decode returned 4.

I also tried to add bootsplash.bmp but then it says it didnt found 
bootsplash.jpg.

Any hints?

AreYouLoco?
___
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-le...@seabios.org