dm: video: Introduce initial driver-model video support
Subsystems (3)
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).
Simon Glass (18):
tiny-printf: Always print zeroes
sandbox: Support the bmp command
dm: core: Call uclass post_bind() after the driver's bind() method
bzip2: Support compression for sandbox
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 | 37 +- common/lcd.c | 11 - common/stdio.c | 19 +- configs/sandbox_defconfig | 5 +- drivers/core/device.c | 7 + drivers/core/uclass.c | 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 | 435 ++++++++++++++ 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/bzlib.h | 3 + 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 | 169 +++++- include/video_console.h | 136 +++++ lib/bzip2/Makefile | 1 + lib/bzip2/bzlib_blocksort.c | 1134 +++++++++++++++++++++++++++++++++++++ lib/bzip2/bzlib_compress.c | 714 +++++++++++++++++++++++ lib/fdtdec.c | 1 - lib/tiny-printf.c | 16 +- test/dm/Makefile | 1 + test/dm/video.c | 271 +++++++++ tools/logos/denx-comp.bmp | Bin 0 -> 4148 bytes 37 files changed, 4101 insertions(+), 144 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 lib/bzip2/bzlib_blocksort.c create mode 100644 lib/bzip2/bzlib_compress.c create mode 100644 test/dm/video.c create mode 100644 tools/logos/denx-comp.bmp
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 1/18 tiny-printf: Always print zeroes
At present this does not print zero values in numeric format (hex and decimal). Add a special case for this.
---
lib/tiny-printf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
lib/tiny-printf.c +12 -4
@@ -82,13 +82,21 @@ int vprintf(const char *fmt, va_list va) num = -(int )num;out ('-' ); } -for (div =1000000000 ; div; div /=10 ) -div_out (&num, div); +if (!num) { +out_dgt (0 ); + }else { +for (div =1000000000 ; div; div /=10 ) +div_out (&num, div); + }break ;case 'x' : num = va_arg(va, unsigned int); -for (div =0x10000000 ; div; div /=0x10 ) -div_out (&num, div); +if (!num) { +out_dgt (0 ); + }else { +for (div =0x10000000 ; div; div /=0x10 ) +div_out (&num, div); + }break ;case 'c' :out ((char )(va_arg (va, int)));
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 1/18 tiny-printf: Always print zeroes
Quoted 30 lines · Simon Glass
At present this does not print zero values in numeric format (hex and decimal). Add a special case for this.
Signed-off-by Simon Glass <[email protected]>---
lib/tiny-printf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)lib/tiny-printf.c +6
-3@@ -82,13 +82,21 @@ int vprintf(const char *fmt, va_list va) num = -(int )num;out ('-' ); } -for (div =1000000000 ; div; div /=10 ) -div_out (&num, div); +if (!num) { +out_dgt (0 ); + }else { +for (div =1000000000 ; div; div /=10 ) +div_out (&num, div); + }break ;case 'x' : num = va_arg(va, unsigned int); -for (div =0x10000000 ; div; div /=0x10 )
lib/tiny-printf.c int vprintf(const char *fmt, va_list va) · line 102
Quoted 10 lines
lib/tiny-printf.c +6
-1-div_out (&num, div); +if (!num) { +out_dgt (0 ); + }else { +for (div =0x10000000 ; div; div /=0x10 ) +div_out (&num, div); + }break ;case 'c' :out ((char )(va_arg (va, int)));
Thanks,
Stefan
PATCH 1/18 tiny-printf: Always print zeroes
In reply to Simon GlassQuoted 4 lines · Simon Glass
At present this does not print zero values in numeric format (hex and decimal). Add a special case for this.
Signed-off-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/5188c298/attachment.sig>
PATCH 1/18 tiny-printf: Always print zeroes
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
At present this does not print zero values in numeric format (hex and decimal). Add a special case for this.
Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Applied to u-boot-dm
PATCH 2/18 sandbox: Support the bmp command
In reply to Simon GlassAdjust this command to use map_sysmem() correctly so that it works on sandbox.
---
common/cmd_bmp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
common/cmd_bmp.c +8 -5
@@ -15,6 +15,7 @@#include <command.h> #include <asm/byteorder.h> #include <malloc.h> +#include <mapmem.h> #include <splash.h> #include <video.h>
@@ -57,7 +58,8 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,/* align to 32-bit-aligned-address + 2 */ bmp = (struct bmp_image *)((((unsigned int )dst +1 ) & ~3 ) +2 ); -if (gunzip (bmp,CONFIG_SYS_VIDEO_LOGO_MAX_SIZE , (uchar *)addr, &len) !=0 ) { +if (gunzip (bmp,CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ,map_sysmem (addr,0 ), + &len) !=0 ) {free (dst);return NULL ; }
@@ -187,7 +189,7 @@ U_BOOT_CMD(*/ static int bmp_info (ulong addr) { -struct bmp_image *bmp = (struct bmp_image *)addr; +struct bmp_image *bmp = (struct bmp_image *)map_sysmem (addr,0 );void *bmp_alloc_addr =NULL ;unsigned long len;
@@ -224,7 +226,7 @@ static int bmp_info(ulong addr)int bmp_display (ulong addr,int x,int y) {int ret; -struct bmp_image *bmp = (struct bmp_image *)addr; +struct bmp_image *bmp =map_sysmem (addr,0 );void *bmp_alloc_addr =NULL ;unsigned long len;
@@ -236,11 +238,12 @@ int bmp_display(ulong addr, int x, int y)printf ("There is no valid bmp file at the given address\n" );return 1 ; } + addr =map_to_sysmem (bmp);#if defined(CONFIG_LCD ) - ret =lcd_display_bitmap ((ulong )bmp, x, y); + ret =lcd_display_bitmap (addr, x, y);#elif defined(CONFIG_VIDEO ) - ret =video_display_bitmap ((unsigned long )bmp, x, y); + ret =video_display_bitmap (addr, x, y);#else # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO#endif
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 2/18 sandbox: Support the bmp command
Quoted 4 lines · Simon Glass
Adjust this command to use
map_sysmem()correctly so that it works on sandbox.Signed-off-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/2f8dbc49/attachment.sig>
PATCH 2/18 sandbox: Support the bmp command
Quoted 11 lines · Tom Rini
Quoted 4 lines · Simon Glass
Adjust this command to use
map_sysmem()correctly so that it works on sandbox.Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Applied to u-boot-dm
PATCH 3/18 dm: core: Call uclass post_bind() after the driver's bind() method
In reply to Simon GlassAt present the uclass's post_bind() method is called before the driver's bind() method. This means that the uclass cannot use any of the information set up by the driver. Move it later in the sequence to permit this.
This is an ordering change which is always fairly major in nature. The main impact is that devices which have children will not see them appear in their bind() method. From what I can see, existing drivers do not look at their children in the bind() method, so this should be safe.
Conceptually this change seems to result in a 'more correct' ordering, since the uclass (which is broader than the device) gets the last word.
---
drivers/core/device.c | 7 +++++++ drivers/core/uclass.c | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/core/device.c +7 -0
@@ -135,6 +135,11 @@ int device_bind(struct udevice *parent, const struct driver *drv,if (ret) goto fail_child_post_bind; } +if (uc->uc_drv->post_bind) { + ret = uc->uc_drv->post_bind (dev); +if (ret) + goto fail_uclass_post_bind; + }if (parent)dm_dbg ("Bound device %s to %s\n" , dev->name, parent->name);
@@ -145,6 +150,8 @@ int device_bind(struct udevice *parent, const struct driver *drv,return 0 ; +fail_uclass_post_bind: +/* There is no child unbind() method, so no clean-up required */ fail_child_post_bind:if (CONFIG_IS_ENABLED (DM_DEVICE_REMOVE )) {if (drv->unbind && drv->unbind (dev)) {
drivers/core/uclass.c +0 -5
@@ -426,11 +426,6 @@ int uclass_bind_device(struct udevice *dev) goto err; } } -if (uc->uc_drv->post_bind) { - ret = uc->uc_drv->post_bind (dev); -if (ret) - goto err; - }return 0 ; err:
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 3/18 dm: core: Call uclass post_bind() after the driver's bind() method
Quoted 9 lines · Simon Glass
At present the uclass's
post_bind()method is called before the driver'sbind()method. This means that the uclass cannot use any of the information set up by the driver. Move it later in the sequence to permit this.This is an ordering change which is always fairly major in nature. The main impact is that devices which have children will not see them appear in their
bind()method. From what I can see, existing drivers do not look at their children in thebind()method, so this should be safe.
Quoted 4 lines
Conceptually this change seems to result in a 'more correct' ordering, since the uclass (which is broader than the device) gets the last word.
Signed-off-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/c401634c/attachment.sig>
PATCH 3/18 dm: core: Call uclass post_bind() after the driver's bind() method
Quoted 14 lines · Tom Rini
Quoted 12 lines · Simon Glass
At present the uclass's
post_bind()method is called before the driver'sbind()method. This means that the uclass cannot use any of the information set up by the driver. Move it later in the sequence to permit this.This is an ordering change which is always fairly major in nature. The main impact is that devices which have children will not see them appear in their
bind()method. From what I can see, existing drivers do not look at their children in thebind()method, so this should be safe.Conceptually this change seems to result in a 'more correct' ordering, since the uclass (which is broader than the device) gets the last word.
Quoted 6 lines
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Applied to u-boot-dm
PATCH 4/18 bzip2: Support compression for sandbox
In reply to Simon GlassAdd the missing code to allow bzip2 compression to be used. This is useful for sandbox tests. These files are taken from the bzip2 1.0.6 release. The license text is copied to the top of each file as is done with other bzip2 files in U-Boot. The only other change is to squash a compiler warning with nBytes.
---
include/bzlib.h | 3 + lib/bzip2/Makefile | 1 + lib/bzip2/bzlib_blocksort.c | 1134 +++++++++++++++++++++++++++++++++++++++++++ lib/bzip2/bzlib_compress.c | 714 +++++++++++++++++++++++++++ 4 files changed, 1852 insertions(+) create mode 100644 lib/bzip2/bzlib_blocksort.c create mode 100644 lib/bzip2/bzlib_compress.c
include/bzlib.h +3 -0
@@ -68,7 +68,10 @@/* Configure for U-Boot environment */ #define BZ_NO_STDIO + +#ifndef CONFIG_SANDBOX #define BZ_NO_COMPRESS +#endif /* End of configuration for U-Boot environment */ #ifdef __cplusplus
lib/bzip2/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y += bzlib.o bzlib_crctable.o bzlib_decompress.o \ bzlib_randtable.o bzlib_huffman.o +obj-$(CONFIG_SANDBOX) += bzlib_compress.o bzlib_blocksort.o
lib/bzip2/bzlib_blocksort.c new file +1134 -0
1,134 lines not on this page · raw message
lib/bzip2/bzlib_compress.c new file +714 -0
714 lines not on this page · raw message
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 4/18 bzip2: Support compression for sandbox
Quoted 7 lines · Simon Glass
Add the missing code to allow bzip2 compression to be used. This is useful for sandbox tests. These files are taken from the bzip2 1.0.6 release. The license text is copied to the top of each file as is done with other bzip2 files in U-Boot. The only other change is to squash a compiler warning with nBytes.
Signed-off-by Simon Glass <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/700cf2d1/attachment.sig>
PATCH 4/18 bzip2: Support compression for sandbox
Quoted 8 lines · Tom Rini
Quoted 6 lines · Simon Glass
Add the missing code to allow bzip2 compression to be used. This is useful for sandbox tests. These files are taken from the bzip2 1.0.6 release. The license text is copied to the top of each file as is done with other bzip2 files in U-Boot. The only other change is to squash a compiler warning with nBytes.
Quoted 6 lines
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>Reviewed-by Tom Rini <[email protected]>--
Tom
Applied to u-boot-dm
PATCH 5/18 dm: video: Add a video uclass
In reply to Simon GlassU-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.
---
drivers/video/Kconfig | 40 ++++++++ drivers/video/Makefile | 1 + drivers/video/video-uclass.c | 228 +++++++++++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/video.h | 169 ++++++++++++++++++++++++++++++-- 5 files changed, 433 insertions(+), 6 deletions(-) create mode 100644 drivers/video/video-uclass.c
drivers/video/Kconfig +40 -0
@@ -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. + Ebabling 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. + Ebabling 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. + Ebabling 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
@@ -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
@@ -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 +163 -6
181 lines not on this page · raw message
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 5/18 dm: video: Add a video uclass
Hi Simon,
Some minor comments below. Otherwise
On Tue, 5 Jan 2016 09:31:01 -0700
Simon Glass <[email protected]> wrote:
...
drivers/video/Kconfig line 23
Quoted 7 lines
drivers/video/Kconfig +7
-0+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. + Ebabling this will include code to support this display. Without
s/Ebabling/Enabling/
drivers/video/Kconfig line 33
Quoted 7 lines
drivers/video/Kconfig +7
-0+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. + Ebabling this will include code to support this display. Without
same typo here.
drivers/video/Kconfig line 43
Quoted 7 lines
drivers/video/Kconfig +7
-0+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. + Ebabling this will include code to support this display. Without
s/Ebabling/Enabling/
...
Quoted 10 lines
+/**
+ * structvideo_priv- Device information used by the video uclass
+ *
+ * @xsize: Number of pixel columns (e.g. 1366)
+ * @ysize: Number of pixels rows (e.g.. 768)
+ * @tor: Display rotation (0=none, 1=90 degrees clockwise, etc.)
+ * @bpix: Encoded bits per pixel
+ * @fb: Frame buffer
+ * @fb_size: Frame buffer size
+ * @fb_size: Frame buffer size
Please remove duplicated line here.
...
Quoted 2 lines
+/**
+ *video_get_xsize()- Get the height of the display in pixels
s/_xsize/_ysize/
Thanks,
Anatolij
PATCH 6/18 dm: lcd: Avoid using the lcd.h header file with driver model
In reply to Simon GlassThe 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.
---
common/Makefile | 2 ++ include/lcd.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
common/Makefile +2 -0
@@ -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
@@ -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
PATCH 6/18 dm: lcd: Avoid using the lcd.h header file with driver model
Quoted 10 lines · On Tue, 5 Jan 2016 09:31:02 -0700 Simon Glass <[email protected]> wrote:
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.
Signed-off-by Simon Glass <[email protected]>---
common/Makefile | 2 ++ include/lcd.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
--
Anatolij
PATCH 7/18 dm: video: Add a uclass for the text console
In reply to Simon GlassThe 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.
---
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
@@ -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
@@ -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
@@ -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
PATCH 7/18 dm: video: Add a uclass for the text console
On Tue, 5 Jan 2016 09:31:03 -0700
Simon Glass <[email protected]> wrote:
...
Quoted 6 lines
+/**
+ *vidconsole_put_char()- Output a character to the current console position
+ *
+ * Outputs a character to the console and advances the cursor. This function
+ * handles wrapping to new lines and scrolling the console. Special
+ * characters are handled also: \n, \r, \n and \t.
there are two "\n", one of them should be "\b" it seems.
Quoted 2 lines
+ *
+ * The device always starts withthe cursor at position 0,0 (top left). It
s/withthe/with the/
Otherwise
--
Anatolij
PATCH 8/18 dm: video: Add a 'normal' text console driver
In reply to Simon GlassMost 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.
---
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
@@ -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
PATCH 8/18 dm: video: Add a 'normal' text console driver
Quoted 5 lines · On Tue, 5 Jan 2016 09:31:04 -0700 Simon Glass <[email protected]> wrote:
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 7 lines
Signed-off-by Simon Glass <[email protected]>---
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
--
Anatolij
PATCH 9/18 dm: video: Add a driver for a rotated text console
In reply to Simon GlassSometimes 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.
---
drivers/video/Kconfig | 13 ++ drivers/video/Makefile | 1 + drivers/video/console_rotate.c | 435 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 449 insertions(+) create mode 100644 drivers/video/console_rotate.c
drivers/video/Kconfig +13 -0
@@ -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
@@ -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 +435 -0
435 lines not on this page · raw message
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
PATCH 9/18 dm: video: Add a driver for a rotated text console
Quoted 4 lines · On Tue, 5 Jan 2016 09:31:05 -0700 Simon Glass <[email protected]> wrote:
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 8 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/video/Kconfig | 13 ++ drivers/video/Makefile | 1 + drivers/video/console_rotate.c | 435 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 449 insertions(+) create mode 100644 drivers/video/console_rotate.c
--
Anatolij
PATCH 10/18 common: Move LCD and video memory reservation together
In reply to Simon GlassThese two functions are conceptually the same. Move them together in the pre-relocation init.
---
common/board_f.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
common/board_f.c +14 -14
@@ -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
PATCH 10/18 common: Move LCD and video memory reservation together
Quoted 8 lines · On Tue, 5 Jan 2016 09:31:06 -0700 Simon Glass <[email protected]> wrote:
These two functions are conceptually the same. Move them together in the pre-relocation init.
Signed-off-by Simon Glass <[email protected]>---
common/board_f.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
--
Anatolij
PATCH 11/18 dm: common: Add memory reservation for the video uclass
In reply to Simon GlassBefore 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.
---
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
@@ -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
@@ -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
PATCH 11/18 dm: common: Add memory reservation for the video uclass
Quoted 8 lines · On Tue, 5 Jan 2016 09:31:07 -0700 Simon Glass <[email protected]> wrote:
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_dataso that it can be checked post-relocation to ensure enough memory is available. No video device should be probed before relocation.
Quoted 6 lines
Signed-off-by Simon Glass <[email protected]>---
common/board_f.c | 47 +++++++++++++++++++++++++++++---------- include/asm-generic/global_data.h | 4 ++++ 2 files changed, 39 insertions(+), 12 deletions(-)
--
Anatolij
PATCH 12/18 dm: video: Implement the bmp command for driver model
In reply to Simon GlassThis 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.
---
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
@@ -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
@@ -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
PATCH 12/18 dm: video: Implement the bmp command for driver model
Quoted 4 lines · On Tue, 5 Jan 2016 09:31:08 -0700 Simon Glass <[email protected]> wrote:
This command can use the bitmap display code in the uclass. This is similar to the code in
lcd.candcfb_console.c. These other copies will go away when all boards are converted to use driver model for video.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
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
--
Anatolij
PATCH 13/18 dm: stdio: video: Plumb the video uclass into stdio
In reply to Simon GlassRegister 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.
---
common/stdio.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
common/stdio.c +15 -4
@@ -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
PATCH 13/18 dm: stdio: video: Plumb the video uclass into stdio
Quoted 9 lines · On Tue, 5 Jan 2016 09:31:09 -0700 Simon Glass <[email protected]> wrote:
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.
Signed-off-by Simon Glass <[email protected]>---
common/stdio.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
--
Anatolij
PATCH 14/18 sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig
In reply to Simon GlassMove this option to Kconfig. This is quite simple as only sandbox uses the driver.
---
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
@@ -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
@@ -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
@@ -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
PATCH 14/18 sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig
Quoted 10 lines · On Tue, 5 Jan 2016 09:31:10 -0700 Simon Glass <[email protected]> wrote:
Move this option to
Kconfig. This is quite simple as only sandbox uses the driver.Signed-off-by Simon Glass <[email protected]>---
configs/sandbox_defconfig | 3 ++- drivers/video/Kconfig | 9 +++++++++ include/configs/sandbox.h | 1 - 3 files changed, 11 insertions(+), 2 deletions(-)
--
Anatolij
PATCH 15/18 dm: video: sandbox: Convert sandbox to use driver model for video
In reply to Simon GlassNow 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.
---
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
@@ -117,6 +117,7 @@ }; lcd { + u-boot,dm-pre-reloc; compatible = "sandbox,lcd-sdl"; xres = <1366>; yres = <768>;
board/sandbox/sandbox.c +0 -17
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 15/18 dm: video: sandbox: Convert sandbox to use driver model for video
Quoted 6 lines · On Tue, 5 Jan 2016 09:31:11 -0700 Simon Glass <[email protected]> wrote:
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.
Signed-off-by Simon Glass <[email protected]>---
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(-)
--
Anatolij
PATCH 16/18 dm: video: test: Add tests for the video uclass
In reply to Simon GlassAdd 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.
---
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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 16/18 dm: video: test: Add tests for the video uclass
Quoted 14 lines · On Tue, 5 Jan 2016 09:31:12 -0700 Simon Glass <[email protected]> wrote:
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.
Signed-off-by Simon Glass <[email protected]>---
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
...
Quoted 2 lines
+/*
+ * These tests use the standard sandbox frame buffer, the resolutino of which
s/resolutino/resolution/
Otherwise
--
Anatolij
PATCH 17/18 dm: video: test: Add tests for rotated consoles
In reply to Simon GlassTest that text is displayed correctly when the console is rotated.
---
configs/sandbox_defconfig | 1 + test/dm/video.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
configs/sandbox_defconfig +1 -0
@@ -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
@@ -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
PATCH 17/18 dm: video: test: Add tests for rotated consoles
Quoted 8 lines · On Tue, 5 Jan 2016 09:31:13 -0700 Simon Glass <[email protected]> wrote:
Test that text is displayed correctly when the console is rotated.
Signed-off-by Simon Glass <[email protected]>---
configs/sandbox_defconfig | 1 + test/dm/video.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+)
--
Anatolij
PATCH 18/18 dm: video: test: Test that bitmap display works correctly
In reply to Simon GlassAdd a test for the 'bmp' command. Test both the uncompressed and compressed versions of the file, since they use different code paths.
---
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
@@ -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
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
PATCH 18/18 dm: video: test: Test that bitmap display works correctly
Quoted 11 lines · On Tue, 5 Jan 2016 09:31:14 -0700 Simon Glass <[email protected]> wrote:
Add a test for the 'bmp' command. Test both the uncompressed and compressed versions of the file, since they use different code paths.
Signed-off-by Simon Glass <[email protected]>---
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
--
Anatolij
cover dm: video: Introduce initial driver-model video support
In reply to Simon GlassHi Simon,
Quoted 14 lines
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)
Quoted 6 lines
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.
This is very welcome ... i will patch my tree with your changes and try to adapt my LCD-driver (am335xfb.c) to new driver-model and run some tests on the B&R boards.
Quoted 3 lines
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()andvideo_init().
This is not true for me, i use this functions to setup lcd-timings and backlight switch on.
You can have a look at the B&R tseries board.
Maybe we can consider how to setup an lcd device (different timing, backlights) in future,
Quoted 6 lines
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).
best regards,
Hannes
cover dm: video: Introduce initial driver-model video support
Hi Hannes,
Quoted 21 lines · Hannes Schmelzer
Hi Simon,
Quoted 20 lines
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.
Quoted 8 lines
Quoted 4 lines
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.This is very welcome ... i will patch my tree with your changes and try to adapt my LCD-driver (
am335xfb.c) to new driver-model and run some tests on the B&R boards.
OK. I have some further work to get out in the next week or so. In the meantime you can check out u-boot-dm/rkh-working. But I'll update it by tomorrow as there are some changes.
Quoted 11 lines
Quoted 5 lines
The existing LCD and video init functions are not needed now, so this uclass
does not implement them. This includeslcd_ctrl_init(),lcd_enable()andvideo_init().This is not true for me, i use this functions to setup lcd-timings and backlight switch on.
You can have a look at the B&R tseries board.
Maybe we can consider how to setup an lcd device (different timing, backlights) in future,
Yes I have the same issue with most boards. This is handled by new uclasses I have added. Have been a bit slow due to Christmas, etc. but will get this stuff out next week.
Quoted 5 lines
Quoted 5 lines
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.
Quoted 7 lines
Quoted 4 lines
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).
best regards,
Hannes
Regards,
Simon