diff mbox series

[1/4] boot: fdt_simplefb: Enumerate framebuffer info from video handoff

Message ID 20240222130811.3878567-2-devarsht@ti.com
State Accepted
Commit 86281e4705418b54404889c290ef3154fb1ebafc
Delegated to: Anatolij Gustschin
Headers show
Series Simplefb and fb reservation related updates | expand

Commit Message

Devarsh Thakkar Feb. 22, 2024, 1:08 p.m. UTC
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(-)

Comments

Nikhil Jain March 6, 2024, 10:42 a.m. UTC | #1
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
diff mbox series

Patch

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";