uefi error unsupported when opening graphics output protocol

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

uefi error unsupported when opening graphics output protocol

Post by austanss »

Konichiwa, my OS dev friends.

<meme>
I am once again asking for your electoral developmental support.
</meme>

:lol:

Anyway, I've been working on my bootloader. There's a few bugs I need to fix before I can get it booting on real/random hardware. I've fixed majority of them, including a weird serial port dependency bug, a related memory map bug, and an ISO imaging bug.

With all this working, I've decided to test my OS again. It "boots". It'll launch the UEFI app, and stay there. However, there's a graphical bug that really hinders everything. It'll just not open the Graphics Output Protocol. I get an EFI_UNSUPPORTED error. I don't know if it's an error in my code, or a problem with my machine. Either way, it's a critical bug for me if it means I have no way of testing my hopes and dreams. Anyway, I read somewhere that GOP was newer. My machine is relatively older for a UEFI machine (2012). Does my machine just not support GOP?

Supporting information:

--Bootloader Source--
https://github.com/microNET-OS/microCOR ... bootloader

--My Machine--
Model: HP Compaq Elite 8300 CMT (with some storage, ram, and graphics upgrades)
CPU: Intel Core i5-3470 (2012, Ivy Bridge, DDR3-era, Intel HD Graphics 2500)
BIOS: American Megatrends K01 v3.03 (HP version) [version that comes out-of-the-box with my computer is v2.02]
Year: 2012
Chipset: Intel Q77 Express
Misc: contains a serial port
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: uefi error unsupported when opening graphics output prot

Post by nexos »

How old is your machine? It might not support GOP and use UGA instead. I think one of my machines has that problem.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

nexos wrote:How old is your machine? It might not support GOP and use UGA instead. I think one of my machines has that problem.
rizxt wrote:2012
8 years old...

I restated the age of my computer a few times ffs

Also I didn't specify the graphics card I used. My graphics card is a nVidia GTX 1050 Ti, so I don't think I have problems there, as it came out in 2017.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

try this code:

Code: Select all

/* locating GOP. if we have it, we draw boot screen there */
	Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
	if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

zaval wrote:try this code:

Code: Select all

/* locating GOP. if we have it, we draw boot screen there */
	Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
	if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

rizxt wrote:
zaval wrote:try this code:

Code: Select all

/* locating GOP. if we have it, we draw boot screen there */
	Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
	if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
well, if your FW doesn't have GOP, it won't appear magically. there is also ConOut (a combo, collecting SIMPLE_TEXT_OUTPUT_PROTOCOL to various output devices), I don't know why you ignore it and my note about it in yet another thread of yours about UEFI. try using it, it's easier, than GOP, just printing letters onto diplay, my 2011 HP laptop with UEFI does support it fine. :)

Code: Select all

pout = pSystemTable->ConOut;

// ... and then

pout->OutputString(pout, L"lalalalala");
I mean, ConOut will print to all detected output devices, not only to serial port. you definitely should see your print with it on the screen (if you have done all correctly), because FW definitely will attach this to the display. in fact, you can both OutputString() and BitBlt() to the display (if that's a good idea :)).
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

zaval wrote:
rizxt wrote:
zaval wrote:try this code:

Code: Select all

/* locating GOP. if we have it, we draw boot screen there */
	Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
	if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
well, if your FW doesn't have GOP, it won't appear magically. there is also ConOut (a combo, collecting SIMPLE_TEXT_OUTPUT_PROTOCOL to various output devices), I don't know why you ignore it and my note about it in yet another thread of yours about UEFI. try using it, it's easier, than GOP, just printing letters onto diplay, my 2011 HP laptop with UEFI does support it fine. :)

Code: Select all

pout = pSystemTable->ConOut;

// ... and then

pout->OutputString(pout, L"lalalalala");
I mean, ConOut will print to all detected output devices, not only to serial port. you definitely should see your print with it on the screen (if you have done all correctly), because FW definitely will attach this to the display. in fact, you can both OutputString() and BitBlt() to the display (if that's a good idea :)).
There is one big problem with that, and I'll let you try to figure that one out.

(hint: exitbootservices/kernel)
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

you cannot use Boot Services and any protocols after that. you should check for GOP before, take its framebuffer paramateres, if it's present and use them after ExitBootServices(). if your system happened to not have GOP, then
\_(-.-)_/ but, it looks like there is something wrong with your approaches. did you at least check for the GOP presence as in the above example?
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

zaval wrote:you cannot use Boot Services and any protocols after that. you should check for GOP before, take its framebuffer paramateres, if it's present and use them after ExitBootServices(). if your system happened to not have GOP, then
\_(-.-)_/ but, it looks like there is something wrong with your approaches. did you at least check for the GOP presence as in the above example?
I need to use GOP or alternative protocols that work after the boot services bite the dust.

As a side note, I've been attempting to update my BIOS in hopes that it works. (K01 3.03 -> K01 3.08)
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: uefi error unsupported when opening graphics output prot

Post by Octocontrabass »

You can use GOP before ExitBootServices() to find the frame buffer.

You can use the frame buffer after ExitBootServices(), but you'll have to provide your own font in order to display text. You can find more information here.
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

rixzt, you seem to not understand, that all these things (text I/O prtocols, serial protocol, GOP and actually all protocols) are for the OS Loader and not for the OS. the concept is that after you call ExitBootServices() the FW doesn't own the system anymore and except Runtime Services isn't accessible. for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself. if your computer has diplay and is UEFI compliant (most probably), then it does have GOP. so get it through LocateProtocol() and take the needed information (metrics, address, pixels per scanline). then draw to it. if you cannot get GOP (improbably), then you are unlucky with this machine, try emulators.
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by bzt »

rizxt wrote:I need to use GOP or alternative protocols that work after the boot services bite the dust.
There are no alternatives. It is a mandatory protocol for UEFI, it must be supported (so no alternatives exist). If you don't have GOP, that could only mean you have EFI 1.x (and not UEFI), for which only UGA exists.

You can use UGA to set the resolution, but sadly it does not return the frame buffer's address like GOP does, so it sucks big time. You could use UGADraw's blit before ExitBootServices to store some magic bytes on the screen, then iterate on the GetMemoryMap list and match those magic bytes to figure out which memory entry record corresponds to the frame buffer. GRUB for example parses the PCI bus to find the display device and then it reads the PCI BARs to get the frame buffer's address.
rizxt wrote:As a side note, I've been attempting to update my BIOS in hopes that it works. (K01 3.03 -> K01 3.08)
Upgrading from EFI to UEFI would definitely solve your issue of missing GOP. But K01 3.03 -> K01 3.08 doesn't sounds like a major upgrade.

Cheers,
bzt
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: uefi error unsupported when opening graphics output prot

Post by austanss »

zaval wrote:rixzt, you seem to not understand, that all these things (text I/O prtocols, serial protocol, GOP and actually all protocols) are for the OS Loader and not for the OS. the concept is that after you call ExitBootServices() the FW doesn't own the system anymore and except Runtime Services isn't accessible. for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself. if your computer has diplay and is UEFI compliant (most probably), then it does have GOP. so get it through LocateProtocol() and take the needed information (metrics, address, pixels per scanline). then draw to it. if you cannot get GOP (improbably), then you are unlucky with this machine, try emulators.
I know this. However you seem to know nothing about this at all. If you actually used UEFI at all, you must know that I know for a fact that you can use the GOP framebuffer after you exit boot services. It's undeniable. Cold hard evidence.

How can someone so unqualified say that I seem to "not understand"?
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
zaval
Member
Member
Posts: 656
Joined: Fri Feb 17, 2017 4:01 pm
Location: Ukraine, Bachmut
Contact:

Re: uefi error unsupported when opening graphics output prot

Post by zaval »

uhm, excuse me, can you read? then read yet once this:
for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself.
or any other response from several ones from other people, saying to you the same. no more responses from me. because of your clowning.
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: uefi error unsupported when opening graphics output prot

Post by nexos »

@zaval: How would UEFI prevent you from drawing to the framebuffer before ExitBootServices? It has no way of doing so! The OSL is running in kernel mode. It can draw to the framebuffer.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply