[PATCH v2 1/2] video: Allow drivers to allocate the frame buffer themselves

Pali Rohár pali at kernel.org
Wed Mar 9 20:46:00 CET 2022


When plat->base is set by driver then skip frame buffer reservation and allocation.

Signed-off-by: Pali Rohár <pali at kernel.org>
---
 drivers/video/video-uclass.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 7d499bcec51d..88797d4a21c2 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -33,7 +33,8 @@
  * information represents the requires size and alignment of the frame buffer
  * for the device. The values can be an over-estimate but cannot be too
  * small. The actual values will be suppled (in the same manner) by the bind()
- * method after relocation.
+ * method after relocation. Additionally driver can allocate frame buffer
+ * itself by setting plat->base.
  *
  * This information is then picked up by video_reserve() which works out how
  * much memory is needed for all devices. This is allocated between
@@ -78,6 +79,10 @@ static ulong alloc_fb(struct udevice *dev, ulong *addrp)
 	if (!plat->size)
 		return 0;
 
+	/* Allow drivers to allocate the frame buffer themselves */
+	if (plat->base)
+		return 0;
+
 	align = plat->align ? plat->align : 1 << 20;
 	base = *addrp - plat->size;
 	base &= ~(align - 1);
-- 
2.20.1



More information about the U-Boot mailing list