Skip to contentSkip to conversation

efifb: BGRT: Add check for new BGRT status field rotation bits

PATCH In review Hans de Goede 3 participants 7 messages May 29, 2019 – Jun 21, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efifb: BGRT: Add check for new BGRT status field rotation bits

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

---
 drivers/video/fbdev/efifb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/video/fbdev/efifb.c +5 -0
index 9f39f0c360e0..dfa8dd47d19d 100644
@@ -169,6 +169,11 @@ static void efifb_show_boot_graphics(struct fb_info *info)
 		return;
 	}
 
+	if (bgrt_tab.status & 0x06) {
+		pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n");
+		return;
+	}
+
 	/* Avoid flashing the logo if we're going to print std probe messages */
 	if (console_loglevel > CONSOLE_LOGLEVEL_QUIET)
 		return;
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

Quoted 7 lines

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

Quoted 23 lines
---
 drivers/video/fbdev/efifb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/video/fbdev/efifb.c +5 -1
index 9f39f0c360e0..dfa8dd47d19d 100644
@@ -169,6 +169,11 @@ static void efifb_show_boot_graphics(struct fb_info *info)
                return;
        }
 
+       if (bgrt_tab.status & 0x06) {
+               pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n");
+               return;
+       }
+
        /* Avoid flashing the logo if we're going to print std probe messages */
        if (console_loglevel > CONSOLE_LOGLEVEL_QUIET)
                return;
--

2.21.0

#2 lore raw
Quoted 10 lines · Ard Biesheuvel
Quoted 8 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

Quoted 7 lines
Quoted 4 lines

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

BTW should we make sure that this patch and the efi-bgrt patch get merged at the same time? I guess the net result is just that we get rid of some error in the log, but a rotated BMP will be ignored otherwise. Or is it relevant for userland in some other way?

#3 lore raw

Hi,

Quoted 14 lines · Ard Biesheuvel
Quoted 13 lines · Ard Biesheuvel
Quoted 11 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

BTW should we make sure that this patch and the efi-bgrt patch get merged at the same time?

The 2 patches are related but merging them at the same time is not necessary.

Quoted 3 lines

I guess the net result is just that we get
rid of some error in the log, but a rotated BMP will be ignored otherwise.

Right, worse case (if the bmp fits pre-rotation) it will be displayed rotated. Note on the one machine I'm aware of which uses these bits the bmp does not fit pre-rotation, so we end up triggering:

error:

         memunmap(bgrt_image);
         pr_warn("efifb: Ignoring BGRT: unexpected or invalid BMP data\n");
}

Which this patch replaces with hitting:

         if (bgrt_tab.status & 0x06) {
                 pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n");
                 return;
         }

Instead. So at least on the one machine I know of this is 99% cosmetic.

Quoted 1 line

Or is it relevant for userland in some other way?

No.

Regards,

Hans

#4 lore raw
Quoted 33 lines · Hans de Goede

Hi,

Quoted 14 lines · Ard Biesheuvel
Quoted 13 lines · Ard Biesheuvel
Quoted 11 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

BTW should we make sure that this patch and the efi-bgrt patch get merged at the same time?

The 2 patches are related but merging them at the same time is not necessary.

Quoted 3 lines

I guess the net result is just that we get
rid of some error in the log, but a rotated BMP will be ignored otherwise.

Quoted 9 lines

Right, worse case (if the bmp fits pre-rotation) it will be displayed rotated. Note on the one machine I'm aware of which uses these bits the bmp does not fit pre-rotation, so we end up triggering:

error:

         memunmap(bgrt_image);
         pr_warn("efifb: Ignoring BGRT: unexpected or invalid BMP data\n");
}

Doesn't that mean we may now end up breaking 'quiet', by exchanging a pr_notice() in the efi-bgrt driver for a pr_warn() in this one?

Quoted 16 lines

Which this patch replaces with hitting:

         if (bgrt_tab.status & 0x06) {
                 pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n");
                 return;
         }

Instead. So at least on the one machine I know of this is 99% cosmetic.

Quoted 1 line

Or is it relevant for userland in some other way?

No.

Regards,

Hans

#5 lore raw

Hi,

Quoted 38 lines · Ard Biesheuvel
Quoted 37 lines · Hans de Goede

Hi,

Quoted 14 lines · Ard Biesheuvel
Quoted 13 lines · Ard Biesheuvel
Quoted 11 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

BTW should we make sure that this patch and the efi-bgrt patch get merged at the same time?

The 2 patches are related but merging them at the same time is not necessary.

Quoted 3 lines

I guess the net result is just that we get
rid of some error in the log, but a rotated BMP will be ignored otherwise.

Right, worse case (if the bmp fits pre-rotation) it will be displayed rotated. Note on the one machine I'm aware of which uses these bits the bmp does not fit pre-rotation, so we end up triggering:

Quoted 8 lines
Quoted 5 lines

error:

          memunmap(bgrt_image);
          pr_warn("efifb: Ignoring BGRT: unexpected or invalid BMP data\n");
}

Doesn't that mean we may now end up breaking 'quiet', by exchanging a pr_notice() in the efi-bgrt driver for a pr_warn() in this one?

quiet has only logged pr_err and more severe for as long as I can remember, so notice / warn does not matter for quiet.

Also for flickerfree boot I've made the quiet cut-off configurable (CONFIG_CONSOLE_LOGLEVEL_QUIET) and in Fedora at least we set it to only show messages at KERN_CRIT and more severe levels, since there are simply too many false-positive pr_err messages in the kernel and I quickly got tired of the whack-a-mole game.

Regards,

Hans

#6 lore raw
In reply to Hans de Goede
Quoted 50 lines · Hans de Goede

Hi,

Quoted 14 lines · Ard Biesheuvel
Quoted 13 lines · Ard Biesheuvel
Quoted 11 lines · Hans de Goede

Starting with ACPI 6.2 bits 1 and 2 of the BGRT status field are no longer reserved. These bits are now used to indicate if the image needs to be rotated before being displayed.

The efifb code does not support rotating the image before copying it to the screen.

This commit adds a check for these new bits and if they are set leaves the fb contents as is instead of trying to use the un-rotated BGRT image.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

BTW should we make sure that this patch and the efi-bgrt patch get merged at the same time?

The 2 patches are related but merging them at the same time is not necessary.

Quoted 3 lines

I guess the net result is just that we get
rid of some error in the log, but a rotated BMP will be ignored otherwise.

Right, worse case (if the bmp fits pre-rotation) it will be displayed rotated. Note on the one machine I'm aware of which uses these bits the bmp does not fit pre-rotation, so we end up triggering:

error:
        memunmap(bgrt_image);
        pr_warn("efifb: Ignoring BGRT: unexpected or invalid BMP data\n"); }

Which this patch replaces with hitting:

        if (bgrt_tab.status & 0x06) {
                pr_info("efifb: BGRT rotation bits set, not showing boot graphics\n"); return;
        }

Instead. So at least on the one machine I know of this is 99% cosmetic.

Quoted 7 lines
Quoted 1 line

Or is it relevant for userland in some other way?

No.

Regards,

Hans

Patch queued for v5.3, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics