#include <load_elf.h>
|
EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop = nullptr |
|
图形相关
Definition at line 39 of file load_elf.h.
◆ Graphics() [1/3]
构造函数
Definition at line 22 of file graphics.cpp.
23 auto status = LibLocateProtocol(&GraphicsOutputProtocol,
24 reinterpret_cast<void **
>(&
gop));
25 if (EFI_ERROR(status)) {
27 throw std::runtime_error(
"EFI_ERROR(status)");
30 debug << L
"LibLocateProtocol(GraphicsOutputProtocol, &gop) returned "
33 throw std::runtime_error(
"gop == nullptr");
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop
static auto endl(ostream &_ostream) -> ostream &
static ostream debug
全局输出流
◆ ~Graphics()
◆ Graphics() [2/3]
◆ Graphics() [3/3]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ print_info()
void Graphics::print_info |
( |
| ) |
const |
输出图形信息
Definition at line 78 of file graphics.cpp.
79 debug << L
"Current Mode: " <<
gop->Mode->Mode << L
", Version: "
81 <<
gop->Mode->Info->PixelFormat << L
", Horizontal: "
82 <<
gop->Mode->Info->HorizontalResolution << L
", Vertical: "
83 <<
gop->Mode->Info->VerticalResolution << L
", ScanLine: "
84 <<
gop->Mode->Info->PixelsPerScanLine << L
", FrameBufferBase: "
89 for (uint32_t i = 0; i <
gop->Mode->MaxMode; i++) {
90 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info =
nullptr;
91 uint64_t mode_info_size = 0;
92 auto status = uefi_call_wrapper(
gop->QueryMode, 4,
gop, i, &mode_info_size,
94 if (EFI_ERROR(status)) {
96 throw std::runtime_error(
"EFI_ERROR(status)");
100 <<
gop->Mode->Info->Version << L
", Format: "
101 <<
gop->Mode->Info->PixelFormat << L
", Horizontal: "
102 <<
gop->Mode->Info->HorizontalResolution << L
", Vertical: "
103 <<
gop->Mode->Info->VerticalResolution << L
", ScanLine: "
106 status = uefi_call_wrapper(gBS->FreePool, 1, mode_info);
107 if (EFI_ERROR(status)) {
109 throw std::runtime_error(
"EFI_ERROR(status)");
static auto hex_x(ostream &_ostream) -> ostream &
static auto hex_X(ostream &_ostream) -> ostream &
◆ set_mode()
void Graphics::set_mode |
( |
EFI_GRAPHICS_PIXEL_FORMAT |
_format = PixelBlueGreenRedReserved8BitPerColor , |
|
|
uint32_t |
_width = DEFAULT_WIDTH , |
|
|
uint32_t |
_height = DEFAULT_HEIGHT |
|
) |
| const |
设置图形模式
- Parameters
-
_format | 图形像素格式,默认为 PixelBlueGreenRedReserved8BitPerColor |
_width | 宽度,默认为 1920 |
_height | 高度,默认为 1080 |
Definition at line 37 of file graphics.cpp.
39 EFI_STATUS status = EFI_SUCCESS;
41 for (uint32_t i = 0; i <
gop->Mode->MaxMode; i++) {
42 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info =
nullptr;
43 uint64_t mode_info_size = 0;
44 status = uefi_call_wrapper(
gop->QueryMode, 4,
gop, i, &mode_info_size,
46 if (EFI_ERROR(status)) {
48 throw std::runtime_error(
"EFI_ERROR(status)");
51 if ((mode_info->PixelFormat == _format) &&
52 (mode_info->HorizontalResolution == _width) &&
53 (mode_info->VerticalResolution == _height)) {
54 status = uefi_call_wrapper(
gop->SetMode, 2,
gop, i);
55 if (EFI_ERROR(status)) {
57 throw std::runtime_error(
"EFI_ERROR(status)");
60 status = uefi_call_wrapper(gBS->FreePool, 1, mode_info);
61 if (EFI_ERROR(status)) {
63 throw std::runtime_error(
"EFI_ERROR(status)");
67 debug << L
"Current Mode: " <<
gop->Mode->Mode << L
", Version: "
69 <<
gop->Mode->Info->PixelFormat << L
", Horizontal: "
70 <<
gop->Mode->Info->HorizontalResolution << L
", Vertical: "
71 <<
gop->Mode->Info->VerticalResolution << L
", ScanLine: "
72 <<
gop->Mode->Info->PixelsPerScanLine << L
", FrameBufferBase: "
◆ DEFAULT_HEIGHT
constexpr const uint32_t Graphics::DEFAULT_HEIGHT = 1080 |
|
staticconstexprprivate |
◆ DEFAULT_WIDTH
constexpr const uint32_t Graphics::DEFAULT_WIDTH = 1920 |
|
staticconstexprprivate |
◆ gop
EFI_GRAPHICS_OUTPUT_PROTOCOL* Graphics::gop = nullptr |
|
private |
The documentation for this class was generated from the following files:
- /home/runner/work/SimpleKernel/SimpleKernel/src/boot/include/load_elf.h
- /home/runner/work/SimpleKernel/SimpleKernel/src/boot/graphics.cpp