]> git.baikalelectronics.ru Git - uboot.git/commitdiff
efi: Support copy framebuffer
authorSimon Glass <sjg@chromium.org>
Fri, 10 Mar 2023 20:47:16 +0000 (12:47 -0800)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 13 Mar 2023 12:53:01 +0000 (13:53 +0100)
Add support for this to EFI in case it becomes useful. At present it just
slows things down. You can enable CONFIG_VIDEO_COPY to turn it on.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/dts/efi-x86_app.dts
drivers/video/efi.c

index 6d843a9820bf72e292b76b849a438ba1aa2488bf..59e2e402d5e5f4d4d131a7cdd6db52370a7422ce 100644 (file)
@@ -27,6 +27,7 @@
        };
        efi-fb {
                compatible = "efi-fb";
+               bootph-some-ram;
        };
 
 };
index 169637c2882951007a8000fb1015c23fe59e3704..28ac15ff61b9484e545546c96936aeab750e2035 100644 (file)
@@ -129,7 +129,6 @@ static int save_vesa_mode(struct vesa_mode_info *vesa, u64 *fbp)
        struct efi_gop_mode_info *info;
        int ret;
 
-       printf("start\n");
        if (IS_ENABLED(CONFIG_EFI_APP))
                ret = get_mode_info(vesa, fbp, &info);
        else
@@ -207,6 +206,30 @@ err:
        return ret;
 }
 
+static int efi_video_bind(struct udevice *dev)
+{
+       if (IS_ENABLED(CONFIG_VIDEO_COPY)) {
+               struct video_uc_plat *plat = dev_get_uclass_plat(dev);
+               struct vesa_mode_info vesa;
+               int ret;
+               u64 fb;
+
+               /*
+                * Initialise vesa_mode_info structure so we can figure out the
+                * required framebuffer size. If something goes wrong, just do
+                * without a copy framebuffer
+                */
+               ret = save_vesa_mode(&vesa, &fb);
+               if (!ret) {
+                       /* this is not reached if the EFI call failed */
+                       plat->copy_size = vesa.bytes_per_scanline *
+                               vesa.y_resolution;
+               }
+       }
+
+       return 0;
+}
+
 static const struct udevice_id efi_video_ids[] = {
        { .compatible = "efi-fb" },
        { }
@@ -216,5 +239,6 @@ U_BOOT_DRIVER(efi_video) = {
        .name   = "efi_video",
        .id     = UCLASS_VIDEO,
        .of_match = efi_video_ids,
+       .bind   = efi_video_bind,
        .probe  = efi_video_probe,
 };