Discussion:
Display distortion while booting in native UEFI mode
Łukasz Jendrysik
2017-06-11 17:24:45 UTC
Permalink
Hello,

Today I tried for first time installing openBSD on a physical machine.
You probably figured out that I'm new to openBSD and I hope for your
understanding.

Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached glitch.png.

I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM) and
UEFI Native (without CSM). Didn't notice any meaningful differences though.

Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding this
issue.

Regards,
Lukasz Jendrysik
Lukasz Jendrysik
2017-06-13 16:24:19 UTC
Permalink
Post by Łukasz Jendrysik
Hello,
Today I tried for first time installing openBSD on a physical machine.
You probably figured out that I'm new to openBSD and I hope for your
understanding.
Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached glitch.png.
I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM) and
UEFI Native (without CSM). Didn't notice any meaningful differences though.
Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding this
issue.
Regards,
Lukasz Jendrysik
Hi,

I confirm that this issue also occurs on the latest snapshot from 12th June.

Regards,
Lukasz Jendrysik
dmitry.sensei
2017-06-13 18:11:14 UTC
Permalink
I have the same problem.
diff for Your files:
< efifb0 at mainbus0: 1024x768, 32bpp -> Hybrid
---
efifb0 at mainbus0: 1366x768, 32bpp -> Native
"Didn't notice any meaningful differences though" too :)
Post by Łukasz Jendrysik
Hello,
Today I tried for first time installing openBSD on a physical machine.
You probably figured out that I'm new to openBSD and I hope for your
understanding.
Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached glitch.png.
I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM) and
UEFI Native (without CSM). Didn't notice any meaningful differences though.
Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding this
issue.
Regards,
Lukasz Jendrysik
Hi,
I confirm that this issue also occurs on the latest snapshot from 12th June.
Regards,
Lukasz Jendrysik
--
Dmitry Orlov
Lukasz Jendrysik
2017-06-13 21:05:34 UTC
Permalink
Post by dmitry.sensei
I have the same problem.
< efifb0 at mainbus0: 1024x768, 32bpp -> Hybrid
---
efifb0 at mainbus0: 1366x768, 32bpp -> Native
"Didn't notice any meaningful differences though" too :)
Post by Łukasz Jendrysik
Hello,
Today I tried for first time installing openBSD on a physical machine.
You probably figured out that I'm new to openBSD and I hope for your
understanding.
Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached glitch.png.
I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM) and
UEFI Native (without CSM). Didn't notice any meaningful differences though.
Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding this
issue.
Regards,
Lukasz Jendrysik
Hi,
I confirm that this issue also occurs on the latest snapshot from 12th June.
Regards,
Lukasz Jendrysik
Hello,


Yes, that's the one thing. 1366 isn't the best power of two sum, so it
might be that something failed to account for alignment.

Maybe in native UEFI mode it does not detect the inteldrm or just locks
somewhere.


Have you debug it further?


Regards,

Lukasz Jendrysik
YASUOKA Masahiko
2017-06-15 05:53:21 UTC
Permalink
Hi,

On Sun, 11 Jun 2017 19:24:45 +0200
Post by Łukasz Jendrysik
Today I tried for first time installing openBSD on a physical machine.
You probably figured out that I'm new to openBSD and I hope for your
understanding.
Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached glitch.png.
I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM) and
UEFI Native (without CSM). Didn't notice any meaningful differences though.
Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding this
issue.
Can you test the diff attached at last or

http://yasuoka.net/~yasuoka/BOOTX64.EFI

The boot program is launched, please type "machine test<Enter>" and
show me the result?

diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index 9b6d5fc00fd..0f2613a2a15 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -855,3 +855,59 @@ Xpoweroff_efi(void)
EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL);
return (0);
}
+
+
+int
+Xtest(void)
+{
+ int i, bestmode = -1;
+ EFI_STATUS status;
+ EFI_GRAPHICS_OUTPUT *gop;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
+ *gopi = NULL;
+ UINTN sz, gopsiz, bestsiz = 0;
+
+ status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, (void **)&gop);
+ if (!EFI_ERROR(status)) {
+ for (i = 0; i < gop->Mode->MaxMode; i++) {
+ status = EFI_CALL(gop->QueryMode, gop, i, &sz, &gopi);
+ if (EFI_ERROR(status))
+ continue;
+ gopsiz = gopi->HorizontalResolution *
+ gopi->VerticalResolution;
+ if (gopsiz > bestsiz) {
+ bestmode = i;
+ bestsiz = gopsiz;
+ }
+ }
+ if (bestmode >= 0) {
+ status = EFI_CALL(gop->SetMode, gop, bestmode);
+ if (EFI_ERROR(status) && gop->Mode->Mode != bestmode)
+ printf("GOP setmode failed(%d)\n", status);
+ }
+ gopi = gop->Mode->Info;
+ printf(
+ "FrameBufferBase = 0x%lx\n"
+ "FrameBufferSize = 0x%x\n"
+ "VerticalResolution = %u\n"
+ "HorizontalResolution = %u\n"
+ "PixelsPerScanLine = %u\n"
+ "PixelFormat = %d\n"
+ " RedMask = 0x%lx\n"
+ " GreenMask = 0x%lx\n"
+ " BlueMask = 0x%lx\n"
+ " ReservedMask = 0x%lx\n",
+ gop->Mode->FrameBufferBase,
+ gop->Mode->FrameBufferSize,
+ gopi->VerticalResolution,
+ gopi->HorizontalResolution,
+ gopi->PixelsPerScanLine,
+ gopi->PixelFormat,
+ gopi->PixelInformation.RedMask,
+ gopi->PixelInformation.GreenMask,
+ gopi->PixelInformation.BlueMask,
+ gopi->PixelInformation.ReservedMask);
+ }
+
+ return (0);
+}
diff --git a/sys/arch/amd64/stand/libsa/cmd_i386.c b/sys/arch/amd64/stand/libsa/cmd_i386.c
index 592cca49547..d5c014ad31b 100644
--- a/sys/arch/amd64/stand/libsa/cmd_i386.c
+++ b/sys/arch/amd64/stand/libsa/cmd_i386.c
@@ -40,6 +40,7 @@
#ifdef EFIBOOT
#include "efiboot.h"
#include "efidev.h"
+int Xtest(void);
#endif

extern const char version[];
@@ -64,6 +65,7 @@ const struct cmd_table cmd_machine[] = {
{ "video", CMDT_CMD, Xvideo_efi },
{ "exit", CMDT_CMD, Xexit_efi },
{ "poweroff", CMDT_CMD, Xpoweroff_efi },
+ { "test", CMDT_CMD, Xtest },
#endif
#ifdef DEBUG
{ "regs", CMDT_CMD, Xregs },
Dmitry Orlov
2017-06-15 19:14:44 UTC
Permalink
Hi.
Thanks. I'll test it asap
Post by YASUOKA Masahiko
Hi,
On Sun, 11 Jun 2017 19:24:45 +0200
Post by Łukasz Jendrysik
Today I tried for first time installing openBSD on a physical
machine.
Post by Łukasz Jendrysik
You probably figured out that I'm new to openBSD and I hope for your
understanding.
Now to the point: when I boot in UEFI native mode (without CSM), my
display gets crazy producing fancy glitch art, see attached
glitch.png.
Post by Łukasz Jendrysik
I also attach dmesg from both boot modes -- UEFI Hybrid (with CSM)
and
Post by Łukasz Jendrysik
UEFI Native (without CSM). Didn't notice any meaningful differences
though.
Post by Łukasz Jendrysik
Tested on HP EliteBook 2570p and openBSD 6.1 amd64. Unfortunately I
didn't test -current yet.
Please let me know if I can provide you with any details regarding
this
Post by Łukasz Jendrysik
issue.
Can you test the diff attached at last or
http://yasuoka.net/~yasuoka/BOOTX64.EFI
The boot program is launched, please type "machine test<Enter>" and
show me the result?
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c
b/sys/arch/amd64/stand/efiboot/efiboot.c
index 9b6d5fc00fd..0f2613a2a15 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -855,3 +855,59 @@ Xpoweroff_efi(void)
EFI_CALL(RS->ResetSystem, EfiResetShutdown, EFI_SUCCESS, 0, NULL);
return (0);
}
+
+
+int
+Xtest(void)
+{
+ int i, bestmode = -1;
+ EFI_STATUS status;
+ EFI_GRAPHICS_OUTPUT *gop;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
+ *gopi = NULL;
+ UINTN sz, gopsiz, bestsiz = 0;
+
+ status = EFI_CALL(BS->LocateProtocol, &gop_guid, NULL, (void
**)&gop);
+ if (!EFI_ERROR(status)) {
+ for (i = 0; i < gop->Mode->MaxMode; i++) {
+ status = EFI_CALL(gop->QueryMode, gop, i, &sz, &gopi);
+ if (EFI_ERROR(status))
+ continue;
+ gopsiz = gopi->HorizontalResolution *
+ gopi->VerticalResolution;
+ if (gopsiz > bestsiz) {
+ bestmode = i;
+ bestsiz = gopsiz;
+ }
+ }
+ if (bestmode >= 0) {
+ status = EFI_CALL(gop->SetMode, gop, bestmode);
+ if (EFI_ERROR(status) && gop->Mode->Mode != bestmode)
+ printf("GOP setmode failed(%d)\n", status);
+ }
+ gopi = gop->Mode->Info;
+ printf(
+ "FrameBufferBase = 0x%lx\n"
+ "FrameBufferSize = 0x%x\n"
+ "VerticalResolution = %u\n"
+ "HorizontalResolution = %u\n"
+ "PixelsPerScanLine = %u\n"
+ "PixelFormat = %d\n"
+ " RedMask = 0x%lx\n"
+ " GreenMask = 0x%lx\n"
+ " BlueMask = 0x%lx\n"
+ " ReservedMask = 0x%lx\n",
+ gop->Mode->FrameBufferBase,
+ gop->Mode->FrameBufferSize,
+ gopi->VerticalResolution,
+ gopi->HorizontalResolution,
+ gopi->PixelsPerScanLine,
+ gopi->PixelFormat,
+ gopi->PixelInformation.RedMask,
+ gopi->PixelInformation.GreenMask,
+ gopi->PixelInformation.BlueMask,
+ gopi->PixelInformation.ReservedMask);
+ }
+
+ return (0);
+}
diff --git a/sys/arch/amd64/stand/libsa/cmd_i386.c
b/sys/arch/amd64/stand/libsa/cmd_i386.c
index 592cca49547..d5c014ad31b 100644
--- a/sys/arch/amd64/stand/libsa/cmd_i386.c
+++ b/sys/arch/amd64/stand/libsa/cmd_i386.c
@@ -40,6 +40,7 @@
#ifdef EFIBOOT
#include "efiboot.h"
#include "efidev.h"
+int Xtest(void);
#endif
extern const char version[];
@@ -64,6 +65,7 @@ const struct cmd_table cmd_machine[] = {
{ "video", CMDT_CMD, Xvideo_efi },
{ "exit", CMDT_CMD, Xexit_efi },
{ "poweroff", CMDT_CMD, Xpoweroff_efi },
+ { "test", CMDT_CMD, Xtest },
#endif
#ifdef DEBUG
{ "regs", CMDT_CMD, Xregs },
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Lukasz Jendrysik
2017-06-15 19:42:22 UTC
Permalink
Hello,


Please accept my apologies for this delay.

Picture attached since it seems that's not possible to save the output
on EFI System Partition.
Post by YASUOKA Masahiko
Can you test the diff attached at last or
http://yasuoka.net/~yasuoka/BOOTX64.EFI
The boot program is launched, please type "machine test<Enter>" and
show me the result?
dmitry.sensei
2017-06-16 04:29:50 UTC
Permalink
FrameBufferBase = 0xc0000000
FrameBufferSize = 0x40000000
VerticalResolution = 768
HorizontalResolution = 1366
PixelsPerScanLine = 1366
PixelFormat = 1
RedMask = 0x0
GreenMask = 0x0
BlueMask = 0x0
ReservedMask = 0x0
Post by Łukasz Jendrysik
Hello,
Please accept my apologies for this delay.
Picture attached since it seems that's not possible to save the output
on EFI System Partition.
Post by YASUOKA Masahiko
Can you test the diff attached at last or
http://yasuoka.net/~yasuoka/BOOTX64.EFI
The boot program is launched, please type "machine test<Enter>" and
show me the result?
--
Dmitry Orlov
YASUOKA Masahiko
2017-06-22 06:27:21 UTC
Permalink
Hi,

On Fri, 16 Jun 2017 09:29:50 +0500
Post by dmitry.sensei
FrameBufferBase = 0xc0000000
FrameBufferSize = 0x40000000
VerticalResolution = 768
HorizontalResolution = 1366
PixelsPerScanLine = 1366
PixelFormat = 1
RedMask = 0x0
GreenMask = 0x0
BlueMask = 0x0
ReservedMask = 0x0
Thanks,

Can you test the diff for the kernel?

diff --git a/sys/arch/amd64/amd64/efifb.c b/sys/arch/amd64/amd64/efifb.c
index 2418354beaf..3e73fe5fafe 100644
--- a/sys/arch/amd64/amd64/efifb.c
+++ b/sys/arch/amd64/amd64/efifb.c
@@ -361,6 +361,7 @@ int
efifb_cnattach(void)
{
struct efifb *fb = &efifb_console;
+ int pixpsl;

if (bios_efiinfo == NULL || bios_efiinfo->fb_addr == 0)
return (-1);
@@ -373,8 +374,8 @@ efifb_cnattach(void)
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_green_mask));
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_blue_mask));
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_reserved_mask));
- fb->psize = bios_efiinfo->fb_height *
- bios_efiinfo->fb_pixpsl * (fb->depth / 8);
+ pixpsl = (bios_efiinfo->fb_pixpsl + 7) & 7; /* align 8 bytes */
+ fb->psize = bios_efiinfo->fb_height * pixpsl * (fb->depth / 8);

efifb_rasops_init();
Dmitry Orlov
2017-06-22 15:30:02 UTC
Permalink
Yes. If You send link to binary
Post by YASUOKA Masahiko
Hi,
On Fri, 16 Jun 2017 09:29:50 +0500
Post by dmitry.sensei
FrameBufferBase = 0xc0000000
FrameBufferSize = 0x40000000
VerticalResolution = 768
HorizontalResolution = 1366
PixelsPerScanLine = 1366
PixelFormat = 1
RedMask = 0x0
GreenMask = 0x0
BlueMask = 0x0
ReservedMask = 0x0
Thanks,
Can you test the diff for the kernel?
diff --git a/sys/arch/amd64/amd64/efifb.c
b/sys/arch/amd64/amd64/efifb.c
index 2418354beaf..3e73fe5fafe 100644
--- a/sys/arch/amd64/amd64/efifb.c
+++ b/sys/arch/amd64/amd64/efifb.c
@@ -361,6 +361,7 @@ int
efifb_cnattach(void)
{
struct efifb *fb = &efifb_console;
+ int pixpsl;
if (bios_efiinfo == NULL || bios_efiinfo->fb_addr == 0)
return (-1);
@@ -373,8 +374,8 @@ efifb_cnattach(void)
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_green_mask));
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_blue_mask));
fb->depth = max(fb->depth, fls(bios_efiinfo->fb_reserved_mask));
- fb->psize = bios_efiinfo->fb_height *
- bios_efiinfo->fb_pixpsl * (fb->depth / 8);
+ pixpsl = (bios_efiinfo->fb_pixpsl + 7) & 7; /* align 8 bytes */
+ fb->psize = bios_efiinfo->fb_height * pixpsl * (fb->depth / 8);
efifb_rasops_init();
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Lukasz Jendrysik
2017-06-22 17:15:08 UTC
Permalink
Hi,


I will try to get it done tonight (CEST).

I will let you know once it's done.
Post by YASUOKA Masahiko
Can you test the diff for the kernel?
Lukasz Jendrysik
2017-06-22 21:14:47 UTC
Permalink
Okay, so I finally have a while to test your diff.
Unfortunately the issue still persists, but dmesg output is different
now especially when it comes to efifb.

dmesgNative:efifb0 at mainbus0: 1366x768, 32bpp
dmesgNative:wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation),
using wskbd0
dmesgNativePatched:efifb at mainbus0 not configured

Full dmesg output attached.

Please let me know if I can provide you with any other information
required for further analysis.

Thanks.
Post by YASUOKA Masahiko
Can you test the diff for the kernel?
YASUOKA Masahiko
2017-06-22 23:07:52 UTC
Permalink
Thanks,

The diff doesn't seem to fix the problem.

I think horizontal resolution 1366 is the key of the problem and efifb
need a workaround for it.

On Thu, 22 Jun 2017 23:14:47 +0200
Post by Lukasz Jendrysik
Okay, so I finally have a while to test your diff.
Unfortunately the issue still persists, but dmesg output is different
now especially when it comes to efifb.
dmesgNative:efifb0 at mainbus0: 1366x768, 32bpp
dmesgNative:wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation),
using wskbd0
dmesgNativePatched:efifb at mainbus0 not configured
Full dmesg output attached.
Please let me know if I can provide you with any other information
required for further analysis.
Thanks.
Post by YASUOKA Masahiko
Can you test the diff for the kernel?
Lukasz Jendrysik
2017-06-24 19:45:16 UTC
Permalink
I have to admit that 1366 is not the best power of two sum.
Unfortunately I'm not able to help you with the fix, but please let me
know if there is any information I could provide you with.
Post by YASUOKA Masahiko
I think horizontal resolution 1366 is the key of the problem and efifb
need a workaround for it.
dmitry.sensei
2017-07-01 07:30:48 UTC
Permalink
In build from 20179629 is not fixed yet
Post by Lukasz Jendrysik
I have to admit that 1366 is not the best power of two sum.
Unfortunately I'm not able to help you with the fix, but please let me
know if there is any information I could provide you with.
Post by YASUOKA Masahiko
I think horizontal resolution 1366 is the key of the problem and efifb
need a workaround for it.
--
Dmitry Orlov
dmitry.sensei
2017-07-01 07:31:07 UTC
Permalink
96 = 06 :D
Post by dmitry.sensei
In build from 20179629 is not fixed yet
Post by Lukasz Jendrysik
I have to admit that 1366 is not the best power of two sum.
Unfortunately I'm not able to help you with the fix, but please let me
know if there is any information I could provide you with.
Post by YASUOKA Masahiko
I think horizontal resolution 1366 is the key of the problem and efifb
need a workaround for it.
--
Dmitry Orlov
--
Dmitry Orlov
Loading...