[PATCH 2/2] efi: gop: Mark pixel_format as BLTONLY if we have sync hook

Jiaxun Yang jiaxun.yang at flygoat.com
Fri May 17 01:03:25 CEST 2024


If a video device has a video_sync hook, it means some software
intervene is required to scanout framebuffer up on change.

That means EFI application can't just use it as raw framebuffer,
it should call BLT operation to let U-Boot help with scanout.

Mark pixel format as BLTONLY as per UEFI spec to reflect this
nature.

Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
 include/efi_api.h        | 1 +
 lib/efi_loader/efi_gop.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index ab40b1b5ddf6..3eaefb322878 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1399,6 +1399,7 @@ struct efi_hii_config_access_protocol {
 #define EFI_GOT_RGBA8		0
 #define EFI_GOT_BGRA8		1
 #define EFI_GOT_BITMASK		2
+#define EFI_GOT_BLTONLY		3
 
 struct efi_gop_mode_info {
 	u32 version;
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 41e12fa72460..784d43d3d39b 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -467,10 +467,12 @@ efi_status_t efi_gop_register(void)
 	struct efi_gop_obj *gopobj;
 	u32 bpix, format, col, row;
 	u64 fb_base, fb_size;
+	bool needs_sync;
 	efi_status_t ret;
 	struct udevice *vdev;
 	struct video_priv *priv;
 	struct video_uc_plat *plat;
+	struct video_ops *ops;
 
 	/* We only support a single video output device for now */
 	if (uclass_first_device_err(UCLASS_VIDEO, &vdev)) {
@@ -485,6 +487,7 @@ efi_status_t efi_gop_register(void)
 	row = video_get_ysize(vdev);
 
 	plat = dev_get_uclass_plat(vdev);
+	ops = video_get_ops(vid);
 	fb_base = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base;
 	fb_size = plat->size;
 
@@ -529,7 +532,11 @@ efi_status_t efi_gop_register(void)
 	gopobj->info.version = 0;
 	gopobj->info.width = col;
 	gopobj->info.height = row;
-	if (bpix == VIDEO_BPP32)
+
+	if (ops && ops->video_sync) {
+		/* Applications can't really use it as framebuffer */
+		gopobj->info.pixel_format = EFI_GOT_BLTONLY;
+	} else if (bpix == VIDEO_BPP32)
 	{
 		if (format == VIDEO_X2R10G10B10) {
 			gopobj->info.pixel_format = EFI_GOT_BITMASK;

-- 
2.34.1



More information about the U-Boot mailing list