Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/loader/framebuffer.c
Show First 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga) | ||||
* We finalized on the stride, so recalculate the size of the | * We finalized on the stride, so recalculate the size of the | ||||
* frame buffer. | * frame buffer. | ||||
*/ | */ | ||||
efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; | efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; | ||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
efi_find_framebuffer(struct efi_fb *efifb) | efi_find_framebuffer(teken_gfx_t *gfx_state) | ||||
{ | { | ||||
struct efi_fb efifb; | |||||
EFI_GRAPHICS_OUTPUT *gop; | EFI_GRAPHICS_OUTPUT *gop; | ||||
EFI_UGA_DRAW_PROTOCOL *uga; | EFI_UGA_DRAW_PROTOCOL *uga; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
int rv; | |||||
status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); | gfx_state->tg_fb_type = FB_TEXT; | ||||
if (status == EFI_SUCCESS) | |||||
return (efifb_from_gop(efifb, gop->Mode, gop->Mode->Info)); | |||||
status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); | |||||
if (status == EFI_SUCCESS) { | |||||
gfx_state->tg_fb_type = FB_GOP; | |||||
gfx_state->tg_private = gop; | |||||
} else { | |||||
status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); | status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); | ||||
if (status == EFI_SUCCESS) | if (status == EFI_SUCCESS) { | ||||
return (efifb_from_uga(efifb, uga)); | gfx_state->tg_fb_type = FB_UGA; | ||||
gfx_state->tg_private = uga; | |||||
} else { | |||||
return (1); | |||||
} | |||||
} | |||||
switch (gfx_state->tg_fb_type) { | |||||
case FB_GOP: | |||||
rv = efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); | |||||
break; | |||||
case FB_UGA: | |||||
rv = efifb_from_uga(&efifb, uga); | |||||
break; | |||||
default: | |||||
return (1); | return (1); | ||||
} | |||||
gfx_state->tg_fb.fb_addr = efifb.fb_addr; | |||||
gfx_state->tg_fb.fb_size = efifb.fb_size; | |||||
gfx_state->tg_fb.fb_height = efifb.fb_height; | |||||
gfx_state->tg_fb.fb_width = efifb.fb_width; | |||||
gfx_state->tg_fb.fb_stride = efifb.fb_stride; | |||||
gfx_state->tg_fb.fb_mask_red = efifb.fb_mask_red; | |||||
gfx_state->tg_fb.fb_mask_green = efifb.fb_mask_green; | |||||
gfx_state->tg_fb.fb_mask_blue = efifb.fb_mask_blue; | |||||
gfx_state->tg_fb.fb_mask_reserved = efifb.fb_mask_reserved; | |||||
gfx_state->tg_fb.fb_bpp = fls(efifb.fb_mask_red | efifb.fb_mask_green | | |||||
efifb.fb_mask_blue | efifb.fb_mask_reserved); | |||||
return (0); | |||||
} | } | ||||
static void | static void | ||||
print_efifb(int mode, struct efi_fb *efifb, int verbose) | print_efifb(int mode, struct efi_fb *efifb, int verbose) | ||||
{ | { | ||||
u_int depth; | u_int depth; | ||||
if (mode >= 0) | if (mode >= 0) | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |