[PATCH 03/35] video: Add a function to obtain the framebuffer address
Simon Glass
sjg at chromium.org
Wed Jul 24 17:08:50 CEST 2024
Add a new function which returns the framebuffer address of the first
video device. This will allow the global_data field top be dropped.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/video/video-uclass.c | 14 ++++++++++++++
include/video.h | 11 +++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index ff1382f4a43..cb3144f68e0 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -146,6 +146,20 @@ int video_reserve(ulong *addrp)
return 0;
}
+ulong video_get_fb(void)
+{
+ struct udevice *dev;
+
+ uclass_find_first_device(UCLASS_VIDEO, &dev);
+ if (dev) {
+ const struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+
+ return uc_plat->base;
+ }
+
+ return 0;
+}
+
int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
int yend, u32 colour)
{
diff --git a/include/video.h b/include/video.h
index 4d8df9baaad..ab3a7ff4930 100644
--- a/include/video.h
+++ b/include/video.h
@@ -418,4 +418,15 @@ int bmp_info(ulong addr);
*/
int video_reserve_from_bloblist(struct video_handoff *ho);
+/**
+ * video_get_fb() - Get the first framebuffer address
+ *
+ * This function does not probe video devices, so can only be used after a video
+ * device has been activated.
+ *
+ * Return: address of the framebuffer of the first video device found, or 0 if
+ * there is no device
+ */
+ulong video_get_fb(void);
+
#endif
--
2.34.1
More information about the U-Boot
mailing list