GOP: Difference between revisions

368 bytes added ,  12 days ago
m
no edit summary
[unchecked revision][unchecked revision]
m (Bot: Replace deprecated source tag with syntaxhighlight)
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 17:
</syntaxhighlight>
GOP is the default protocol, so you should be able to locate it on all UEFI firmware. It can probably only fail if you're on an old EFI (pre-UEFI) machine, like an Itanium-based computer or a Mac released before 2009.
 
If your kernel uses GRUB, you need to insert a module called "all_video" before loading the kernel to add UEFI GOP compatibility. Not doing so will display a message saying "WARNING: no console will be available to OS".
<syntaxhighlight lang="c">
insmod all_video
 
menuentry "Example OS" {
multiboot2 /boot/kernel.bin
boot
}
</syntaxhighlight>
 
=== Get the Current Mode ===
Line 38 ⟶ 48:
=== Query Available Video Modes ===
Similarly to VESA, there's no standard mode codes, rather you have a function to query the available modes. Now you know how many modes there are (numModes above), and which one is currently set (nativeMode). You can iterate on the modes and query the information structure for each:
<sourcesyntaxhighlight lang="c">
for (i = 0; i < numModes; i++) {
status = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, &info);
Line 49 ⟶ 59:
);
}
</syntaxhighlight>
</source>
 
=== Set Video Mode and Get the Framebuffer ===