public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure
@ 2018-06-19 11:47 Alexander Graf
  2018-06-19 15:46 ` Peter Robinson
  2018-06-19 17:01 ` Heinrich Schuchardt
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Graf @ 2018-06-19 11:47 UTC (permalink / raw)
  To: u-boot

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.

Reported-by: Fabian Vogt <fvogt@suse.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 lib/efi_loader/efi_gop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 1afe8418e1..3a36bbcbfa 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure
  2018-06-19 11:47 [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure Alexander Graf
@ 2018-06-19 15:46 ` Peter Robinson
  2018-06-19 17:01 ` Heinrich Schuchardt
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Robinson @ 2018-06-19 15:46 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 19, 2018 at 12:47 PM, Alexander Graf <agraf@suse.de> wrote:
> 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.
>
> Reported-by: Fabian Vogt <fvogt@suse.com>
> Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

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

> ---
>  lib/efi_loader/efi_gop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
> index 1afe8418e1..3a36bbcbfa 100644
> --- a/lib/efi_loader/efi_gop.c
> +++ b/lib/efi_loader/efi_gop.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure
  2018-06-19 11:47 [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure Alexander Graf
  2018-06-19 15:46 ` Peter Robinson
@ 2018-06-19 17:01 ` Heinrich Schuchardt
  2018-06-21  8:14   ` Anatolij Gustschin
  1 sibling, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2018-06-19 17:01 UTC (permalink / raw)
  To: u-boot

On 06/19/2018 01:47 PM, Alexander Graf wrote:
> 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.
> 
> Reported-by: Fabian Vogt <fvogt@suse.com>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  lib/efi_loader/efi_gop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
> index 1afe8418e1..3a36bbcbfa 100644
> --- a/lib/efi_loader/efi_gop.c
> +++ b/lib/efi_loader/efi_gop.c
> @@ -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?

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>  	gopobj->info.pixels_per_scanline = col;
>  
>  	gopobj->bpix = bpix;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure
  2018-06-19 17:01 ` Heinrich Schuchardt
@ 2018-06-21  8:14   ` Anatolij Gustschin
  0 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2018-06-21  8:14 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Tue, 19 Jun 2018 19:01:06 +0200
Heinrich Schuchardt xypron.glpk at gmx.de wrote:
...
> @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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-21  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-19 11:47 [U-Boot] [PATCH] efi_loader: Fix GOP 32bpp exposure Alexander Graf
2018-06-19 15:46 ` Peter Robinson
2018-06-19 17:01 ` Heinrich Schuchardt
2018-06-21  8:14   ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox