Skip to contentSkip to conversation

dm: video: Introduce initial driver-model video support

PATCH Superseded Simon Glass 2 participants 32 messages Jan 19, 2016 – Jan 21, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover dm: video: Introduce initial driver-model video support

This series starts the process of converting LCD and video devices over to use driver model. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver-model conversion these will end up unified in a single uclass.

Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model for video.

The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass does not implement them. This includes lcd_ctrl_init(), lcd_enable() and video_init().

Tests are provided to check that console text and bitmap output is correct. These should be able to be extended as more features are added.

Future work will convert a few boards over to use driver model for video. Likely targets are x86, exynos, tegra. Also, Rockchip LCD support will be added using driver model (patches will likely be sent some time in January).

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment
- Fix 'resolutino' typo in comment

Simon Glass (14):
dm: video: Add a video uclass
dm: lcd: Avoid using the lcd.h header file with driver model
dm: video: Add a uclass for the text console
dm: video: Add a 'normal' text console driver
dm: video: Add a driver for a rotated text console
common: Move LCD and video memory reservation together
dm: common: Add memory reservation for the video uclass
dm: video: Implement the bmp command for driver model
dm: stdio: video: Plumb the video uclass into stdio
sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig
dm: video: sandbox: Convert sandbox to use driver model for video
dm: video: test: Add tests for the video uclass
dm: video: test: Add tests for rotated consoles
dm: video: test: Test that bitmap display works correctly

 arch/sandbox/dts/sandbox.dts      |   1 +
 arch/sandbox/dts/test.dts         |   7 +
 board/sandbox/sandbox.c           |  17 --
 common/Makefile                   |   2 +
 common/board_f.c                  |  71 ++++---
 common/cmd_bmp.c                  |  22 +-
 common/lcd.c                      |  11 -
 common/stdio.c                    |  19 +-
 configs/sandbox_defconfig         |   5 +-
 drivers/serial/sandbox.c          |   5 +-
 drivers/video/Kconfig             |  62 ++++++
 drivers/video/Makefile            |   3 +
 drivers/video/console_normal.c    | 141 ++++++++++++
 drivers/video/console_rotate.c    | 436 ++++++++++++++++++++++++++++++++++++++
 drivers/video/sandbox_sdl.c       |  90 ++++----
 drivers/video/vidconsole-uclass.c | 239 +++++++++++++++++++++
 drivers/video/video-uclass.c      | 249 ++++++++++++++++++++++
 drivers/video/video_bmp.c         | 353 ++++++++++++++++++++++++++++++
 include/asm-generic/global_data.h |   4 +
 include/configs/sandbox.h         |  13 +-
 include/dm/test.h                 |   8 +
 include/dm/uclass-id.h            |   2 +
 include/fdtdec.h                  |   1 -
 include/lcd.h                     |  12 +-
 include/video.h                   | 168 ++++++++++++++-
 include/video_console.h           | 136 ++++++++++++
 lib/fdtdec.c                      |   1 -
 test/dm/Makefile                  |   1 +
 test/dm/video.c                   | 271 +++++++++++++++++++++++
 tools/logos/denx-comp.bmp         | Bin 0 -> 4148 bytes
 30 files changed, 2221 insertions(+), 129 deletions(-)
 create mode 100644 drivers/video/console_normal.c
 create mode 100644 drivers/video/console_rotate.c
 create mode 100644 drivers/video/vidconsole-uclass.c
 create mode 100644 drivers/video/video-uclass.c
 create mode 100644 drivers/video/video_bmp.c
 create mode 100644 include/video_console.h
 create mode 100644 test/dm/video.c
 create mode 100644 tools/logos/denx-comp.bmp
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#1 lore raw

PATCH v2 1/14 dm: video: Add a video uclass

U-Boot has separate code for LCDs and 'video' devices. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver- model conversion we should unify these into a single uclass.

Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model for video.

The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass makes no attempt to implement them.

---

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()

 drivers/video/Kconfig        |  40 ++++++++
 drivers/video/Makefile       |   1 +
 drivers/video/video-uclass.c | 228 +++++++++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h       |   1 +
 include/video.h              | 168 +++++++++++++++++++++++++++++--
 5 files changed, 432 insertions(+), 6 deletions(-)
 create mode 100644 drivers/video/video-uclass.c
drivers/video/Kconfig +40 -0
index caf1efc..946d958 100644
@@ -4,6 +4,46 @@
 
 menu "Graphics support"
 
+config DM_VIDEO
+	bool "Enable driver model support for LCD/video"
+	depends on DM
+	help
+	  This enables driver model for LCD and video devices. These support
+	  a bitmap display of various sizes and depths which can be drawn on
+	  to display a command-line console or splash screen. Enabling this
+	  option compiles in the video uclass and routes all LCD/video access
+	  through this.
+
+config VIDEO_BPP8
+	bool "Support 8-bit-per-pixel displays"
+	depends on DM_VIDEO
+	default y if DM_VIDEO
+	help
+	  Support drawing text and bitmaps onto a 8-bit-per-pixel display.
+	  Enabling this will include code to support this display. Without
+	  this option, such displays will not be supported and console output
+	  will be empty.
+
+config VIDEO_BPP16
+	bool "Support 16-bit-per-pixel displays"
+	depends on DM_VIDEO
+	default y if DM_VIDEO
+	help
+	  Support drawing text and bitmaps onto a 16-bit-per-pixel display.
+	  Enabling this will include code to support this display. Without
+	  this option, such displays will not be supported and console output
+	  will be empty.
+
+config VIDEO_BPP32
+	bool "Support 32-bit-per-pixel displays"
+	depends on DM_VIDEO
+	default y if DM_VIDEO
+	help
+	  Support drawing text and bitmaps onto a 32-bit-per-pixel display.
+	  Enabling this will include code to support this display. Without
+	  this option, such displays will not be supported and console output
+	  will be empty.
+
 config VIDEO_VESA
 	bool "Enable VESA video driver support"
 	default n
drivers/video/Makefile +1 -0
index e85fd8a..7192013 100644
@@ -7,6 +7,7 @@
 
 ifdef CONFIG_DM
 obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
+obj-$(CONFIG_DM_VIDEO) += video-uclass.o
 endif
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
drivers/video/video-uclass.c new file +228 -0

228 lines not on this page · raw message

include/dm/uclass-id.h +1 -0
index 27fa0b6..3934375 100644
@@ -66,6 +66,7 @@ enum uclass_id {
 	UCLASS_USB,		/* USB bus */
 	UCLASS_USB_DEV_GENERIC,	/* USB generic device */
 	UCLASS_USB_HUB,		/* USB hub */
+	UCLASS_VIDEO,		/* Video or LCD device */
 	UCLASS_VIDEO_BRIDGE,	/* Video bridge, e.g. DisplayPort to LVDS */
 
 	UCLASS_COUNT,
include/video.h +162 -6

180 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#2 lore raw

PATCH v2 1/14 dm: video: Add a video uclass

Quoted 32 lines · Simon Glass

U-Boot has separate code for LCDs and 'video' devices. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver- model conversion we should unify these into a single uclass.

Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model for video.

The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass makes no attempt to implement them.

---

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()

Quoted 7 lines
 drivers/video/Kconfig        |  40 ++++++++
 drivers/video/Makefile       |   1 +
 drivers/video/video-uclass.c | 228 +++++++++++++++++++++++++++++++++++++++++++
 include/dm/uclass-id.h       |   1 +
 include/video.h              | 168 +++++++++++++++++++++++++++++--
 5 files changed, 432 insertions(+), 6 deletions(-)
 create mode 100644 drivers/video/video-uclass.c

Applied to u-boot-dm

#3 lore raw

PATCH v2 2/14 dm: lcd: Avoid using the lcd.h header file with driver model

In reply to Simon Glass

The LCD functions and definitions are not used with the driver model video uclass. When all boards are converted over we can remove the file. For now, use #ifdef to omit the contents.

---

Changes in v2: None

 common/Makefile |  2 ++
 include/lcd.h   | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
common/Makefile +2 -0
index 2a1d9f8..2492275 100644
@@ -205,7 +205,9 @@ obj-$(CONFIG_I2C_EDID) += edid.o
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-y += splash.o
 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
+ifndef CONFIG_DM_VIDEO
 obj-$(CONFIG_LCD) += lcd.o lcd_console.o
+endif
 obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
include/lcd.h +8 -4
index 59202b7..d7651a8 100644
@@ -18,6 +18,12 @@
 #include <asm/byteorder.h>
 #endif
 
+int bmp_display(ulong addr, int x, int y);
+struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
+			     void **alloc_addr);
+
+#ifndef CONFIG_DM_VIDEO
+
 extern char lcd_is_enabled;
 extern int lcd_line_length;
 extern struct vidinfo panel_info;
@@ -26,10 +32,6 @@ void lcd_ctrl_init(void *lcdbase);
 void lcd_enable(void);
 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
 
-struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
-			     void **alloc_addr);
-int bmp_display(ulong addr, int x, int y);
-
 /**
  * Set whether we need to flush the dcache when changing the LCD image. This
  * defaults to off.
@@ -209,4 +211,6 @@ void lcd_sync(void);
 #define PAGE_SIZE	4096
 #endif
 
+#endif /* !CONFIG_DM_VIDEO */
+
 #endif	/* _LCD_H_ */
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#4 lore raw

PATCH v2 2/14 dm: lcd: Avoid using the lcd.h header file with driver model

Quoted 6 lines · Simon Glass

The LCD functions and definitions are not used with the driver model video uclass. When all boards are converted over we can remove the file. For now, use #ifdef to omit the contents.

Quoted 7 lines

---

Changes in v2: None

 common/Makefile |  2 ++
 include/lcd.h   | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#5 lore raw

PATCH v2 3/14 dm: video: Add a uclass for the text console

In reply to Simon Glass

The existing LCD/video interface suffers from conflating the bitmap display with text output on that display. As a result the implementation is more complex than it needs to me.

We can support multiple text console drivers. Create a separate uclass to support this, with its own API.

---

Changes in v2:
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment

 drivers/video/Makefile            |   2 +-
 drivers/video/vidconsole-uclass.c | 239 ++++++++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c      |  21 ++++
 include/dm/uclass-id.h            |   1 +
 include/video_console.h           | 136 ++++++++++++++++++++++
 5 files changed, 398 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/vidconsole-uclass.c
 create mode 100644 include/video_console.h
drivers/video/Makefile +1 -1
index 7192013..e82f1ae 100644
@@ -7,7 +7,7 @@
 
 ifdef CONFIG_DM
 obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
-obj-$(CONFIG_DM_VIDEO) += video-uclass.o
+obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
 endif
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
drivers/video/vidconsole-uclass.c new file +239 -0

239 lines not on this page · raw message

drivers/video/video-uclass.c +21 -0
index 1615889..63d0d9d 100644
@@ -189,6 +189,27 @@ static int video_post_probe(struct udevice *dev)
 #endif
 	video_clear(dev);
 
+	/*
+	 * Create a text console devices. For now we always do this, although
+	 * it might be useful to support only bitmap drawing on the device
+	 * for boards that don't need to display text.
+	 */
+	snprintf(name, sizeof(name), "%s.vidconsole", dev->name);
+	str = strdup(name);
+	if (!str)
+		return -ENOMEM;
+	snprintf(drv, sizeof(drv), "vidconsole%d", priv->rot);
+	ret = device_bind_driver(dev, drv, str, &cons);
+	if (ret) {
+		debug("%s: Cannot bind console driver\n", __func__);
+		return ret;
+	}
+	ret = device_probe(cons);
+	if (ret) {
+		debug("%s: Cannot probe console driver\n", __func__);
+		return ret;
+	}
+
 	return 0;
 };
 
include/dm/uclass-id.h +1 -0
index 3934375..a0a3a79 100644
@@ -68,6 +68,7 @@ enum uclass_id {
 	UCLASS_USB_HUB,		/* USB hub */
 	UCLASS_VIDEO,		/* Video or LCD device */
 	UCLASS_VIDEO_BRIDGE,	/* Video bridge, e.g. DisplayPort to LVDS */
+	UCLASS_VIDEO_CONSOLE,	/* Text console driver for video device */
 
 	UCLASS_COUNT,
 	UCLASS_INVALID = -1,
include/video_console.h new file +136 -0

136 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#6 lore raw

PATCH v2 3/14 dm: video: Add a uclass for the text console

Quoted 15 lines · Simon Glass

The existing LCD/video interface suffers from conflating the bitmap display with text output on that display. As a result the implementation is more complex than it needs to me.

We can support multiple text console drivers. Create a separate uclass to support this, with its own API.

---

Changes in v2:
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment

Quoted 8 lines
 drivers/video/Makefile            |   2 +-
 drivers/video/vidconsole-uclass.c | 239 ++++++++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c      |  21 ++++
 include/dm/uclass-id.h            |   1 +
 include/video_console.h           | 136 ++++++++++++++++++++++
 5 files changed, 398 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/vidconsole-uclass.c
 create mode 100644 include/video_console.h

Applied to u-boot-dm

#7 lore raw

PATCH v2 4/14 dm: video: Add a 'normal' text console driver

In reply to Simon Glass

Most of the time we don't need to rotate the display so a simple font blitting feature is enough for our purposes. Add a simple driver which supports this function. It provides text output on the console using the standard 8x16-pixel font.

---

Changes in v2: None

 drivers/video/Makefile         |   2 +-
 drivers/video/console_normal.c | 141 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/console_normal.c
drivers/video/Makefile +1 -1
index e82f1ae..b4eba8e 100644
@@ -7,7 +7,7 @@
 
 ifdef CONFIG_DM
 obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
-obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
+obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o console_normal.o
 endif
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
drivers/video/console_normal.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#8 lore raw

PATCH v2 4/14 dm: video: Add a 'normal' text console driver

Quoted 7 lines · Simon Glass

Most of the time we don't need to rotate the display so a simple font blitting feature is enough for our purposes. Add a simple driver which supports this function. It provides text output on the console using the standard 8x16-pixel font.

Quoted 8 lines

---

Changes in v2: None

 drivers/video/Makefile         |   2 +-
 drivers/video/console_normal.c | 141 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/console_normal.c

Applied to u-boot-dm

#9 lore raw

PATCH v2 5/14 dm: video: Add a driver for a rotated text console

In reply to Simon Glass

Sometimes the console must be rotated. Add a driver which supports rotating the text clockwise to 90, 180 and 270 degrees. This can support devices where the display is rotated for mechanical reasons.

---

Changes in v2: None

 drivers/video/Kconfig          |  13 ++
 drivers/video/Makefile         |   1 +
 drivers/video/console_rotate.c | 436 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 450 insertions(+)
 create mode 100644 drivers/video/console_rotate.c
drivers/video/Kconfig +13 -0
index 946d958..499d00d 100644
@@ -44,6 +44,19 @@ config VIDEO_BPP32
 	  this option, such displays will not be supported and console output
 	  will be empty.
 
+config VIDEO_ROTATION
+	bool "Support rotated displays"
+	depends on DM_VIDEO
+	help
+	  Sometimes, for example if the display is mounted in portrait
+	  mode or even if it's mounted landscape but rotated by 180degree,
+	  we need to rotate our content of the display relative to the
+	  framebuffer, so that user can read the messages which are
+	  printed out. Enable this option to include a text driver which can
+	  support this. The rotation is set by the 'rot' parameter in
+	  struct video_priv: 0=unrotated, 1=90 degrees clockwise, 2=180
+	  degrees, 3=270 degrees.
+
 config VIDEO_VESA
 	bool "Enable VESA video driver support"
 	default n
drivers/video/Makefile +1 -0
index b4eba8e..8f26d1d 100644
@@ -8,6 +8,7 @@
 ifdef CONFIG_DM
 obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o console_normal.o
+obj-$(CONFIG_VIDEO_ROTATION) += console_rotate.o
 endif
 
 obj-$(CONFIG_ATI_RADEON_FB) += ati_radeon_fb.o videomodes.o
drivers/video/console_rotate.c new file +436 -0

436 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#10 lore raw

PATCH v2 5/14 dm: video: Add a driver for a rotated text console

Quoted 8 lines · Simon Glass

Sometimes the console must be rotated. Add a driver which supports rotating the text clockwise to 90, 180 and 270 degrees. This can support devices where the display is rotated for mechanical reasons.

---

Quoted 7 lines

Changes in v2: None

 drivers/video/Kconfig          |  13 ++
 drivers/video/Makefile         |   1 +
 drivers/video/console_rotate.c | 436 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 450 insertions(+)
 create mode 100644 drivers/video/console_rotate.c

Applied to u-boot-dm

#11 lore raw

PATCH v2 6/14 common: Move LCD and video memory reservation together

In reply to Simon Glass

These two functions are conceptually the same. Move them together in the pre-relocation init.

---

Changes in v2: None

 common/board_f.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
common/board_f.c +14 -14
index 8094ac4..068db0d 100644
@@ -451,22 +451,10 @@ static int reserve_lcd(void)
 }
 #endif /* CONFIG_LCD */
 
-static int reserve_trace(void)
-{
-#ifdef CONFIG_TRACE
-	gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE;
-	gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE);
-	debug("Reserving %dk for trace data at: %08lx\n",
-	      CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr);
-#endif
-
-	return 0;
-}
-
 #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
 		!defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
-static int reserve_video(void)
+static int reserve_legacy_video(void)
 {
 	/* reserve memory for video display (always full pages) */
 	gd->relocaddr = video_setmem(gd->relocaddr);
@@ -476,6 +464,18 @@ static int reserve_video(void)
 }
 #endif
 
+static int reserve_trace(void)
+{
+#ifdef CONFIG_TRACE
+	gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE;
+	gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE);
+	debug("Reserving %dk for trace data at: %08lx\n",
+	      CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr);
+#endif
+
+	return 0;
+}
+
 static int reserve_uboot(void)
 {
 	/*
@@ -960,13 +960,13 @@ static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_LCD
 	reserve_lcd,
 #endif
-	reserve_trace,
 	/* TODO: Why the dependency on CONFIG_8xx? */
 #if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
 		!defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
 	reserve_video,
 #endif
+	reserve_trace,
 #if !defined(CONFIG_BLACKFIN)
 	reserve_uboot,
 #endif
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#12 lore raw

PATCH v2 6/14 common: Move LCD and video memory reservation together

Quoted 11 lines · Simon Glass

These two functions are conceptually the same. Move them together in the pre-relocation init.

---

Changes in v2: None

 common/board_f.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Applied to u-boot-dm

#13 lore raw

PATCH v2 7/14 dm: common: Add memory reservation for the video uclass

In reply to Simon Glass

Before relocation we need to reserve memory for the video driver frame buffers so that they can use this memory when they start up (after relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that it can be checked post-relocation to ensure enough memory is available. No video device should be probed before relocation.

---

Changes in v2: None

 common/board_f.c                  | 47 +++++++++++++++++++++++++++++----------
 include/asm-generic/global_data.h |  4 ++++
 2 files changed, 39 insertions(+), 12 deletions(-)
common/board_f.c +35 -12
index 068db0d..c470b59 100644
@@ -46,6 +46,7 @@
 #include <spi.h>
 #include <status_led.h>
 #include <trace.h>
+#include <video.h>
 #include <watchdog.h>
 #include <asm/errno.h>
 #include <asm/io.h>
@@ -437,21 +438,38 @@ static int reserve_mmu(void)
 }
 #endif
 
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+static int reserve_video(void)
+{
+	ulong addr;
+	int ret;
+
+	addr = gd->relocaddr;
+	ret = video_reserve(&addr);
+	if (ret)
+		return ret;
+	gd->relocaddr = addr;
+
+	return 0;
+}
+#else
+
+# ifdef CONFIG_LCD
 static int reserve_lcd(void)
 {
-#ifdef CONFIG_FB_ADDR
+#  ifdef CONFIG_FB_ADDR
 	gd->fb_base = CONFIG_FB_ADDR;
-#else
+#  else
 	/* reserve memory for LCD display (always full pages) */
 	gd->relocaddr = lcd_setmem(gd->relocaddr);
 	gd->fb_base = gd->relocaddr;
-#endif /* CONFIG_FB_ADDR */
+#  endif /* CONFIG_FB_ADDR */
+
 	return 0;
 }
-#endif /* CONFIG_LCD */
+# endif /* CONFIG_LCD */
 
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
 		!defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
 static int reserve_legacy_video(void)
@@ -462,7 +480,8 @@ static int reserve_legacy_video(void)
 
 	return 0;
 }
-#endif
+# endif
+#endif /* !CONFIG_DM_VIDEO */
 
 static int reserve_trace(void)
 {
@@ -957,15 +976,19 @@ static init_fnc_t init_sequence_f[] = {
 		defined(CONFIG_ARM)
 	reserve_mmu,
 #endif
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+	reserve_video,
+#else
+# ifdef CONFIG_LCD
 	reserve_lcd,
-#endif
+# endif
 	/* TODO: Why the dependency on CONFIG_8xx? */
-#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
+# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \
 		!defined(CONFIG_ARM) && !defined(CONFIG_X86) && \
 		!defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K)
-	reserve_video,
-#endif
+	reserve_legacy_video,
+# endif
+#endif /* CONFIG_DM_VIDEO */
 	reserve_trace,
 #if !defined(CONFIG_BLACKFIN)
 	reserve_uboot,
include/asm-generic/global_data.h +4 -0
index 5d8b043..a587d3c 100644
@@ -122,6 +122,10 @@ typedef struct global_data {
 	struct membuff console_out;	/* console output */
 	struct membuff console_in;	/* console input */
 #endif
+#ifdef CONFIG_DM_VIDEO
+	ulong video_top;		/* Top of video frame buffer area */
+	ulong video_bottom;		/* Bottom of video frame buffer area */
+#endif
 } gd_t;
 #endif
 
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#14 lore raw

PATCH v2 7/14 dm: common: Add memory reservation for the video uclass

Quoted 10 lines · Simon Glass

Before relocation we need to reserve memory for the video driver frame buffers so that they can use this memory when they start up (after relocation). Add a call to the uclass to permit this.

The current top and bottom of the region is stored in global_data so that it can be checked post-relocation to ensure enough memory is available. No video device should be probed before relocation.

Quoted 7 lines

---

Changes in v2: None

 common/board_f.c                  | 47 +++++++++++++++++++++++++++++----------
 include/asm-generic/global_data.h |  4 ++++
 2 files changed, 39 insertions(+), 12 deletions(-)

Applied to u-boot-dm

#15 lore raw

PATCH v2 8/14 dm: video: Implement the bmp command for driver model

In reply to Simon Glass

This command can use the bitmap display code in the uclass. This is similar to the code in lcd.c and cfb_console.c. These other copies will go away when all boards are converted to use driver model for video.

---

Changes in v2: None

 common/cmd_bmp.c          |  22 ++-
 drivers/video/Makefile    |   1 +
 drivers/video/video_bmp.c | 353 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 375 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/video_bmp.c
common/cmd_bmp.c +21 -1
index f04b7d4..fd5b7db 100644
@@ -10,7 +10,9 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <lcd.h>
+#include <mapmem.h>
 #include <bmp_layout.h>
 #include <command.h>
 #include <asm/byteorder.h>
@@ -225,6 +227,9 @@ static int bmp_info(ulong addr)
  */
 int bmp_display(ulong addr, int x, int y)
 {
+#ifdef CONFIG_DM_VIDEO
+	struct udevice *dev;
+#endif
 	int ret;
 	struct bmp_image *bmp = map_sysmem(addr, 0);
 	void *bmp_alloc_addr = NULL;
@@ -240,7 +245,22 @@ int bmp_display(ulong addr, int x, int y)
 	}
 	addr = map_to_sysmem(bmp);
 
-#if defined(CONFIG_LCD)
+#ifdef CONFIG_DM_VIDEO
+	ret = uclass_first_device(UCLASS_VIDEO, &dev);
+	if (!ret) {
+		if (!dev)
+			ret = -ENODEV;
+		if (!ret) {
+			bool align = false;
+
+# ifdef CONFIG_SPLASH_SCREEN_ALIGN
+			align = true;
+# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+			ret = video_bmp_display(dev, addr, x, y, align);
+		}
+	}
+	return ret ? CMD_RET_FAILURE : 0;
+#elif defined(CONFIG_LCD)
 	ret = lcd_display_bitmap(addr, x, y);
 #elif defined(CONFIG_VIDEO)
 	ret = video_display_bitmap(addr, x, y);
drivers/video/Makefile +1 -0
index 8f26d1d..ee04629 100644
@@ -8,6 +8,7 @@
 ifdef CONFIG_DM
 obj-$(CONFIG_DISPLAY_PORT) += dp-uclass.o
 obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o console_normal.o
+obj-$(CONFIG_DM_VIDEO) += video_bmp.o
 obj-$(CONFIG_VIDEO_ROTATION) += console_rotate.o
 endif
 
drivers/video/video_bmp.c new file +353 -0

353 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#16 lore raw

PATCH v2 8/14 dm: video: Implement the bmp command for driver model

Quoted 8 lines · Simon Glass

This command can use the bitmap display code in the uclass. This is similar to the code in lcd.c and cfb_console.c. These other copies will go away when all boards are converted to use driver model for video.

---

Quoted 7 lines

Changes in v2: None

 common/cmd_bmp.c          |  22 ++-
 drivers/video/Makefile    |   1 +
 drivers/video/video_bmp.c | 353 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 375 insertions(+), 1 deletion(-)
 create mode 100644 drivers/video/video_bmp.c

Applied to u-boot-dm

#17 lore raw

PATCH v2 9/14 dm: stdio: video: Plumb the video uclass into stdio

In reply to Simon Glass

Register video drivers with stdio so that they can be used for text output. This needs to be done explicitly for now. At some point we should be able to convert stdio itself to driver model and avoid this step.

---

Changes in v2: None

 common/stdio.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
common/stdio.c +15 -4
index 8311ac7..7252bab 100644
@@ -281,12 +281,23 @@ int stdio_add_devices(void)
 	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 #endif
-#ifdef CONFIG_LCD
+#ifdef CONFIG_DM_VIDEO
+	struct udevice *vdev;
+
+	for (ret = uclass_first_device(UCLASS_VIDEO, &vdev);
+	     vdev;
+	     ret = uclass_next_device(&vdev))
+		;
+	if (ret)
+		printf("%s: Video device failed (ret=%d)\n", __func__, ret);
+#else
+# if defined(CONFIG_LCD)
 	drv_lcd_init ();
-#endif
-#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
+# endif
+# if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
 	drv_video_init ();
-#endif
+# endif
+#endif /* CONFIG_DM_VIDEO */
 #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD)
 	drv_keyboard_init ();
 #endif
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#18 lore raw

PATCH v2 9/14 dm: stdio: video: Plumb the video uclass into stdio

Quoted 4 lines · Simon Glass

Register video drivers with stdio so that they can be used for text output. This needs to be done explicitly for now. At some point we should be able to convert stdio itself to driver model and avoid this step.

Quoted 8 lines

---

Changes in v2: None

 common/stdio.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Applied to u-boot-dm

#19 lore raw

PATCH v2 10/14 sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig

In reply to Simon Glass

Move this option to Kconfig. This is quite simple as only sandbox uses the driver.

---

Changes in v2: None

 configs/sandbox_defconfig | 3 ++-
 drivers/video/Kconfig     | 9 +++++++++
 include/configs/sandbox.h | 1 -
 3 files changed, 11 insertions(+), 2 deletions(-)
configs/sandbox_defconfig +2 -1
index 731fc25..e4b8412 100644
@@ -1,6 +1,7 @@
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_PCI=y
 CONFIG_DEFAULT_DEVICE_TREE="sandbox"
+CONFIG_DM_PCI_COMPAT=y
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_FIT_SIGNATURE=y
@@ -51,7 +52,6 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_DM_PCI=y
-CONFIG_DM_PCI_COMPAT=y
 CONFIG_PCI_SANDBOX=y
 CONFIG_PINCTRL=y
 CONFIG_PINCONF=y
@@ -76,6 +76,7 @@ CONFIG_USB_EMUL=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL=y
+CONFIG_VIDEO_SANDBOX_SDL=y
 CONFIG_SYS_VSNPRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_TPM=y
drivers/video/Kconfig +9 -0
index 499d00d..ae122da 100644
@@ -300,6 +300,15 @@ config DISPLAY_PORT
 	   to drive LCD panels. This framework provides support for enabling
 	   these displays where supported by the video hardware.
 
+config VIDEO_SANDBOX_SDL
+	bool "Enable sandbox video console using SDL"
+	depends on SANDBOX
+	help
+	  When using sandbox you can enable an emulated LCD display which
+	  appears as an SDL (Simple DirectMedia Layer) window. This is a
+	  console device and can display stdout output. Within U-Boot is is
+	  a normal bitmap display and can display images as well as text.
+
 config VIDEO_TEGRA124
 	bool "Enable video support on Tegra124"
 	help
include/configs/sandbox.h +0 -1
index d3112e1..e1be603 100644
@@ -159,7 +159,6 @@
 /* LCD and keyboard require SDL support */
 #ifdef CONFIG_SANDBOX_SDL
 #define CONFIG_LCD
-#define CONFIG_VIDEO_SANDBOX_SDL
 #define CONFIG_CMD_BMP
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_CONSOLE_MUX
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#20 lore raw

PATCH v2 10/14 sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig

Quoted 5 lines · Simon Glass

Move this option to Kconfig. This is quite simple as only sandbox uses the driver.

Quoted 8 lines

---

Changes in v2: None

 configs/sandbox_defconfig | 3 ++-
 drivers/video/Kconfig     | 9 +++++++++
 include/configs/sandbox.h | 1 -
 3 files changed, 11 insertions(+), 2 deletions(-)

Applied to u-boot-dm

#21 lore raw

PATCH v2 11/14 dm: video: sandbox: Convert sandbox to use driver model for video

In reply to Simon Glass

Now that driver model support is available, convert sandbox over to use it. We can remove a few of the special hooks that sandbox currently has.

---

Changes in v2: None

 arch/sandbox/dts/sandbox.dts |  1 +
 board/sandbox/sandbox.c      | 17 --------
 common/lcd.c                 | 11 -----
 configs/sandbox_defconfig    |  1 +
 drivers/serial/sandbox.c     |  5 +--
 drivers/video/sandbox_sdl.c  | 95 ++++++++++++++++++++++----------------------
 include/configs/sandbox.h    | 10 ++---
 include/fdtdec.h             |  1 -
 lib/fdtdec.c                 |  1 -
 9 files changed, 56 insertions(+), 86 deletions(-)
arch/sandbox/dts/sandbox.dts +1 -0
index d2addb4..e3f02bf 100644
@@ -117,6 +117,7 @@
 	};
 
 	lcd {
+		u-boot,dm-pre-reloc;
 		compatible = "sandbox,lcd-sdl";
 		xres = <1366>;
 		yres = <768>;
board/sandbox/sandbox.c +0 -17
index 592f772..b41e9de 100644
@@ -47,23 +47,6 @@ int dram_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_BOARD_EARLY_INIT_F
-int board_early_init_f(void)
-{
-#ifdef CONFIG_VIDEO_SANDBOX_SDL
-	int ret;
-
-	ret = sandbox_lcd_sdl_early_init();
-	if (ret) {
-		puts("Could not init sandbox LCD emulation\n");
-		return ret;
-	}
-#endif
-
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
common/lcd.c +0 -11
index d29308a..2f3594a 100644
@@ -31,10 +31,6 @@
 #endif
 #endif
 
-#ifdef CONFIG_SANDBOX
-#include <asm/sdl.h>
-#endif
-
 #ifndef CONFIG_LCD_ALIGNMENT
 #define CONFIG_LCD_ALIGNMENT PAGE_SIZE
 #endif
@@ -72,13 +68,6 @@ void lcd_sync(void)
 	if (lcd_flush_dcache)
 		flush_dcache_range((u32)lcd_base,
 			(u32)(lcd_base + lcd_get_size(&line_length)));
-#elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL)
-	static ulong last_sync;
-
-	if (get_timer(last_sync) > 10) {
-		sandbox_sdl_sync(lcd_base);
-		last_sync = get_timer(0);
-	}
 #endif
 }
 
configs/sandbox_defconfig +1 -0
index e4b8412..3b6017f 100644
@@ -76,6 +76,7 @@ CONFIG_USB_EMUL=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL=y
+CONFIG_DM_VIDEO=y
 CONFIG_VIDEO_SANDBOX_SDL=y
 CONFIG_SYS_VSNPRINTF=y
 CONFIG_CMD_DHRYSTONE=y
drivers/serial/sandbox.c +2 -3
index cd2f91e..45dff98 100644
@@ -16,6 +16,7 @@
 #include <lcd.h>
 #include <os.h>
 #include <serial.h>
+#include <video.h>
 #include <linux/compiler.h>
 #include <asm/state.h>
 
@@ -114,9 +115,7 @@ static int sandbox_serial_pending(struct udevice *dev, bool input)
 		return 0;
 
 	os_usleep(100);
-#ifdef CONFIG_LCD
-	lcd_sync();
-#endif
+	video_sync_all();
 	if (next_index == serial_buf_read)
 		return 1;	/* buffer full */
 
drivers/video/sandbox_sdl.c +48 -47

123 lines not on this page · raw message

include/configs/sandbox.h +4 -6
index e1be603..23ae44c 100644
@@ -158,9 +158,7 @@
 
 /* LCD and keyboard require SDL support */
 #ifdef CONFIG_SANDBOX_SDL
-#define CONFIG_LCD
 #define CONFIG_CMD_BMP
-#define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define LCD_BPP			LCD_COLOR16
@@ -169,12 +167,12 @@
 #define CONFIG_KEYBOARD
 
 #define SANDBOX_SERIAL_SETTINGS		"stdin=serial,cros-ec-keyb,usbkbd\0" \
-					"stdout=serial,lcd\0" \
-					"stderr=serial,lcd\0"
+					"stdout=serial,lcd.vidconsole\0" \
+					"stderr=serial,lcd.vidconsole\0"
 #else
 #define SANDBOX_SERIAL_SETTINGS		"stdin=serial\0" \
-					"stdout=serial,lcd\0" \
-					"stderr=serial,lcd\0"
+					"stdout=serial,lcd.vidconsole\0" \
+					"stderr=serial,lcd.vidconsole\0"
 #endif
 
 #define SANDBOX_ETH_SETTINGS		"ethaddr=00:00:11:22:33:44\0" \
include/fdtdec.h +0 -1
index 27b350e..25e98c9 100644
@@ -151,7 +151,6 @@ enum fdt_compat_id {
 	COMPAT_GENERIC_SPI_FLASH,	/* Generic SPI Flash chip */
 	COMPAT_MAXIM_98095_CODEC,	/* MAX98095 Codec */
 	COMPAT_SAMSUNG_EXYNOS5_I2C,	/* Exynos5 High Speed I2C Controller */
-	COMPAT_SANDBOX_LCD_SDL,		/* Sandbox LCD emulation with SDL */
 	COMPAT_SAMSUNG_EXYNOS_SYSMMU,	/* Exynos sysmmu */
 	COMPAT_INTEL_MICROCODE,		/* Intel microcode update */
 	COMPAT_MEMORY_SPD,		/* Memory SPD information */
lib/fdtdec.c +0 -1
index b50d105..d56e1b1 100644
@@ -56,7 +56,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(GENERIC_SPI_FLASH, "spi-flash"),
 	COMPAT(MAXIM_98095_CODEC, "maxim,max98095-codec"),
 	COMPAT(SAMSUNG_EXYNOS5_I2C, "samsung,exynos5-hsi2c"),
-	COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"),
 	COMPAT(SAMSUNG_EXYNOS_SYSMMU, "samsung,sysmmu-v3.3"),
 	COMPAT(INTEL_MICROCODE, "intel,microcode"),
 	COMPAT(MEMORY_SPD, "memory-spd"),
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#22 lore raw

PATCH v2 11/14 dm: video: sandbox: Convert sandbox to use driver model for video

Quoted 9 lines · Simon Glass

Now that driver model support is available, convert sandbox over to use it. We can remove a few of the special hooks that sandbox currently has.

---

Changes in v2: None

Quoted 10 lines
 arch/sandbox/dts/sandbox.dts |  1 +
 board/sandbox/sandbox.c      | 17 --------
 common/lcd.c                 | 11 -----
 configs/sandbox_defconfig    |  1 +
 drivers/serial/sandbox.c     |  5 +--
 drivers/video/sandbox_sdl.c  | 95 ++++++++++++++++++++++----------------------
 include/configs/sandbox.h    | 10 ++---
 include/fdtdec.h             |  1 -
 lib/fdtdec.c                 |  1 -
 9 files changed, 56 insertions(+), 86 deletions(-)

Applied to u-boot-dm

#23 lore raw

PATCH v2 12/14 dm: video: test: Add tests for the video uclass

In reply to Simon Glass

Add tests that check that the video console is working correcty. Also check that text output produces the expected result. Test coverage includes character output, wrapping and scrolling.

---

Changes in v2:
- Fix 'resolutino' typo in comment

 arch/sandbox/dts/test.dts   |   7 ++
 drivers/video/sandbox_sdl.c |   9 ---
 include/dm/test.h           |   8 ++
 test/dm/Makefile            |   1 +
 test/dm/video.c             | 190 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 206 insertions(+), 9 deletions(-)
 create mode 100644 test/dm/video.c
arch/sandbox/dts/test.dts +7 -0
index 2e0d320..9b8d658 100644
@@ -195,6 +195,13 @@
 		vss-microvolts = <0>;
 	};
 
+	lcd {
+		u-boot,dm-pre-reloc;
+		compatible = "sandbox,lcd-sdl";
+		xres = <1366>;
+		yres = <768>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
drivers/video/sandbox_sdl.c +0 -9
index 450628e..21448a1 100644
@@ -20,15 +20,6 @@ enum {
 	LCD_MAX_HEIGHT		= 768,
 };
 
-
-/* This platform data is needed in tests, so declare it here */
-struct sandbox_sdl_plat {
-	int xres;
-	int yres;
-	int bpix;
-	int rot;
-};
-
 static int sandbox_sdl_probe(struct udevice *dev)
 {
 	struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
include/dm/test.h +8 -0
index a4bc5c8..ca924d9 100644
@@ -155,6 +155,14 @@ enum {
 /* Declare a new driver model test */
 #define DM_TEST(_name, _flags)	UNIT_TEST(_name, _flags, dm_test)
 
+/* This platform data is needed in tests, so declare it here */
+struct sandbox_sdl_plat {
+	int xres;
+	int yres;
+	int bpix;
+	int rot;
+};
+
 /* Declare ping methods for the drivers */
 int test_ping(struct udevice *dev, int pingval, int *pingret);
 int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
test/dm/Makefile +1 -0
index 3ff1b75..d4f3f22 100644
@@ -34,5 +34,6 @@ obj-$(CONFIG_DM_USB) += usb.o
 obj-$(CONFIG_DM_PMIC) += pmic.o
 obj-$(CONFIG_DM_REGULATOR) += regulator.o
 obj-$(CONFIG_TIMER) += timer.o
+obj-$(CONFIG_DM_VIDEO) += video.o
 obj-$(CONFIG_ADC) += adc.o
 endif
test/dm/video.c new file +190 -0

190 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#24 lore raw

PATCH v2 12/14 dm: video: test: Add tests for the video uclass

Quoted 11 lines · Simon Glass

Add tests that check that the video console is working correcty. Also check that text output produces the expected result. Test coverage includes character output, wrapping and scrolling.

---

Changes in v2:
- Fix 'resolutino' typo in comment

Quoted 7 lines
 arch/sandbox/dts/test.dts   |   7 ++
 drivers/video/sandbox_sdl.c |   9 ---
 include/dm/test.h           |   8 ++
 test/dm/Makefile            |   1 +
 test/dm/video.c             | 190 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 206 insertions(+), 9 deletions(-)
 create mode 100644 test/dm/video.c

Applied to u-boot-dm

#25 lore raw

PATCH v2 13/14 dm: video: test: Add tests for rotated consoles

In reply to Simon Glass

Test that text is displayed correctly when the console is rotated.

---

Changes in v2: None

 configs/sandbox_defconfig |  1 +
 test/dm/video.c           | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
configs/sandbox_defconfig +1 -0
index 3b6017f..b55d5e5 100644
@@ -77,6 +77,7 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL=y
 CONFIG_DM_VIDEO=y
+CONFIG_VIDEO_ROTATION=y
 CONFIG_VIDEO_SANDBOX_SDL=y
 CONFIG_SYS_VSNPRINTF=y
 CONFIG_CMD_DHRYSTONE=y
test/dm/video.c +27 -0
index b197b01..65db216 100644
@@ -188,3 +188,30 @@ static int dm_test_video_context(struct unit_test_state *uts)
 	return check_vidconsole_output(uts, 0, 788, 453);
 }
 DM_TEST(dm_test_video_context, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test rotated text output through the console uclass */
+static int dm_test_video_rotation1(struct unit_test_state *uts)
+{
+	ut_assertok(check_vidconsole_output(uts, 1, 1112, 680));
+
+	return 0;
+}
+DM_TEST(dm_test_video_rotation1, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test rotated text output through the console uclass */
+static int dm_test_video_rotation2(struct unit_test_state *uts)
+{
+	ut_assertok(check_vidconsole_output(uts, 2, 785, 446));
+
+	return 0;
+}
+DM_TEST(dm_test_video_rotation2, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test rotated text output through the console uclass */
+static int dm_test_video_rotation3(struct unit_test_state *uts)
+{
+	ut_assertok(check_vidconsole_output(uts, 3, 1134, 681));
+
+	return 0;
+}
+DM_TEST(dm_test_video_rotation3, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#26 lore raw

PATCH v2 13/14 dm: video: test: Add tests for rotated consoles

Quoted 11 lines · Simon Glass

Test that text is displayed correctly when the console is rotated.

---

Changes in v2: None

 configs/sandbox_defconfig |  1 +
 test/dm/video.c           | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

Applied to u-boot-dm

#27 lore raw

PATCH v2 14/14 dm: video: test: Test that bitmap display works correctly

In reply to Simon Glass

Add a test for the 'bmp' command. Test both the uncompressed and compressed versions of the file, since they use different code paths.

---

Changes in v2: None

 include/configs/sandbox.h |   2 ++
 test/dm/video.c           |  54 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/logos/denx-comp.bmp | Bin 0 -> 4148 bytes
 3 files changed, 56 insertions(+)
 create mode 100644 tools/logos/denx-comp.bmp
include/configs/sandbox.h +2 -0
index 23ae44c..6498981 100644
@@ -163,6 +163,8 @@
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define LCD_BPP			LCD_COLOR16
 #define CONFIG_LCD_BMP_RLE8
+#define CONFIG_VIDEO_BMP_RLE8
+#define CONFIG_SPLASH_SCREEN_ALIGN
 
 #define CONFIG_KEYBOARD
 
test/dm/video.c +54 -0

57 lines not on this page · raw message

tools/logos/denx-comp.bmp new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..89d0f471c85cf734b5f0e2bb2508d39f5b9e72b8
GIT binary patch

zM<VaCyTW>jrIN8kJ}yPxm at R)htdsy{^j&j&%I?E#k at -`>WrHoIihlzQ6JN0~jqn zgj at QYdis={dEtzlefg}Md-I%Jc;|v#ymV16eQ-%Ge{@-{esWc=eRfT*e|=qUet%PL z-M%Gvf4(cbzwOE+Uv%>LSDie2qmviE>E!kAI(hqtPTu>mlMioqa^<H^KE2b)m%nuK z?XR8O+U?}dAD!&}*-6(e!CJy}@8uo?_ZawZ7&z)eQPqg=^fjjm&q%{i0w;3B1(LE} zaayQoo;Wly+mtvNrLoMmObq}a*1eVHnGEx<c?p*n8&B0#3AwMMIt;&%|Vf)0DaA zzs(c7Ff~+o40zXk<gLx4Dwh4#pwNxdVG;-?e~>BEe!{g)#(V#agEl14zzi$D5%s zxvl-43?GQ2u=fRGtroue`*EhW8*bbC<23pwk6<$|S%ii0Z3uJEc#jXcv7GY;|I2=J zI80oxtto8I8H88-S>z!r#$nX^3R3cI at dkvwSE2+I!R#E}O7UP(dtagDZ5DxiRH0|p zvZsmZ_<IzVFC;ZA<>psiY%J!PM>Cvgg|EaU=*9hM2-d+rSlF99rv<Ly^CZ5WpeB$M zNBj5mNp$XGZ}PxJ@V>%HBrE8$qk<dWdk)6zsOwCT)jjgkv<;_tY*bKe9QCy|<~f0< z*m@(i%)yBD#oQX-k*}h9u<s+8u36(9UdUdc#z at xR$=lmWswFXR?R85AVy5Q5m-b^ z0()te^w!!=ax&qE3vQXQ|FmQ{OXSfM2VD0Tn#Z3n3@Qggw{1R7<<Jv2B)<9(w{F z!>SAG84r2S)au+;M<C#)Rx9R112BRfmJ-{AGII2DTJT+YO)c>ba<j0mCAUl+tE|~w zU>+VaPEupqD(fNijN5a5?<=l0?(F@zACBj?_jnQtBYZ+63fMIj6;gun?rwc6r?C zmac1i%xSCZVmuZjv<{Jpk?eTP;B1pdx3>bCXE>Wa6*1sdX;BzaITd#I^J+OI;A^+ zmnk>pS+{eIqR|#CTLn7wfKIvZ8ojnDn{%D2S#cHe%pJ5$gj+J5%SMeJgq7_P^3*xl zAU-}e<{C8-N~hx*jl}K1D|brJ$roN4ZbS6#2A$Z|)Cd)tYhX9$b~Ps at IV?3{#^iHk z+b}h$o7 at p&q8nDP71c_AM<uM3SeMq(S%2SxTcoU*JVdTQ3i7)2Q?-C;Dm~fqxJy@p zh#9g1KWhp4q3Ks+>u1ot($tDN3OtQ(PU_Wk!h*b1dWV!+<U8$Vh>K!$mIab=2R{Z z&*a=5jl3!58s>+7%lNGt^;%T!Bty$YI;nhI+G3f&d|)|g!eVZi?T|uk&Kt;-wzs zxGGuvc1qbMxF{_A4e~Ro*_M3iipy)x$AvgPWMH2YWSlC6$Ya=2t2ne}0^PM<Ox z!LSj;0<N@@OvKgH3}$o>8-V at 5Ha6+z%rsSY&a=hTS*tJRO5eh+?=;2B=o!>DD? z<QvqAWsz#%!uOP15L-8g{AocCA+=nOf=J6WSC5of1Bnu$=EAhRj1%&&-_?a3tbR! z7LDzH7@H(@VKECIxyqSliw%Q&3_W)I<?xjRBj$!sZqou4^%MJ)7%vh(>e-eNtHm zlnpbYM03$2v1{xXCe?V%IX#%tf%Xd=F+=)&sS!O|@|(M at o4Pvd#Z_&s*AHX$7=55E z{XL<-C)VGoJ7n0BM{VA;bnbMR4jI#dD$h?Do|eh7HB1&Xvu(1)bV@*wPQj|}FqaIy zO{R4^9mbM%n}}Mta4jF9jlfcFd1j1`~_k=1o5ri5D?5GRyrsQP>Aq=iDlT>0!=J xZO)RVl5uUE)G_*-_8u``QZKPxq!rV&4Qw8@)aGW0-441JsjvUhv$Xq&{tYdt;;8 at t

literal 0
HcmV?d00001

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#28 lore raw

PATCH v2 14/14 dm: video: test: Test that bitmap display works correctly

Quoted 7 lines · Simon Glass

Add a test for the 'bmp' command. Test both the uncompressed and compressed versions of the file, since they use different code paths.

---

Quoted 7 lines

Changes in v2: None

 include/configs/sandbox.h |   2 ++
 test/dm/video.c           |  54 ++++++++++++++++++++++++++++++++++++++++++++++
 tools/logos/denx-comp.bmp | Bin 0 -> 4148 bytes
 3 files changed, 56 insertions(+)
 create mode 100644 tools/logos/denx-comp.bmp

Applied to u-boot-dm

#29 lore raw

v2 cover dm: video: Introduce initial driver-model video support

In reply to Simon Glass

Hi,

Quoted 96 lines · Simon Glass

This series starts the process of converting LCD and video devices over to use driver model. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver-model conversion these will end up unified in a single uclass.

Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model for video.

The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass does not implement them. This includes lcd_ctrl_init(), lcd_enable() and video_init().

Tests are provided to check that console text and bitmap output is correct. These should be able to be extended as more features are added.

Future work will convert a few boards over to use driver model for video. Likely targets are x86, exynos, tegra. Also, Rockchip LCD support will be added using driver model (patches will likely be sent some time in January).

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment
- Fix 'resolutino' typo in comment

Simon Glass (14):
dm: video: Add a video uclass
dm: lcd: Avoid using the lcd.h header file with driver model
dm: video: Add a uclass for the text console
dm: video: Add a 'normal' text console driver
dm: video: Add a driver for a rotated text console
common: Move LCD and video memory reservation together
dm: common: Add memory reservation for the video uclass
dm: video: Implement the bmp command for driver model
dm: stdio: video: Plumb the video uclass into stdio
sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig
dm: video: sandbox: Convert sandbox to use driver model for video
dm: video: test: Add tests for the video uclass
dm: video: test: Add tests for rotated consoles
dm: video: test: Test that bitmap display works correctly

 arch/sandbox/dts/sandbox.dts      |   1 +
 arch/sandbox/dts/test.dts         |   7 +
 board/sandbox/sandbox.c           |  17 --
 common/Makefile                   |   2 +
 common/board_f.c                  |  71 ++++---
 common/cmd_bmp.c                  |  22 +-
 common/lcd.c                      |  11 -
 common/stdio.c                    |  19 +-
 configs/sandbox_defconfig         |   5 +-
 drivers/serial/sandbox.c          |   5 +-
 drivers/video/Kconfig             |  62 ++++++
 drivers/video/Makefile            |   3 +
 drivers/video/console_normal.c    | 141 ++++++++++++
 drivers/video/console_rotate.c    | 436 ++++++++++++++++++++++++++++++++++++++
 drivers/video/sandbox_sdl.c       |  90 ++++----
 drivers/video/vidconsole-uclass.c | 239 +++++++++++++++++++++
 drivers/video/video-uclass.c      | 249 ++++++++++++++++++++++
 drivers/video/video_bmp.c         | 353 ++++++++++++++++++++++++++++++
 include/asm-generic/global_data.h |   4 +
 include/configs/sandbox.h         |  13 +-
 include/dm/test.h                 |   8 +
 include/dm/uclass-id.h            |   2 +
 include/fdtdec.h                  |   1 -
 include/lcd.h                     |  12 +-
 include/video.h                   | 168 ++++++++++++++-
 include/video_console.h           | 136 ++++++++++++
 lib/fdtdec.c                      |   1 -
 test/dm/Makefile                  |   1 +
 test/dm/video.c                   | 271 +++++++++++++++++++++++
 tools/logos/denx-comp.bmp         | Bin 0 -> 4148 bytes
 30 files changed, 2221 insertions(+), 129 deletions(-)
 create mode 100644 drivers/video/console_normal.c
 create mode 100644 drivers/video/console_rotate.c
 create mode 100644 drivers/video/vidconsole-uclass.c
 create mode 100644 drivers/video/video-uclass.c
 create mode 100644 drivers/video/video_bmp.c
 create mode 100644 include/video_console.h
 create mode 100644 test/dm/video.c
 create mode 100644 tools/logos/denx-comp.bmp
Quoted 3 lines

--
2.6.0.rc2.230.g3dd15c0

This is available at u-boot-dm branch rbk-working if you are interested in trying it out. But it only works for sandbox.

make O=sandbox sandbox_defconfig all
./sandbox/u-boot -Dl

Regards,
Simon

#30 lore raw

v2 cover dm: video: Introduce initial driver-model video support

Hi Anatolij,

Quoted 42 lines · Simon Glass

Hi,

Quoted 39 lines · Simon Glass

This series starts the process of converting LCD and video devices over to use driver model. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver-model conversion these will end up unified in a single uclass.

Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support:

- bitmap devices with 8, 16 and 32 bits per pixel
- text console wih white on black or vice versa
- rotated text console
- bitmap display (BMP format)

More can be added as additional boards are ported over to use driver model for video.

The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach.

The existing LCD and video init functions are not needed now, so this uclass does not implement them. This includes lcd_ctrl_init(), lcd_enable() and video_init().

Tests are provided to check that console text and bitmap output is correct. These should be able to be extended as more features are added.

Future work will convert a few boards over to use driver model for video. Likely targets are x86, exynos, tegra. Also, Rockchip LCD support will be added using driver model (patches will likely be sent some time in January).

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment
- Fix 'resolutino' typo in comment

If this looks OK, please let me know if you plan to pick this up, otherwise I'll bring it via DM. There are some dependent patches in dm/master, but I can send a pull request for those.

Regards,
Simon

#31 lore raw

v2 cover dm: video: Introduce initial driver-model video support

Hi Simon,

On Mon, 18 Jan 2016 19:57:53 -0700
Simon Glass <[email protected]> wrote:
...

Quoted 11 lines
Quoted 7 lines
Quoted 7 lines

Changes in v2:
- Fix Ebabling typo in comment
- Remove duplicated @fb_size line in common
- Fix comment for video_get_ysize()
- Fix reference to \n which should be \b
- Fix 'withthe' typo in comment
- Fix 'resolutino' typo in comment

If this looks OK, please let me know if you plan to pick this up, otherwise I'll bring it via DM. There are some dependent patches in dm/master, but I can send a pull request for those.

I can apply this series when the dependent patches in dm/master are merged to u-boot/master. You can merge this series via DM if you like, no objection from my side.

Thanks,
Anatolij