[U-Boot] [RFC PATCH 2/2] efi_loader: gop: add support to use cfb_console's framebuffer
Icenowy Zheng
icenowy at aosc.xyz
Tue Feb 7 12:58:12 UTC 2017
As cfb_console now can expose its GraphicDevice, use it in the
implementation of EFI GOP protocol, so that the graphics framebuffer can
be passed to EFI applications.
Signed-off-by: Icenowy Zheng <icenowy at aosc.xyz>
---
Tested on an Allwinner H3 board with out-of-tree display support.
cmd/bootefi.c | 2 +-
lib/efi_loader/Makefile | 1 +
lib/efi_loader/efi_gop.c | 29 ++++++++++++++++++++++++-----
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 97a0fc9c7c..c0636ba5a3 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -210,7 +210,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
#ifdef CONFIG_PARTITIONS
efi_disk_register();
#endif
-#ifdef CONFIG_LCD
+#if defined CONFIG_LCD || defined CONFIG_CFB_CONSOLE
efi_gop_register();
#endif
#ifdef CONFIG_NET
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index fa8b91a526..e88c99528c 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
obj-y += efi_memory.o
obj-$(CONFIG_LCD) += efi_gop.o
+obj-$(CONFIG_CFB_CONSOLE) += efi_gop.o
obj-$(CONFIG_PARTITIONS) += efi_disk.o
obj-$(CONFIG_NET) += efi_net.o
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 286ad83097..86f9aa2d70 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -13,6 +13,7 @@
#include <lcd.h>
#include <malloc.h>
#include <video.h>
+#include <video_fb.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -80,8 +81,10 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer,
switch (gopobj->bpix) {
#ifdef CONFIG_DM_VIDEO
case VIDEO_BPP32:
-#else
+#elif defined CONFIG_LCD
case LCD_COLOR32:
+#elif defined CONFIG_CFB_CONSOLE
+ case GDF_32BIT_X888RGB:
#endif
for (i = 0; i < height; i++) {
u32 *dest = fb + ((i + dy) * line_len32) +
@@ -117,7 +120,7 @@ static efi_status_t EFIAPI gop_blt(struct efi_gop *this, void *buffer,
#ifdef CONFIG_DM_VIDEO
video_sync_all();
-#else
+#elif defined CONFIG_LCD
lcd_sync();
#endif
@@ -144,7 +147,7 @@ int efi_gop_register(void)
row = video_get_ysize(vdev);
fb_base = (uintptr_t)priv->fb;
fb_size = priv->fb_size;
-#else
+#elif defined CONFIG_LCD
int line_len;
bpix = panel_info.vl_bpix;
@@ -152,15 +155,29 @@ int efi_gop_register(void)
row = panel_info.vl_row;
fb_base = gd->fb_base;
fb_size = lcd_get_size(&line_len);
+#elif defined CONFIG_CFB_CONSOLE
+ GraphicDevice *pGD;
+
+ pGD = video_get_graphic_device();
+ bpix = pGD->gdfIndex;
+ col = pGD->winSizeX;
+ row = pGD->winSizeY;
+ fb_base = pGD->frameAdrs;
+ if (pGD->memSize)
+ fb_size = pGD->memSize;
+ else
+ fb_size = pGD->plnSizeX * row;
#endif
switch (bpix) {
#ifdef CONFIG_DM_VIDEO
case VIDEO_BPP16:
case VIDEO_BPP32:
-#else
+#elif defined CONFIG_LCD
case LCD_COLOR32:
case LCD_COLOR16:
+#elif defined CONFIG_CFB_CONSOLE
+ case GDF_32BIT_X888RGB:
#endif
break;
default:
@@ -185,8 +202,10 @@ int efi_gop_register(void)
#ifdef CONFIG_DM_VIDEO
if (bpix == VIDEO_BPP32) {
-#else
+#elif defined CONFIG_LCD
if (bpix == LCD_COLOR32) {
+#elif defined CONFIG_CFB_CONSOLE
+ if (bpix == GDF_32BIT_X888RGB) {
#endif
/* With 32bit color space we can directly expose the fb */
gopobj->mode.fb_base = fb_base;
--
2.11.0
More information about the U-Boot
mailing list