[PATCH 0/4] Simplefb and fb reservation related updates

This adds support for simple-framebuffer reservation using video handoff when splash is enabled at SPL stage.
Also adds helper function to only enable framebuffer reservation without enabling simple-framebuffer in case user want to continue display bootloader splash without displaying anything else in between until kernel boots up.
Lastly, it enables above support on AM62x.
Devarsh Thakkar (4): boot: fdt_simplefb: Enumerate framebuffer info from video handoff video: Assume video to be active if SPL is passing video hand-off boot: Move framebuffer reservation to separate helper board: ti: am62x: evm: Update simple-framebuffer node in device-tree
board/ti/am62x/evm.c | 19 +++++++++++++++ boot/fdt_simplefb.c | 46 ++++++++++++++++++++---------------- boot/fdt_support.c | 21 ++++++++++++++++ drivers/video/video-uclass.c | 4 ++++ include/fdt_support.h | 2 ++ 5 files changed, 72 insertions(+), 20 deletions(-)

Enable and update simple-framebuffer node using the video handoff bloblist if video was enabled at SPL stage and corresponding video bloblist was received at u-boot proper with necessary parameters.
Signed-off-by: Devarsh Thakkar devarsht@ti.com --- boot/fdt_simplefb.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index 069ced75a7..b0221eaf2a 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -12,6 +12,8 @@ #include <asm/global_data.h> #include <linux/libfdt.h> #include <video.h> +#include <spl.h> +#include <bloblist.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -26,15 +28,29 @@ static int fdt_simplefb_configure_node(void *blob, int off) struct udevice *dev; int ret;
- ret = uclass_first_device_err(UCLASS_VIDEO, &dev); - if (ret) - return ret; - uc_priv = dev_get_uclass_priv(dev); - plat = dev_get_uclass_plat(dev); - xsize = uc_priv->xsize; - ysize = uc_priv->ysize; - bpix = uc_priv->bpix; - fb_base = plat->base; + if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) { + struct video_handoff *ho; + + ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho)); + if (!ho) + return log_msg_ret("Missing video bloblist", -ENOENT); + + xsize = ho->xsize; + ysize = ho->ysize; + bpix = ho->bpix; + fb_base = ho->fb; + } else { + ret = uclass_first_device_err(UCLASS_VIDEO, &dev); + if (ret) + return ret; + uc_priv = dev_get_uclass_priv(dev); + plat = dev_get_uclass_plat(dev); + xsize = uc_priv->xsize; + ysize = uc_priv->ysize; + bpix = uc_priv->bpix; + fb_base = plat->base; + } + switch (bpix) { case 4: /* VIDEO_BPP16 */ name = "r5g6b5";

Hi Devarsh,
On 22/02/24 18:38, Devarsh Thakkar wrote:
Enable and update simple-framebuffer node using the video handoff bloblist if video was enabled at SPL stage and corresponding video bloblist was received at u-boot proper with necessary parameters.
Signed-off-by: Devarsh Thakkar devarsht@ti.com
boot/fdt_simplefb.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
Reviewed-by: Nikhil M Jain n-jain1@ti.com
diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index 069ced75a7..b0221eaf2a 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -12,6 +12,8 @@ #include <asm/global_data.h> #include <linux/libfdt.h> #include <video.h> +#include <spl.h> +#include <bloblist.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -26,15 +28,29 @@ static int fdt_simplefb_configure_node(void *blob, int off) struct udevice *dev; int ret;
- ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
- if (ret)
return ret;
- uc_priv = dev_get_uclass_priv(dev);
- plat = dev_get_uclass_plat(dev);
- xsize = uc_priv->xsize;
- ysize = uc_priv->ysize;
- bpix = uc_priv->bpix;
- fb_base = plat->base;
- if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
struct video_handoff *ho;
ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho));
if (!ho)
return log_msg_ret("Missing video bloblist", -ENOENT);
xsize = ho->xsize;
ysize = ho->ysize;
bpix = ho->bpix;
fb_base = ho->fb;
- } else {
ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
if (ret)
return ret;
uc_priv = dev_get_uclass_priv(dev);
plat = dev_get_uclass_plat(dev);
xsize = uc_priv->xsize;
ysize = uc_priv->ysize;
bpix = uc_priv->bpix;
fb_base = plat->base;
- }
- switch (bpix) { case 4: /* VIDEO_BPP16 */ name = "r5g6b5";
Thanks,
Nikhil

If SPL is passing video handoff structure to U-boot then it is safe to assume that SPL has already enabled video and that's why it is passing video handoff structure to U-boot so that U-boot can preserve the framebuffer.
Signed-off-by: Devarsh Thakkar devarsht@ti.com --- drivers/video/video-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 3571e62ba2..7b5d1dfbb3 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -404,6 +404,10 @@ bool video_is_active(void) { struct udevice *dev;
+ /* Assume video to be active if SPL passed video hand-off to U-boot */ + if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) + return true; + for (uclass_find_first_device(UCLASS_VIDEO, &dev); dev; uclass_find_next_device(&dev)) {

Hi Devarsh,
On 22/02/24 18:38, Devarsh Thakkar wrote:
If SPL is passing video handoff structure to U-boot then it is safe to assume that SPL has already enabled video and that's why it is passing video handoff structure to U-boot so that U-boot can preserve the framebuffer.
Signed-off-by: Devarsh Thakkar devarsht@ti.com
drivers/video/video-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Nikhil M Jain n-jain1@ti.com
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 3571e62ba2..7b5d1dfbb3 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -404,6 +404,10 @@ bool video_is_active(void) { struct udevice *dev;
- /* Assume video to be active if SPL passed video hand-off to U-boot */
- if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL)
return true;
- for (uclass_find_first_device(UCLASS_VIDEO, &dev); dev; uclass_find_next_device(&dev)) {
Thanks,
Nikhil

Create separate helper for just reserving framebuffer region without creating or enabling simple-framebuffer node.
This is useful for scenarios where user want to preserve the bootloader splash screen till OS boots up and display server gets started without displaying anything else in between and thus not requiring simple-framebuffer.
Signed-off-by: Devarsh Thakkar devarsht@ti.com --- boot/fdt_simplefb.c | 12 +----------- boot/fdt_support.c | 21 +++++++++++++++++++++ include/fdt_support.h | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index b0221eaf2a..837920bd3a 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -107,7 +107,6 @@ static int fdt_simplefb_enable_existing_node(void *blob) #if IS_ENABLED(CONFIG_VIDEO) int fdt_simplefb_enable_and_mem_rsv(void *blob) { - struct fdt_memory mem; int ret;
/* nothing to do when video is not active */ @@ -118,15 +117,6 @@ int fdt_simplefb_enable_and_mem_rsv(void *blob) if (ret) return ret;
- /* nothing to do when the frame buffer is not defined */ - if (gd->video_bottom == gd->video_top) - return 0; - - /* reserved with no-map tag the video buffer */ - mem.start = gd->video_bottom; - mem.end = gd->video_top - 1; - - return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL, - FDTDEC_RESERVED_MEMORY_NO_MAP); + return fdt_add_fb_mem_rsv(blob); } #endif diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 090d82ee80..07aa7337e8 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -22,6 +22,9 @@ #include <exports.h> #include <fdtdec.h> #include <version.h> +#include <video.h> + +DECLARE_GLOBAL_DATA_PTR;
/** * fdt_getprop_u32_default_node - Return a node's property or a default @@ -2042,6 +2045,24 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, return 0; }
+#if IS_ENABLED(CONFIG_VIDEO) +int fdt_add_fb_mem_rsv(void *blob) +{ + struct fdt_memory mem; + + /* nothing to do when the frame buffer is not defined */ + if (gd->video_bottom == gd->video_top) + return 0; + + /* reserved with no-map tag the video buffer */ + mem.start = gd->video_bottom; + mem.end = gd->video_top - 1; + + return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL, + FDTDEC_RESERVED_MEMORY_NO_MAP); +} +#endif + /* * Update native-mode in display-timings from display environment variable. * The node to update are specified by path. diff --git a/include/fdt_support.h b/include/fdt_support.h index 25600d62f2..4b71b8948d 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -423,6 +423,8 @@ int arch_fixup_memory_node(void *blob); int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, u32 height, u32 stride, const char *format);
+int fdt_add_fb_mem_rsv(void *blob); + int fdt_overlay_apply_verbose(void *fdt, void *fdto);
int fdt_valid(struct fdt_header **blobp);

Hi Devarsh,
On 22/02/24 18:38, Devarsh Thakkar wrote:
Create separate helper for just reserving framebuffer region without creating or enabling simple-framebuffer node.
This is useful for scenarios where user want to preserve the bootloader splash screen till OS boots up and display server gets started without displaying anything else in between and thus not requiring simple-framebuffer.
Signed-off-by: Devarsh Thakkar devarsht@ti.com
boot/fdt_simplefb.c | 12 +----------- boot/fdt_support.c | 21 +++++++++++++++++++++ include/fdt_support.h | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-)
Reviewed-by: Nikhil M Jain n-jain1@ti.com
diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index b0221eaf2a..837920bd3a 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -107,7 +107,6 @@ static int fdt_simplefb_enable_existing_node(void *blob) #if IS_ENABLED(CONFIG_VIDEO) int fdt_simplefb_enable_and_mem_rsv(void *blob) {
struct fdt_memory mem; int ret;
/* nothing to do when video is not active */
@@ -118,15 +117,6 @@ int fdt_simplefb_enable_and_mem_rsv(void *blob) if (ret) return ret;
- /* nothing to do when the frame buffer is not defined */
- if (gd->video_bottom == gd->video_top)
return 0;
- /* reserved with no-map tag the video buffer */
- mem.start = gd->video_bottom;
- mem.end = gd->video_top - 1;
- return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL,
FDTDEC_RESERVED_MEMORY_NO_MAP);
- return fdt_add_fb_mem_rsv(blob);
} #endif diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 090d82ee80..07aa7337e8 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -22,6 +22,9 @@ #include <exports.h> #include <fdtdec.h> #include <version.h> +#include <video.h>
+DECLARE_GLOBAL_DATA_PTR;
/**
- fdt_getprop_u32_default_node - Return a node's property or a default
@@ -2042,6 +2045,24 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, return 0; }
+#if IS_ENABLED(CONFIG_VIDEO) +int fdt_add_fb_mem_rsv(void *blob) +{
- struct fdt_memory mem;
- /* nothing to do when the frame buffer is not defined */
- if (gd->video_bottom == gd->video_top)
return 0;
- /* reserved with no-map tag the video buffer */
- mem.start = gd->video_bottom;
- mem.end = gd->video_top - 1;
- return fdtdec_add_reserved_memory(blob, "framebuffer", &mem, NULL, 0, NULL,
FDTDEC_RESERVED_MEMORY_NO_MAP);
+} +#endif
/*
- Update native-mode in display-timings from display environment variable.
- The node to update are specified by path.
diff --git a/include/fdt_support.h b/include/fdt_support.h index 25600d62f2..4b71b8948d 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -423,6 +423,8 @@ int arch_fixup_memory_node(void *blob); int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, u32 height, u32 stride, const char *format);
+int fdt_add_fb_mem_rsv(void *blob);
int fdt_overlay_apply_verbose(void *fdt, void *fdto);
int fdt_valid(struct fdt_header **blobp);
Thanks, Nikhil

Update simple-framebuffer device-tree node by enumerating framebuffer related information in existing simple-framebuffer node in Linux device-tree file and enabling it.
In case there is no simple-framebuffer stub detected in Linux kernel device-tree and video is still active, then update the device-tree to reserve the framebuffer region for the active splash screen.
This helps preserve the splash screen till the display server takes over after OS is booted.
Signed-off-by: Devarsh Thakkar devarsht@ti.com --- board/ti/am62x/evm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c index 88e02155ee..c825af3368 100644 --- a/board/ti/am62x/evm.c +++ b/board/ti/am62x/evm.c @@ -15,6 +15,7 @@ #include <cpu_func.h> #include <k3-ddrss.h> #include <fdt_support.h> +#include <fdt_simplefb.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <dm/uclass.h> @@ -118,3 +119,21 @@ void spl_perform_fixups(struct spl_image_info *spl_image) #endif } #endif + +#if defined(CONFIG_OF_BOARD_SETUP) +int ft_board_setup(void *blob, struct bd_info *bd) +{ + int ret = -1; + + if (IS_ENABLED(CONFIG_FDT_SIMPLEFB)) + ret = fdt_simplefb_enable_and_mem_rsv(blob); + + /* If simplefb is not enabled and video is active, then at least reserve + * the framebuffer region to preserve the splash screen while OS is booting + */ + if (ret && video_is_active()) + return fdt_add_fb_mem_rsv(blob); + + return 0; +} +#endif

Hi,
On 22/02/24 18:38, Devarsh Thakkar wrote:
Update simple-framebuffer device-tree node by enumerating framebuffer related information in existing simple-framebuffer node in Linux device-tree file and enabling it.
In case there is no simple-framebuffer stub detected in Linux kernel device-tree and video is still active, then update the device-tree to reserve the framebuffer region for the active splash screen.
This helps preserve the splash screen till the display server takes over after OS is booted.
Signed-off-by: Devarsh Thakkar devarsht@ti.com
board/ti/am62x/evm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c index 88e02155ee..c825af3368 100644 --- a/board/ti/am62x/evm.c +++ b/board/ti/am62x/evm.c @@ -15,6 +15,7 @@ #include <cpu_func.h> #include <k3-ddrss.h> #include <fdt_support.h> +#include <fdt_simplefb.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <dm/uclass.h> @@ -118,3 +119,21 @@ void spl_perform_fixups(struct spl_image_info *spl_image) #endif } #endif
+#if defined(CONFIG_OF_BOARD_SETUP) +int ft_board_setup(void *blob, struct bd_info *bd) +{
- int ret = -1;
- if (IS_ENABLED(CONFIG_FDT_SIMPLEFB))
ret = fdt_simplefb_enable_and_mem_rsv(blob);
This needs to be protected with IS_ENABLED(CONFIG_VIDEO) too to avoid below errors when CONFIG_VIDEO is disabled :
/home/devarsht/ti/ti-u-boot/board/ti/am62x/evm.c:102: undefined reference to `video_is_active'
aarch64-none-linux-gnu-ld.bfd: /home/devarsht/ti/ti-u-boot/board/ti/am62x/evm.c:104: undefined reference to `fdt_add_fb_mem_rsv' \
I will send out a V2 of this patch.
Regards Devarsh
- /* If simplefb is not enabled and video is active, then at least reserve
* the framebuffer region to preserve the splash screen while OS is booting
*/
- if (ret && video_is_active())
return fdt_add_fb_mem_rsv(blob);
- return 0;
+} +#endif

Hi Tom, Anatolij, Simon,
On 22/02/24 18:38, Devarsh Thakkar wrote:
This adds support for simple-framebuffer reservation using video handoff when splash is enabled at SPL stage.
Also adds helper function to only enable framebuffer reservation without enabling simple-framebuffer in case user want to continue display bootloader splash without displaying anything else in between until kernel boots up.
Lastly, it enables above support on AM62x.
I saw a RB on first 3 patches so just wanted to check if it looks good to you too then is it possible to pull in the first 3 patches if no further comments ?
Regards Devarsh
Devarsh Thakkar (4): boot: fdt_simplefb: Enumerate framebuffer info from video handoff video: Assume video to be active if SPL is passing video hand-off boot: Move framebuffer reservation to separate helper board: ti: am62x: evm: Update simple-framebuffer node in device-tree
board/ti/am62x/evm.c | 19 +++++++++++++++ boot/fdt_simplefb.c | 46 ++++++++++++++++++++---------------- boot/fdt_support.c | 21 ++++++++++++++++ drivers/video/video-uclass.c | 4 ++++ include/fdt_support.h | 2 ++ 5 files changed, 72 insertions(+), 20 deletions(-)

Gentle Reminder.
On 08/03/24 16:38, Devarsh Thakkar wrote:
Hi Tom, Anatolij, Simon,
On 22/02/24 18:38, Devarsh Thakkar wrote:
This adds support for simple-framebuffer reservation using video handoff when splash is enabled at SPL stage.
Also adds helper function to only enable framebuffer reservation without enabling simple-framebuffer in case user want to continue display bootloader splash without displaying anything else in between until kernel boots up.
Lastly, it enables above support on AM62x.
I saw a RB on first 3 patches so just wanted to check if it looks good to you too then is it possible to pull in the first 3 patches if no further comments ?
Regards Devarsh
Devarsh Thakkar (4): boot: fdt_simplefb: Enumerate framebuffer info from video handoff video: Assume video to be active if SPL is passing video hand-off boot: Move framebuffer reservation to separate helper board: ti: am62x: evm: Update simple-framebuffer node in device-tree
board/ti/am62x/evm.c | 19 +++++++++++++++ boot/fdt_simplefb.c | 46 ++++++++++++++++++++---------------- boot/fdt_support.c | 21 ++++++++++++++++ drivers/video/video-uclass.c | 4 ++++ include/fdt_support.h | 2 ++ 5 files changed, 72 insertions(+), 20 deletions(-)

On Fri, 8 Mar 2024 16:38:28 +0530 Devarsh Thakkar devarsht@ti.com wrote:
Hi Tom, Anatolij, Simon,
On 22/02/24 18:38, Devarsh Thakkar wrote:
This adds support for simple-framebuffer reservation using video handoff when splash is enabled at SPL stage.
Also adds helper function to only enable framebuffer reservation without enabling simple-framebuffer in case user want to continue display bootloader splash without displaying anything else in between until kernel boots up.
Lastly, it enables above support on AM62x.
I saw a RB on first 3 patches so just wanted to check if it looks good to you too then is it possible to pull in the first 3 patches if no further comments ?
patches 1 to 3 applied to u-boot-video. Fixed build errors with patch 3.
-- Anatolij
participants (3)
-
Anatolij Gustschin
-
Devarsh Thakkar
-
Nikhil Jain