MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / egSetMaxResolution

Function egSetMaxResolution

rEFIt_UEFI/libeg/libscreen.cpp:211–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211EFI_STATUS egSetMaxResolution()
212{
213 EFI_STATUS Status = EFI_UNSUPPORTED;
214 UINT32 Width = 0;
215 UINT32 Height = 0;
216 UINT32 BestMode = 0;
217 UINT32 MaxMode;
218 UINT32 Mode;
219 UINTN SizeOfInfo = 0;
220 EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info = NULL;
221
222 if (GraphicsOutput == NULL) {
223 return EFI_UNSUPPORTED;
224 }
225
226 MsgLog("SetMaxResolution: ");
227 MaxMode = GraphicsOutput->Mode->MaxMode;
228 for (Mode = 0; Mode < MaxMode; Mode++) {
229 Status = GraphicsOutput->QueryMode(GraphicsOutput, Mode, &SizeOfInfo, &Info);
230 if (Status == EFI_SUCCESS) {
231 if (Width > Info->HorizontalResolution) {
232 continue;
233 }
234 if (Height > Info->VerticalResolution) {
235 continue;
236 }
237 Width = Info->HorizontalResolution;
238 Height = Info->VerticalResolution;
239 BestMode = Mode;
240 }
241 }
242 MsgLog("found best mode %d: %dx%d\n", BestMode, Width, Height);
243 // check if requested mode is equal to current mode
244 if (BestMode == GraphicsOutput->Mode->Mode) {
245 MsgLog(" - already set\n");
246 egScreenWidth = GraphicsOutput->Mode->Info->HorizontalResolution;
247 egScreenHeight = GraphicsOutput->Mode->Info->VerticalResolution;
248 Status = EFI_SUCCESS;
249 } else {
250 //Status = GraphicsOutput->SetMode(GraphicsOutput, BestMode);
251 Status = GopSetModeAndReconnectTextOut(BestMode);
252 if (Status == EFI_SUCCESS) {
253 egScreenWidth = Width;
254 egScreenHeight = Height;
255 MsgLog(" - set\n");
256 } else {
257 // we can not set BestMode - search for first one that we can
258 MsgLog(" - %s\n", efiStrError(Status));
259 Status = egSetMode(1);
260 }
261 }
262
263 return Status;
264}
265
266EFI_STATUS egSetMode(INT32 Next)
267{

Callers 1

egInitScreenFunction · 0.85

Calls 3

egSetModeFunction · 0.85
efiStrErrorFunction · 0.50

Tested by

no test coverage detected