Changeset View
Changeset View
Standalone View
Standalone View
stand/common/gfx_fb.c
| Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
| * if palette update is not supported, we still have correct 16 colors. | * if palette update is not supported, we still have correct 16 colors. | ||||
| * Secondly, the kernel does get correct 16 colors when some other boot | * Secondly, the kernel does get correct 16 colors when some other boot | ||||
| * loader is used. However, the palette map for 8-bit colors is using | * loader is used. However, the palette map for 8-bit colors is using | ||||
| * console color ordering - this does allow us to skip translation | * console color ordering - this does allow us to skip translation | ||||
| * from VGA colors to console colors, while we are reading RGB data. | * from VGA colors to console colors, while we are reading RGB data. | ||||
| */ | */ | ||||
| #include <sys/param.h> | #include <sys/param.h> | ||||
| #include <assert.h> | |||||
| #include <stand.h> | #include <stand.h> | ||||
| #include <teken.h> | #include <teken.h> | ||||
| #include <gfx_fb.h> | #include <gfx_fb.h> | ||||
| #include <sys/font.h> | #include <sys/font.h> | ||||
| #include <sys/splash.h> | #include <sys/splash.h> | ||||
| #include <sys/linker.h> | #include <sys/linker.h> | ||||
| #include <sys/module.h> | #include <sys/module.h> | ||||
| #include <sys/stdint.h> | #include <sys/stdint.h> | ||||
| ▲ Show 20 Lines • Show All 757 Lines • ▼ Show 20 Lines | |||||
| gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, | gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, | ||||
| uint32_t SourceX, uint32_t SourceY, | uint32_t SourceX, uint32_t SourceY, | ||||
| uint32_t DestinationX, uint32_t DestinationY, | uint32_t DestinationX, uint32_t DestinationY, | ||||
| uint32_t Width, uint32_t Height, uint32_t Delta) | uint32_t Width, uint32_t Height, uint32_t Delta) | ||||
| { | { | ||||
| int rv; | int rv; | ||||
| #if defined(EFI) | #if defined(EFI) | ||||
| EFI_STATUS status; | EFI_STATUS status; | ||||
| EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = gfx_state.tg_private; | EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; | ||||
tsoome: I think, Instead of adding another condition into if statement, the proper implementation… | |||||
Done Inline ActionsAgreed, gop shouldn't be unconditionally assigned like that. I think we can replace gop != NULL with gfx_state.tg_fb_type == FB_GOP. Since gfx_state.tg_private should always be non-NULL in that case. vexeduxr: Agreed, `gop` shouldn't be unconditionally assigned like that.
I think we can replace `gop !=… | |||||
| EFI_TPL tpl; | EFI_TPL tpl; | ||||
| /* | /* | ||||
| * We assume Blt() does work, if not, we will need to build exception | * We assume Blt() does work, if not, we will need to build exception | ||||
| * list case by case. We only have boot services during part of our | * list case by case. We only have boot services during part of our | ||||
| * exectution. Once terminate boot services, these operations cannot be | * exectution. Once terminate boot services, these operations cannot be | ||||
| * done as they are provided by protocols that disappear when exit | * done as they are provided by protocols that disappear when exit | ||||
| * boot services. | * boot services. | ||||
| */ | */ | ||||
| if (!ignore_gop_blt && gop != NULL && boot_services_active) { | if (gfx_state.tg_fb_type == FB_GOP && !ignore_gop_blt && | ||||
| boot_services_active) { | |||||
| assert(gfx_state.tg_private != NULL); | |||||
| gop = gfx_state.tg_private; | |||||
| tpl = BS->RaiseTPL(TPL_NOTIFY); | tpl = BS->RaiseTPL(TPL_NOTIFY); | ||||
| switch (BltOperation) { | switch (BltOperation) { | ||||
| case GfxFbBltVideoFill: | case GfxFbBltVideoFill: | ||||
| gfxfb_shadow_fill(BltBuffer, DestinationX, | gfxfb_shadow_fill(BltBuffer, DestinationX, | ||||
| DestinationY, Width, Height); | DestinationY, Width, Height); | ||||
| status = gop->Blt(gop, BltBuffer, EfiBltVideoFill, | status = gop->Blt(gop, BltBuffer, EfiBltVideoFill, | ||||
| SourceX, SourceY, DestinationX, DestinationY, | SourceX, SourceY, DestinationX, DestinationY, | ||||
| Width, Height, Delta); | Width, Height, Delta); | ||||
| ▲ Show 20 Lines • Show All 2,262 Lines • Show Last 20 Lines | |||||
I think, Instead of adding another condition into if statement, the proper implementation would be to have conditional assignment for gop. As tg_private may now point to gop or uga, we should not blindly cast the pointer there.
if (gfx_state.tg_fb_type == FB_GOP)
else
and the if statement will do its thing below...