Skip to contentSkip to conversation

efi_loader: Fix GOP 32bpp exposure

PATCH New Alexander Graf 4 participants 4 messages Jun 19, 2018 – Jun 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi_loader: Fix GOP 32bpp exposure

We store pixels as BGRA in memory, as can be seen from struct efi_gop_pixel. So we need to expose the same format to UEFI payloads to actually have them use the correct colors.

---
 lib/efi_loader/efi_gop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_gop.c +1 -1
index 1afe8418e1..3a36bbcbfa 100644
@@ -472,7 +472,7 @@ efi_status_t efi_gop_register(void)
 	gopobj->info.version = 0;
 	gopobj->info.width = col;
 	gopobj->info.height = row;
-	gopobj->info.pixel_format = EFI_GOT_RGBA8;
+	gopobj->info.pixel_format = EFI_GOT_BGRA8;
 	gopobj->info.pixels_per_scanline = col;
 
 	gopobj->bpix = bpix;
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/1 efi_loader: Fix GOP 32bpp exposure

Quoted 6 lines · Alexander Graf

We store pixels as BGRA in memory, as can be seen from struct efi_gop_pixel. So we need to expose the same format to UEFI payloads to actually have them use the correct colors.

Fixes the blue penguin feet on efi consoles for me on the RPi and Pine64.

Quoted 24 lines
---
 lib/efi_loader/efi_gop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_gop.c +1 -2
index 1afe8418e1..3a36bbcbfa 100644
@@ -472,7 +472,7 @@ efi_status_t efi_gop_register(void)
        gopobj->info.version = 0;
        gopobj->info.width = col;
        gopobj->info.height = row;
-       gopobj->info.pixel_format = EFI_GOT_RGBA8;
+       gopobj->info.pixel_format = EFI_GOT_BGRA8;
        gopobj->info.pixels_per_scanline = col;
 
        gopobj->bpix = bpix;
--

2.12.3

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#2 lore raw

PATCH 1/1 efi_loader: Fix GOP 32bpp exposure

In reply to Alexander Graf
Quoted 15 lines · Alexander Graf

We store pixels as BGRA in memory, as can be seen from struct efi_gop_pixel. So we need to expose the same format to UEFI payloads to actually have them use the correct colors.

---
 lib/efi_loader/efi_gop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_gop.c +0 -0
index 1afe8418e1..3a36bbcbfa 100644

lib/efi_loader/efi_gop.c efi_status_t efi_gop_register(void) · line 475

Quoted 5 lines
lib/efi_loader/efi_gop.c +1 -1
@@ -472,7 +472,7 @@ efi_status_t efi_gop_register(void)
 	gopobj->info.version = 0;
 	gopobj->info.width = col;
 	gopobj->info.height = row;
-	gopobj->info.pixel_format = EFI_GOT_RGBA8;
+	gopobj->info.pixel_format = EFI_GOT_BGRA8;

Graphic cards have been produced both with RGB and BRG bit sequence.

According to the VESA BIOS Extension Core Functions Standard 2.0 describe a pixel we need the RedFieldPosition, GreenFieldPosition, BlueFieldPosition, and RsvdFieldPosition fields as well as RedMaskSize, GreenMaskSize, BlueMaskSize, and RsvdMaskSize.

For the EFI implementation we only have to consider a low endian memory model.

Currently in drivers/video/vidconsole-uclass.c we make the following assumptions:

16bit graphic cards have
red in bits 11..15
green in bits 5..10
blue in bis 0..4

32bit graphic cards have
red in bits 16..23
green in bits 8..15
blue in bis 0..7

of an u16 or u32 pixel.

In efi_vid16_to_blt_col() we make the same assumption.

Structure efi_gop_pixel has sequence blue, green, red, reserved which matches the 32bit assumption in drivers/video/vidconsole-uclass.c.

struct efi_gop_pixel {
        u8 blue;
        u8 green;
        u8 red;
        u8 reserved;
};

So setting pixel_format = EFI_GOT_BGRA8 provides consistency in our implementation but will fail on RGBA graphic cards.

@Anatolij:
Do you have an overview if we have blue in the low bits of the pixels in all low endian U-Boot supported devices?

Quoted 4 lines
lib/efi_loader/efi_gop.c +0 -0
 	gopobj->info.pixels_per_scanline = col;
 
 	gopobj->bpix = bpix;
#3 lore raw

PATCH 1/1 efi_loader: Fix GOP 32bpp exposure

Hi Heinrich,

On Tue, 19 Jun 2018 19:01:06 +0200
Heinrich Schuchardt xypron.glpk at gmx.de wrote:
...

Quoted 3 lines

@Anatolij:
Do you have an overview if we have blue in the low bits of the pixels in all low endian U-Boot supported devices?

No, I don't have such overview.

--
Anatolij