video: sunxi_display: Convert to DM_VIDEO
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
From: Jagan Teki <[email protected]>
DM_VIDEO migration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.
===================== WARNING ====================== This board does not use CONFIG_DM_VIDEO Please update the board to use CONFIG_DM_VIDEO before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/migration.rst for more info.
====================================================
Convert the legacy video driver over to the DM_VIDEO framework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).
Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
---
Hi,
I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
Andre
Changelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP from Kconfig
- fix memory node size calculation in simplefb setup
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)
arch/arm/mach-sunxi/Kconfig +5 -4
@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEO + select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video for - info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the HDMI, + LCD or VGA output found on older sunxi devices. This will also provide + a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"
drivers/video/sunxi/sunxi_display.c +152 -110
575 lines not on this page · raw message
include/configs/sunxi-common.h +0 -17
@@ -256,23 +256,6 @@ extern int soft_i2c_gpio_scl;#endif #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */ -#ifdef CONFIG_VIDEO_SUNXI -/* -* The amount of RAM to keep free at the top of RAM when relocating u-boot, -* to use as framebuffer. This must be a multiple of 4096. -*/ -#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20) - -#define CONFIG_VIDEO_LOGO -#define CONFIG_VIDEO_STD_TIMINGS -#define CONFIG_I2C_EDID -#define VIDEO_LINE_LEN (pGD->plnSizeX) - -/* allow both serial and cfb console. */ -/* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ - -#endif /* CONFIG_VIDEO_SUNXI */ -/* Ethernet support */ #ifdef CONFIG_USB_EHCI_HCD
scripts/config_whitelist.txt +0 -1
@@ -1661,7 +1661,6 @@ CONFIG_STV0991 CONFIG_STV0991_HZ CONFIG_STV0991_HZ_CLOCK CONFIG_ST_SMI -CONFIG_SUNXI_MAX_FB_SIZE CONFIG_SXNI855T CONFIG_SYSFLAGS_ADDR CONFIG_SYSFS
Signature · 1 line
2.17.5
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Quoted 16 lines · Andre Przywara
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).
Quoted 5 lines
Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>
Thanks!
Maxime
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
In reply to Andre PrzywaraDne petek, 05. februar 2021 ob 02:07:48 CET je Andre Przywara napisal(a):
Quoted 49 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setuparch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)arch/arm/mach-sunxi/Kconfig +0
-0@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 824
Quoted 10 lines
arch/arm/mach-sunxi/Kconfig +2
-3depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEO + select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video
for
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 824
Quoted 2 lines
arch/arm/mach-sunxi/Kconfig +1
-1- info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the
HDMI,
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 825
Quoted 1 line
arch/arm/mach-sunxi/Kconfig +1
-0+ LCD or VGA output found on older sunxi devices. This will also
provide
Quoted 4 lines
arch/arm/mach-sunxi/Kconfig +1
-0+ a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"
<snip>
Quoted 18 lines
include/configs/sunxi-common.h +0
-10@@ -256,23 +256,6 @@ extern int soft_i2c_gpio_scl;#endif #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */ -#ifdef CONFIG_VIDEO_SUNXI -/* -* The amount of RAM to keep free at the top of RAM when relocating u-boot, -* to use as framebuffer. This must be a multiple of 4096. -*/ -#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20) - -#define CONFIG_VIDEO_LOGO -#define CONFIG_VIDEO_STD_TIMINGS -#define CONFIG_I2C_EDID
include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 261
Quoted 10 lines
include/configs/sunxi-common.h +0
-7-#define VIDEO_LINE_LEN (pGD->plnSizeX) - -/* allow both serial and cfb console. */ -/* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ - -#endif /* CONFIG_VIDEO_SUNXI */ -/* Ethernet support */ #ifdef CONFIG_USB_EHCI_HCD
This file has another ifdef which can be removed (#ifdef CONFIG_VIDEO).
After that,
Best regards,
Jernej
Quoted 16 lines
scripts/config_whitelist.txt +0
-1@@ -1661,7 +1661,6 @@ CONFIG_STV0991 CONFIG_STV0991_HZ CONFIG_STV0991_HZ_CLOCK CONFIG_ST_SMI -CONFIG_SUNXI_MAX_FB_SIZE CONFIG_SXNI855T CONFIG_SYSFLAGS_ADDR CONFIG_SYSFSSignature · 1 line
2.17.5
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Quoted 100 lines · On Fri, 05 Feb 2021 17:27:25 +0100 Jernej ?krabec <[email protected]>…
Dne petek, 05. februar 2021 ob 02:07:48 CET je Andre Przywara napisal(a):
Quoted 49 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setuparch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)arch/arm/mach-sunxi/Kconfig +0
-0@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9Iarch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 824
Quoted 10 lines
arch/arm/mach-sunxi/Kconfig +2
-3depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEO + select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.videofor
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 824
Quoted 2 lines
arch/arm/mach-sunxi/Kconfig +1
-1- info on how to select the video output and mode. + Say Y here to add support for using a graphical console on theHDMI,
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 825
Quoted 1 line
arch/arm/mach-sunxi/Kconfig +1
-0+ LCD or VGA output found on older sunxi devices. This will alsoprovide
Quoted 4 lines
arch/arm/mach-sunxi/Kconfig +1
-0+ a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"<snip>
Quoted 27 lines
include/configs/sunxi-common.h +0
-17@@ -256,23 +256,6 @@ extern int soft_i2c_gpio_scl;#endif #endif /* ifdef CONFIG_REQUIRE_SERIAL_CONSOLE */ -#ifdef CONFIG_VIDEO_SUNXI -/* -* The amount of RAM to keep free at the top of RAM when relocating u-boot, -* to use as framebuffer. This must be a multiple of 4096. -*/ -#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20) - -#define CONFIG_VIDEO_LOGO -#define CONFIG_VIDEO_STD_TIMINGS -#define CONFIG_I2C_EDID -#define VIDEO_LINE_LEN (pGD->plnSizeX) - -/* allow both serial and cfb console. */ -/* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ - -#endif /* CONFIG_VIDEO_SUNXI */ -/* Ethernet support */
Quoted 3 lines
include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 261
Quoted 1 line
include/configs/sunxi-common.h +0
-0#ifdef CONFIG_USB_EHCI_HCD This file has another ifdef which can be removed (#ifdef
CONFIG_VIDEO).
Ah, indeed, thanks for pointing this out.
I think they are even more cleanups lurking in the shadows ;-)
Quoted 2 lines
After that,
Reviewed-by Jernej Skrabec <[email protected]>
Thanks!
Andre
Quoted 22 lines
Best regards,
JernejQuoted 16 lines
scripts/config_whitelist.txt +0
-1@@ -1661,7 +1661,6 @@ CONFIG_STV0991 CONFIG_STV0991_HZ CONFIG_STV0991_HZ_CLOCK CONFIG_ST_SMI -CONFIG_SUNXI_MAX_FB_SIZE CONFIG_SXNI855T CONFIG_SYSFLAGS_ADDR CONFIG_SYSFSSignature · 1 line
2.17.5
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
In reply to Andre PrzywaraHi Andre,
Quoted 38 lines · Andre Przywara
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setup
Quoted 6 lines
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)
Some thoughts below
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 819
Quoted 10 lines
arch/arm/mach-sunxi/Kconfig +1
-1@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEO
I wonder whether instead VIDEO_SUNXI should depend on DM_VIDEO ?
Quoted 27 lines
arch/arm/mach-sunxi/Kconfig +4
-3+ select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video for - info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the HDMI, + LCD or VGA output found on older sunxi devices. This will also provide + a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"drivers/video/sunxi/sunxi_display.c +2
-0@@ -7,6 +7,8 @@*/ #include <common.h> +#include <display.h> +#include <dm.h> #include <cpu_func.h> #include <efi_loader.h> #include <init.h>
drivers/video/sunxi/sunxi_display.c line 35
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +2
-0@@ -28,7 +30,9 @@#include <fdt_support.h> #include <i2c.h> #include <malloc.h> +#include <video.h> #include <video_fb.h> +#include <dm/uclass-internal.h>
Do you need that? Internal things should be avoided if posssible.
Quoted 16 lines
drivers/video/sunxi/sunxi_display.c +5
-0#include "../videomodes.h" #include "../anx9804.h" #include "../hitachi_tx18d42vm_lcd.h" @@ -45,6 +49,11 @@DECLARE_GLOBAL_DATA_PTR ; +/* Maximum LCD size we support */ +#define LCD_MAX_WIDTH 3840 +#define LCD_MAX_HEIGHT 2160 +#define LCD_MAX_LOG2_BPP VIDEO_BPP32 +enum sunxi_monitor { sunxi_monitor_none, sunxi_monitor_dvi,
drivers/video/sunxi/sunxi_display.c enum sunxi_monitor { · line 74
Quoted 8 lines
drivers/video/sunxi/sunxi_display.c +0
-1@@ -59,12 +68,11 @@ enum sunxi_monitor {#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_ncstruct sunxi_display { -GraphicDevice graphic_device;enum sunxi_monitor monitor;unsigned int depth;unsigned int fb_addr;unsigned int fb_size;
These last three are repeated from the uclass info. But fb_addr seems to sometimes be different from the ucass frame buffer, in which case I wonder how output actually works.
If you do actually need these, can you please document them here?
Quoted 5 lines
drivers/video/sunxi/sunxi_display.c +1
-1-} sunxi_display; +};const struct ctfb_res_modes composite_video_modes[2 ] = {/* x y hz pixclk ps/kHz le ri up lo hs vs s vmode */
[..]
Quoted 9 lines
drivers/video/sunxi/sunxi_display.c +3
-1-static void sunxi_mode_set (const struct ctfb_res_modes *mode, +static void sunxi_mode_set (struct sunxi_display *sunxi_display, +const struct ctfb_res_modes *mode,unsigned int address) { +enum sunxi_monitor monitor = sunxi_display->monitor;int __maybe_unused clk_div, clk_double;struct sunxi_lcdc_reg *const lcdc = (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;
drivers/video/sunxi/sunxi_display.c static void sunxi_engines_init(void) · line 928
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +1
-1struct sunxi_tve_reg *__maybe_unused const tve = (struct sunxi_tve_reg *)SUNXI_TVE0_BASE ; -switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none:break ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:#ifdef CONFIG_VIDEO_HDMI
I wonder if all of these can use IS_ENABLED()?
Quoted 12 lines
drivers/video/sunxi/sunxi_display.c +4
-4-sunxi_composer_mode_set (mode, address); -sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 ); -sunxi_hdmi_mode_set (mode, clk_div, clk_double); +sunxi_composer_mode_set (mode, address, monitor); +sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 , monitor); +sunxi_hdmi_mode_set (mode, clk_div, clk_double, monitor);sunxi_composer_enable (); -lcdc_enable (lcdc, sunxi_display.depth); +lcdc_enable (lcdc, sunxi_display->depth);sunxi_hdmi_enable ();#endif break ;
[..]
drivers/video/sunxi/sunxi_display.c static enum sunxi_monitor sunxi_get_default_mon(bool allow_hdmi) · line 1065
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +1
-1-void *video_hw_init (void ) +static int sunxi_de_probe (struct udevice *dev)
This function is way too long and would benefit from splitting into several parts IMO.
Quoted 178 lines
{
drivers/video/sunxi/sunxi_display.c +36
-44-static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +struct video_priv *uc_priv =dev_get_uclass_priv (dev); +struct video_uc_plat *plat =dev_get_uclass_plat (dev); +struct sunxi_display *sunxi_display =dev_get_priv (dev);const struct ctfb_res_modes *mode;struct ctfb_res_modes custom;const char *options;@@ -1067,10 +1079,8 @@ void *video_hw_init(void)char mon[16 ];char *lcd_mode =CONFIG_VIDEO_LCD_MODE ; -memset (&sunxi_display,0 ,sizeof (struct sunxi_display )); -video_get_ctfb_res_modes (RES_MODE_1024x768,24 , &mode, - &sunxi_display.depth, &options); + &sunxi_display->depth, &options);#ifdef CONFIG_VIDEO_HDMI hpd =video_get_option_int (options,"hpd" ,1 ); hpd_delay =video_get_option_int (options,"hpd_delay" ,500 );@@ -1078,35 +1088,35 @@ void *video_hw_init(void)#endif overscan_x =video_get_option_int (options,"overscan_x" ,-1 ); overscan_y =video_get_option_int (options,"overscan_y" ,-1 ); - sunxi_display.monitor =sunxi_get_default_mon (true); + sunxi_display->monitor =sunxi_get_default_mon (true);video_get_option_string (options,"monitor" , mon,sizeof (mon), -sunxi_get_mon_desc (sunxi_display.monitor)); +sunxi_get_mon_desc (sunxi_display->monitor));for (i =0 ; i <=SUNXI_MONITOR_LAST ; i++) {if (strcmp (mon,sunxi_get_mon_desc (i)) ==0 ) { - sunxi_display.monitor = i; + sunxi_display->monitor = i;break ; } }if (i >SUNXI_MONITOR_LAST )printf ("Unknown monitor: '%s', falling back to '%s'\n" , - mon,sunxi_get_mon_desc (sunxi_display.monitor)); + mon,sunxi_get_mon_desc (sunxi_display->monitor));#ifdef CONFIG_VIDEO_HDMI /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */ -if (sunxi_display.monitor == sunxi_monitor_dvi || - sunxi_display.monitor == sunxi_monitor_hdmi) { +if (sunxi_display->monitor == sunxi_monitor_dvi || + sunxi_display->monitor == sunxi_monitor_hdmi) {/* Always call hdp_detect, as it also enables clocks, etc. */ hdmi_present = (sunxi_hdmi_hpd_detect (hpd_delay) ==1 );if (hdmi_present && edid) {printf ("HDMI connected: " ); -if (sunxi_hdmi_edid_get_mode (&custom, true) ==0 ) +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, true) ==0 ) mode = &custom;else hdmi_present = false; }/* Fall back to EDID in case HPD failed */ if (edid && !hdmi_present) { -if (sunxi_hdmi_edid_get_mode (&custom, false) ==0 ) { +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, false) ==0 ) { mode = &custom; hdmi_present = true; }@@ -1114,38 +1124,39 @@ void *video_hw_init(void)/* Shut down when display was not found */ if ((hpd || edid) && !hdmi_present) {sunxi_hdmi_shutdown (); - sunxi_display.monitor =sunxi_get_default_mon (false); + sunxi_display->monitor =sunxi_get_default_mon (false); }/* else continue with hdmi/dvi without a cable connected */ }#endif -switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none: -return NULL ; +printf ("Unknown monitor\n" ); +return -EINVAL ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:if (!sunxi_has_hdmi ()) {printf ("HDMI/DVI not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; }break ;case sunxi_monitor_lcd:if (!sunxi_has_lcd ()) {printf ("LCD not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =video_get_params (&custom, lcd_mode); + sunxi_display->depth =video_get_params (&custom, lcd_mode); mode = &custom;break ;case sunxi_monitor_vga:if (!sunxi_has_vga ()) {printf ("VGA not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =18 ; + sunxi_display->depth =18 ;break ;case sunxi_monitor_composite_pal:case sunxi_monitor_composite_ntsc:@@ -1153,85 +1164,103 @@ void *video_hw_init(void)case sunxi_monitor_composite_pal_nc:if (!sunxi_has_composite ()) {printf ("Composite video not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } -if (sunxi_display.monitor == sunxi_monitor_composite_pal || - sunxi_display.monitor == sunxi_monitor_composite_pal_nc) +if (sunxi_display->monitor == sunxi_monitor_composite_pal || + sunxi_display->monitor == sunxi_monitor_composite_pal_nc) mode = &composite_video_modes[0 ];else mode = &composite_video_modes[1 ]; - sunxi_display.depth =24 ; + sunxi_display->depth =24 ;break ; }/* Yes these defaults are quite high, overscan on composite sucks... */ if (overscan_x ==-1 ) - overscan_x =sunxi_is_composite () ?32 :0 ; + overscan_x =sunxi_is_composite (sunxi_display->monitor) ?32 :0 ;if (overscan_y ==-1 ) - overscan_y =sunxi_is_composite () ?20 :0 ; + overscan_y =sunxi_is_composite (sunxi_display->monitor) ?20 :0 ; - sunxi_display.fb_size = - (mode->xres * mode->yres *4 +0xfff ) & ~0xfff ; + sunxi_display->fb_size = plat->size; overscan_offset = (overscan_y * mode->xres + overscan_x) *4 ;/* We want to keep the fb_base for simplefb page aligned, where as * the sunxi dma engines will happily accept an unaligned address. */ if (overscan_offset) - sunxi_display.fb_size +=0x1000 ; - -if (sunxi_display.fb_size >CONFIG_SUNXI_MAX_FB_SIZE ) { -printf ("Error need %dkB for fb, but only %dkB is reserved\n" , - sunxi_display.fb_size >>10 , -CONFIG_SUNXI_MAX_FB_SIZE >>10 ); -return NULL ; - } + sunxi_display->fb_size +=0x1000 ;printf ("Setting up a %dx%d%s %s console (overscan %dx%d)\n" , mode->xres, mode->yres, (mode->vmode ==FB_VMODE_INTERLACED ) ?"i" :"" , -sunxi_get_mon_desc (sunxi_display.monitor), +sunxi_get_mon_desc (sunxi_display->monitor), overscan_x, overscan_y); - gd->fb_base = gd->bd->bi_dram[0 ].start + - gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + sunxi_display->fb_addr = plat->base;sunxi_engines_init ();#ifdef CONFIG_EFI_LOADER -efi_add_memory_map (gd->fb_base, sunxi_display.fb_size, +efi_add_memory_map (sunxi_display->fb_addr, sunxi_display->fb_size,EFI_RESERVED_MEMORY_TYPE );#endif
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1209
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +2
-5- fb_dma_addr = gd->fb_base -CONFIG_SYS_SDRAM_BASE ; - sunxi_display.fb_addr = gd->fb_base; + fb_dma_addr = sunxi_display->fb_addr -CONFIG_SYS_SDRAM_BASE ;if (overscan_offset) { fb_dma_addr +=0x1000 - (overscan_offset &0xfff ); - sunxi_display.fb_addr += (overscan_offset +0xfff ) & ~0xfff ; -memset ((void *)gd->fb_base,0 , sunxi_display.fb_size); -flush_cache (gd->fb_base, sunxi_display.fb_size); + sunxi_display->fb_addr += (overscan_offset +0xfff ) & ~0xfff ;
ALIGN(overscan_offset, 0x100) ?
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1211
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +2
-0+memset ((void *)sunxi_display->fb_addr,0 , sunxi_display->fb_size); +flush_cache (sunxi_display->fb_addr, sunxi_display->fb_size);
Driver model clears the frame buffer. Is this needed?
Quoted 11 lines
drivers/video/sunxi/sunxi_display.c +1
-4} -sunxi_mode_set (mode, fb_dma_addr); +sunxi_mode_set (sunxi_display, mode, fb_dma_addr);/* * These are the only members of this structure that are used. All the * others are driver specific. The pitch is stored in plnSizeX. */ - graphic_device->frameAdrs = sunxi_display.fb_addr; - graphic_device->gdfIndex =GDF_32BIT_X888RGB ; - graphic_device->gdfBytesPP =4 ;
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1223
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +5
-5- graphic_device->winSizeX = mode->xres -2 * overscan_x; - graphic_device->winSizeY = mode->yres -2 * overscan_y; - graphic_device->plnSizeX = mode->xres * graphic_device->gdfBytesPP; - -return graphic_device; + uc_priv->bpix =VIDEO_BPP32 ; + uc_priv->xsize = mode->xres; + uc_priv->ysize = mode->yres; + +video_set_flush_dcache (dev,1 );
true
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1233
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +8
-0+ +return 0 ; } +static int sunxi_de_bind (struct udevice *dev) +{ +struct video_uc_plat *plat =dev_get_uclass_plat (dev); + + plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<LCD_MAX_LOG2_BPP ) /8 ;
Should use enum video_log2_bpp here. Also see VNBYTES().
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +4
-0+ +return 0 ; +} +
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1247
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +10
-0+static const struct video_ops sunxi_de_ops = { +}; + +U_BOOT_DRIVER (sunxi_de) = { + .name ="sunxi_de" , + .id =UCLASS_VIDEO , + .ops = &sunxi_de_ops, + .bind = sunxi_de_bind, + .probe = sunxi_de_probe, + .priv_auto =sizeof (struct sunxi_display ),
Should ideally have an _priv suffix
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1254
Quoted 7 lines
drivers/video/sunxi/sunxi_display.c +7
-0+ .flags = DM_FLAG_PRE_RELOC, +}; + +U_BOOT_DRVINFO (sunxi_de) = { + .name ="sunxi_de" +}; +
[..]
Regards,
Simon
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:
Hi Simon,
Quoted 46 lines · Andre Przywara
Quoted 38 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setupQuoted 6 lines
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Some thoughts below
Many thanks for having a thorough look, much appreciated.
I will have a closer look at your comments which I didn't reply to below.
For the other points:
To be honest, I haven't checked every line in this patch, my goal was merely to get it merged (this time), to prevent feature removal and drop the nasty buildman warnings.
I see quite some cleanup potential here (some I already mentioned in the commit message above), but wanted to get the main DM_VIDEO conversion done first (as I think last time some discussion already prevented a merge).
So my plan was to queue this for next ASAP, then send more cleanup patches on top, before the next merge window. I understand that it's typically done the other way around, but given this is dragging on for a while, is long overdue and works for me (TM) as it is, I would prefer a functional patch first, with cleanups on top.
Quoted 13 lines
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 819
Quoted 11 lines
arch/arm/mach-sunxi/Kconfig +1
-1@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEOI wonder whether instead
VIDEO_SUNXIshould depend onDM_VIDEO?
So I was always wondering about the logic behind that.
My understanding would be: This driver is (now) implementing the DM_VIDEO interface. Any user (at board or SoC level) would just be selecting this driver, without caring about which driver interface it uses.
So as this driver is (now) DM_VIDEO only, it would signal this via this select line.
If that is not how it's meant to be, can you explain the the idea behind this, please?
Also: with CONFIG_VIDEO now dying, CONFIG_DM_VIDEO somewhat loses its purpose, doesn't it?
Quoted 88 lines
Quoted 28 lines
arch/arm/mach-sunxi/Kconfig +4
-3+ select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video for - info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the HDMI, + LCD or VGA output found on older sunxi devices. This will also provide + a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"drivers/video/sunxi/sunxi_display.c +2
-0@@ -7,6 +7,8 @@*/ #include <common.h> +#include <display.h> +#include <dm.h> #include <cpu_func.h> #include <efi_loader.h> #include <init.h> drivers/video/sunxi/sunxi_display.c line 35
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +2
-0@@ -28,7 +30,9 @@#include <fdt_support.h> #include <i2c.h> #include <malloc.h> +#include <video.h> #include <video_fb.h> +#include <dm/uclass-internal.h> Do you need that? Internal things should be avoided if posssible.
Quoted 16 lines
drivers/video/sunxi/sunxi_display.c +5
-0#include "../videomodes.h" #include "../anx9804.h" #include "../hitachi_tx18d42vm_lcd.h" @@ -45,6 +49,11 @@DECLARE_GLOBAL_DATA_PTR ; +/* Maximum LCD size we support */ +#define LCD_MAX_WIDTH 3840 +#define LCD_MAX_HEIGHT 2160 +#define LCD_MAX_LOG2_BPP VIDEO_BPP32 +enum sunxi_monitor { sunxi_monitor_none, sunxi_monitor_dvi,drivers/video/sunxi/sunxi_display.c enum sunxi_monitor { · line 74
Quoted 8 lines
drivers/video/sunxi/sunxi_display.c +0
-1@@ -59,12 +68,11 @@ enum sunxi_monitor {#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_ncstruct sunxi_display { -GraphicDevice graphic_device;enum sunxi_monitor monitor;unsigned int depth;unsigned int fb_addr;unsigned int fb_size;These last three are repeated from the uclass info. But
fb_addrseems to sometimes be different from the ucass frame buffer, in which case I wonder how output actually works.If you do actually need these, can you please document them here?
Quoted 5 lines
drivers/video/sunxi/sunxi_display.c +1
-1-} sunxi_display; +};const struct ctfb_res_modes composite_video_modes[2 ] = {/* x y hz pixclk ps/kHz le ri up lo hs vs s vmode */ [..]
Quoted 12 lines
drivers/video/sunxi/sunxi_display.c +3
-1-static void sunxi_mode_set (const struct ctfb_res_modes *mode, +static void sunxi_mode_set (struct sunxi_display *sunxi_display, +const struct ctfb_res_modes *mode,unsigned int address) { +enum sunxi_monitor monitor = sunxi_display->monitor;int __maybe_unused clk_div, clk_double;struct sunxi_lcdc_reg *const lcdc = (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;struct sunxi_tve_reg *__maybe_unused const tve = (struct sunxi_tve_reg *)SUNXI_TVE0_BASE ;
Quoted 9 lines
drivers/video/sunxi/sunxi_display.c static void sunxi_engines_init(void) · line 928
Quoted 7 lines
drivers/video/sunxi/sunxi_display.c +1
-1-switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none:break ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:#ifdef CONFIG_VIDEO_HDMI I wonder if all of these can use
IS_ENABLED()?
Yes, in fact I have patches to replace all #ifdefs with IS_ENABLED(), except the sun6i reset gate ones (which would break compilation on non-sun6i). And those should be tackled by proper UCLASS_CLK usage. But I wanted to get this basic conversion out first, see above.
The rest of your comments make sense on the first glance, I will try to fix the easy things for a v4.
Cheers,
Andre
Quoted 284 lines
Quoted 12 lines
drivers/video/sunxi/sunxi_display.c +4
-4-sunxi_composer_mode_set (mode, address); -sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 ); -sunxi_hdmi_mode_set (mode, clk_div, clk_double); +sunxi_composer_mode_set (mode, address, monitor); +sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 , monitor); +sunxi_hdmi_mode_set (mode, clk_div, clk_double, monitor);sunxi_composer_enable (); -lcdc_enable (lcdc, sunxi_display.depth); +lcdc_enable (lcdc, sunxi_display->depth);sunxi_hdmi_enable ();#endif break ;[..]
drivers/video/sunxi/sunxi_display.c static enum sunxi_monitor sunxi_get_default_mon(bool allow_hdmi) · line 1065
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +1
-1-void *video_hw_init (void ) +static int sunxi_de_probe (struct udevice *dev)This function is way too long and would benefit from splitting into several parts IMO.
Quoted 178 lines
{
drivers/video/sunxi/sunxi_display.c +36
-44-static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +struct video_priv *uc_priv =dev_get_uclass_priv (dev); +struct video_uc_plat *plat =dev_get_uclass_plat (dev); +struct sunxi_display *sunxi_display =dev_get_priv (dev);const struct ctfb_res_modes *mode;struct ctfb_res_modes custom;const char *options;@@ -1067,10 +1079,8 @@ void *video_hw_init(void)char mon[16 ];char *lcd_mode =CONFIG_VIDEO_LCD_MODE ; -memset (&sunxi_display,0 ,sizeof (struct sunxi_display )); -video_get_ctfb_res_modes (RES_MODE_1024x768,24 , &mode, - &sunxi_display.depth, &options); + &sunxi_display->depth, &options);#ifdef CONFIG_VIDEO_HDMI hpd =video_get_option_int (options,"hpd" ,1 ); hpd_delay =video_get_option_int (options,"hpd_delay" ,500 );@@ -1078,35 +1088,35 @@ void *video_hw_init(void)#endif overscan_x =video_get_option_int (options,"overscan_x" ,-1 ); overscan_y =video_get_option_int (options,"overscan_y" ,-1 ); - sunxi_display.monitor =sunxi_get_default_mon (true); + sunxi_display->monitor =sunxi_get_default_mon (true);video_get_option_string (options,"monitor" , mon,sizeof (mon), -sunxi_get_mon_desc (sunxi_display.monitor)); +sunxi_get_mon_desc (sunxi_display->monitor));for (i =0 ; i <=SUNXI_MONITOR_LAST ; i++) {if (strcmp (mon,sunxi_get_mon_desc (i)) ==0 ) { - sunxi_display.monitor = i; + sunxi_display->monitor = i;break ; } }if (i >SUNXI_MONITOR_LAST )printf ("Unknown monitor: '%s', falling back to '%s'\n" , - mon,sunxi_get_mon_desc (sunxi_display.monitor)); + mon,sunxi_get_mon_desc (sunxi_display->monitor));#ifdef CONFIG_VIDEO_HDMI /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */ -if (sunxi_display.monitor == sunxi_monitor_dvi || - sunxi_display.monitor == sunxi_monitor_hdmi) { +if (sunxi_display->monitor == sunxi_monitor_dvi || + sunxi_display->monitor == sunxi_monitor_hdmi) {/* Always call hdp_detect, as it also enables clocks, etc. */ hdmi_present = (sunxi_hdmi_hpd_detect (hpd_delay) ==1 );if (hdmi_present && edid) {printf ("HDMI connected: " ); -if (sunxi_hdmi_edid_get_mode (&custom, true) ==0 ) +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, true) ==0 ) mode = &custom;else hdmi_present = false; }/* Fall back to EDID in case HPD failed */ if (edid && !hdmi_present) { -if (sunxi_hdmi_edid_get_mode (&custom, false) ==0 ) { +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, false) ==0 ) { mode = &custom; hdmi_present = true; }@@ -1114,38 +1124,39 @@ void *video_hw_init(void)/* Shut down when display was not found */ if ((hpd || edid) && !hdmi_present) {sunxi_hdmi_shutdown (); - sunxi_display.monitor =sunxi_get_default_mon (false); + sunxi_display->monitor =sunxi_get_default_mon (false); }/* else continue with hdmi/dvi without a cable connected */ }#endif -switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none: -return NULL ; +printf ("Unknown monitor\n" ); +return -EINVAL ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:if (!sunxi_has_hdmi ()) {printf ("HDMI/DVI not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; }break ;case sunxi_monitor_lcd:if (!sunxi_has_lcd ()) {printf ("LCD not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =video_get_params (&custom, lcd_mode); + sunxi_display->depth =video_get_params (&custom, lcd_mode); mode = &custom;break ;case sunxi_monitor_vga:if (!sunxi_has_vga ()) {printf ("VGA not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =18 ; + sunxi_display->depth =18 ;break ;case sunxi_monitor_composite_pal:case sunxi_monitor_composite_ntsc:@@ -1153,85 +1164,103 @@ void *video_hw_init(void)case sunxi_monitor_composite_pal_nc:if (!sunxi_has_composite ()) {printf ("Composite video not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } -if (sunxi_display.monitor == sunxi_monitor_composite_pal || - sunxi_display.monitor == sunxi_monitor_composite_pal_nc) +if (sunxi_display->monitor == sunxi_monitor_composite_pal || + sunxi_display->monitor == sunxi_monitor_composite_pal_nc) mode = &composite_video_modes[0 ];else mode = &composite_video_modes[1 ]; - sunxi_display.depth =24 ; + sunxi_display->depth =24 ;break ; }/* Yes these defaults are quite high, overscan on composite sucks... */ if (overscan_x ==-1 ) - overscan_x =sunxi_is_composite () ?32 :0 ; + overscan_x =sunxi_is_composite (sunxi_display->monitor) ?32 :0 ;if (overscan_y ==-1 ) - overscan_y =sunxi_is_composite () ?20 :0 ; + overscan_y =sunxi_is_composite (sunxi_display->monitor) ?20 :0 ; - sunxi_display.fb_size = - (mode->xres * mode->yres *4 +0xfff ) & ~0xfff ; + sunxi_display->fb_size = plat->size; overscan_offset = (overscan_y * mode->xres + overscan_x) *4 ;/* We want to keep the fb_base for simplefb page aligned, where as * the sunxi dma engines will happily accept an unaligned address. */ if (overscan_offset) - sunxi_display.fb_size +=0x1000 ; - -if (sunxi_display.fb_size >CONFIG_SUNXI_MAX_FB_SIZE ) { -printf ("Error need %dkB for fb, but only %dkB is reserved\n" , - sunxi_display.fb_size >>10 , -CONFIG_SUNXI_MAX_FB_SIZE >>10 ); -return NULL ; - } + sunxi_display->fb_size +=0x1000 ;printf ("Setting up a %dx%d%s %s console (overscan %dx%d)\n" , mode->xres, mode->yres, (mode->vmode ==FB_VMODE_INTERLACED ) ?"i" :"" , -sunxi_get_mon_desc (sunxi_display.monitor), +sunxi_get_mon_desc (sunxi_display->monitor), overscan_x, overscan_y); - gd->fb_base = gd->bd->bi_dram[0 ].start + - gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + sunxi_display->fb_addr = plat->base;sunxi_engines_init ();#ifdef CONFIG_EFI_LOADER -efi_add_memory_map (gd->fb_base, sunxi_display.fb_size, +efi_add_memory_map (sunxi_display->fb_addr, sunxi_display->fb_size,EFI_RESERVED_MEMORY_TYPE );#endif drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1209
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +2
-5- fb_dma_addr = gd->fb_base -CONFIG_SYS_SDRAM_BASE ; - sunxi_display.fb_addr = gd->fb_base; + fb_dma_addr = sunxi_display->fb_addr -CONFIG_SYS_SDRAM_BASE ;if (overscan_offset) { fb_dma_addr +=0x1000 - (overscan_offset &0xfff ); - sunxi_display.fb_addr += (overscan_offset +0xfff ) & ~0xfff ; -memset ((void *)gd->fb_base,0 , sunxi_display.fb_size); -flush_cache (gd->fb_base, sunxi_display.fb_size); + sunxi_display->fb_addr += (overscan_offset +0xfff ) & ~0xfff ;
ALIGN(overscan_offset, 0x100)?drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1211
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +2
-0+memset ((void *)sunxi_display->fb_addr,0 , sunxi_display->fb_size); +flush_cache (sunxi_display->fb_addr, sunxi_display->fb_size);Driver model clears the frame buffer. Is this needed?
Quoted 11 lines
drivers/video/sunxi/sunxi_display.c +1
-4} -sunxi_mode_set (mode, fb_dma_addr); +sunxi_mode_set (sunxi_display, mode, fb_dma_addr);/* * These are the only members of this structure that are used. All the * others are driver specific. The pitch is stored in plnSizeX. */ - graphic_device->frameAdrs = sunxi_display.fb_addr; - graphic_device->gdfIndex =GDF_32BIT_X888RGB ; - graphic_device->gdfBytesPP =4 ;drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1223
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +5
-5- graphic_device->winSizeX = mode->xres -2 * overscan_x; - graphic_device->winSizeY = mode->yres -2 * overscan_y; - graphic_device->plnSizeX = mode->xres * graphic_device->gdfBytesPP; - -return graphic_device; + uc_priv->bpix =VIDEO_BPP32 ; + uc_priv->xsize = mode->xres; + uc_priv->ysize = mode->yres; + +video_set_flush_dcache (dev,1 );true
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1233
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +8
-0+ +return 0 ; } +static int sunxi_de_bind (struct udevice *dev) +{ +struct video_uc_plat *plat =dev_get_uclass_plat (dev); + + plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<LCD_MAX_LOG2_BPP ) /8 ;Should use enum
video_log2_bpphere. Also seeVNBYTES().Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +4
-0+ +return 0 ; +} +drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1247
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +10
-0+static const struct video_ops sunxi_de_ops = { +}; + +U_BOOT_DRIVER (sunxi_de) = { + .name ="sunxi_de" , + .id =UCLASS_VIDEO , + .ops = &sunxi_de_ops, + .bind = sunxi_de_bind, + .probe = sunxi_de_probe, + .priv_auto =sizeof (struct sunxi_display ),Should ideally have an
_privsuffixdrivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1254
Quoted 7 lines
drivers/video/sunxi/sunxi_display.c +7
-0+ .flags = DM_FLAG_PRE_RELOC, +}; + +U_BOOT_DRVINFO (sunxi_de) = { + .name ="sunxi_de" +}; +[..]
Regards,
Simon
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Hi Andre,
Quoted 61 lines · Andre Przywara
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:Hi Simon,
Quoted 46 lines · Andre Przywara
Quoted 38 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setupQuoted 6 lines
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Some thoughts below
Many thanks for having a thorough look, much appreciated.
I will have a closer look at your comments which I didn't reply to below.
Quoted 13 lines
For the other points:
To be honest, I haven't checked every line in this patch, my goal was merely to get it merged (this time), to prevent feature removal and drop the nasty buildman warnings.
I see quite some cleanup potential here (some I already mentioned in the commit message above), but wanted to get the mainDM_VIDEOconversion done first (as I think last time some discussion already prevented a merge).
So my plan was to queue this for next ASAP, then send more cleanup patches on top, before the next merge window. I understand that it's typically done the other way around, but given this is dragging on for a while, is long overdue and works for me (TM) as it is, I would prefer a functional patch first, with cleanups on top.
That's fine...you have my review tag. My comments are just suggestions for improvement and much of it relates to the existing code.
Quoted 23 lines
Quoted 14 lines
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 819
Quoted 12 lines
arch/arm/mach-sunxi/Kconfig +1
-1@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEOI wonder whether instead
VIDEO_SUNXIshould depend onDM_VIDEO?So I was always wondering about the logic behind that.
My understanding would be: This driver is (now) implementing theDM_VIDEOinterface. Any user (at board or SoC level) would just be selecting this driver, without caring about which driver interface it uses.
So as this driver is (now)DM_VIDEOonly, it would signal this via this select line.
Quoted 2 lines
If that is not how it's meant to be, can you explain the the idea behind this, please?
That sounds fine to me, but what happens when someone selects a DM and non-DM driver? That has always been the intent - to ensure that people are selecting DM for a subsystem on purpose.
Of course these days most stuff is DM, so perhaps that approach is obsolete and we should do what you say. I'm OK with that.
Quoted 3 lines
Also: with
CONFIG_VIDEOnow dying,CONFIG_DM_VIDEOsomewhat loses its purpose, doesn't it?
All of the CONFIG_DM... things should be removed at some point, yet. Just waiting for the mythical deadlines...
[...]
Regards,
Simon
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
In reply to Simon GlassOn Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:
Hi Simon,
coming back to this patch, answering to the other comments I skipped over the last time.
In general this patch is the shortest way to get to some kind of DM driver, in many ways it still looks like a non-DM driver on the inside, which shows.
Quoted 83 lines · Andre Przywara
Quoted 38 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setupQuoted 6 lines
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)Reviewed-by Simon Glass <[email protected]>Some thoughts below
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 819
Quoted 10 lines
arch/arm/mach-sunxi/Kconfig +1
-1@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEOI wonder whether instead
VIDEO_SUNXIshould depend onDM_VIDEO?Quoted 20 lines
arch/arm/mach-sunxi/Kconfig +4
-3+ select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video for - info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the HDMI, + LCD or VGA output found on older sunxi devices. This will also provide + a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"drivers/video/sunxi/sunxi_display.c +0
-0@@ -7,6 +7,8 @@*/
Quoted 15 lines
drivers/video/sunxi/sunxi_display.c line 35
Quoted 13 lines
drivers/video/sunxi/sunxi_display.c +4
-0#include <common.h> +#include <display.h> +#include <dm.h> #include <cpu_func.h> #include <efi_loader.h> #include <init.h> @@ -28,7 +30,9 @@#include <fdt_support.h> #include <i2c.h> #include <malloc.h> +#include <video.h> #include <video_fb.h> +#include <dm/uclass-internal.h> Do you need that? Internal things should be avoided if posssible.
That's a good point. This is needed for uclass_find_device_by_name() down in the simplefb setup function at the very end. This function will be called from a different context (from ft_board_setup() in board.c), and tries to find the (only) instance of this very driver to populate the simplefb DT node accordingly. This is the approach the sunxi_de2.c uses, and back at the time this was seemingly the best way to achieve this. Alternatives I see:
1) Keep a global static variable, pointing to the struct udevice, set in probe().
2) Use uclass_get_device_by_name() instead, but prevent the double probe by keeping an indication of the probe status.
3) Gather all data needed for the simplefb setup already in probe(), and store them in global variables, to be picked up by sunxi_simplefb_setup() later.
4) as 3), but store the extra data (just the pipeline name to find the right DT node to enable?) in generic uclass storage. This has the potential of making this function platform and board agnostic (so meson could benefit as well?). We could then setup the simplefb in common code.
Any ideas on this? Maybe something else entirely?
Quoted 6 lines
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +0
-0#include "../videomodes.h" #include "../anx9804.h" #include "../hitachi_tx18d42vm_lcd.h" @@ -45,6 +49,11 @@
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c line 55
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +4
-0DECLARE_GLOBAL_DATA_PTR ; +/* Maximum LCD size we support */ +#define LCD_MAX_WIDTH 3840 +#define LCD_MAX_HEIGHT 2160 +#define LCD_MAX_LOG2_BPP VIDEO_BPP32
So this resolution is not achievable with a maximum pixel clock of 165 MHz (not even at 24 Hz). Given that the framebuffer reservation is fixed, this wastes quite some memory. Realistically 165 MHz means 1920x1200 (at 60Hz), shall we use that one instead?
Quoted 18 lines
drivers/video/sunxi/sunxi_display.c enum sunxi_monitor { · line 74
Quoted 13 lines
drivers/video/sunxi/sunxi_display.c +1
-1+enum sunxi_monitor { sunxi_monitor_none, sunxi_monitor_dvi,@@ -59,12 +68,11 @@ enum sunxi_monitor {#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_ncstruct sunxi_display { -GraphicDevice graphic_device;enum sunxi_monitor monitor;unsigned int depth;unsigned int fb_addr;unsigned int fb_size;These last three are repeated from the uclass info. But
fb_addrseems to sometimes be different from the ucass frame buffer, in which case I wonder how output actually works.
Quoted 1 line
If you do actually need these, can you please document them here?
I think this might be mostly non-DM legacy, but for the composite overscan we tweak the framebuffer address. I haven't fully wrapped my mind around this, though, and ideally we can indeed lose those extra members.
I will try to find some device with composite input to test it.
Quoted 43 lines
Quoted 5 lines
drivers/video/sunxi/sunxi_display.c +1
-1-} sunxi_display; +};const struct ctfb_res_modes composite_video_modes[2 ] = {/* x y hz pixclk ps/kHz le ri up lo hs vs s vmode */ [..]
Quoted 9 lines
drivers/video/sunxi/sunxi_display.c +3
-1-static void sunxi_mode_set (const struct ctfb_res_modes *mode, +static void sunxi_mode_set (struct sunxi_display *sunxi_display, +const struct ctfb_res_modes *mode,unsigned int address) { +enum sunxi_monitor monitor = sunxi_display->monitor;int __maybe_unused clk_div, clk_double;struct sunxi_lcdc_reg *const lcdc = (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;drivers/video/sunxi/sunxi_display.c static void sunxi_engines_init(void) · line 928
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +1
-1struct sunxi_tve_reg *__maybe_unused const tve = (struct sunxi_tve_reg *)SUNXI_TVE0_BASE ; -switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none:break ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:#ifdef CONFIG_VIDEO_HDMI I wonder if all of these can use
IS_ENABLED()?drivers/video/sunxi/sunxi_display.c static void sunxi_engines_init(void) · line 936
Quoted 12 lines
drivers/video/sunxi/sunxi_display.c +4
-4-sunxi_composer_mode_set (mode, address); -sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 ); -sunxi_hdmi_mode_set (mode, clk_div, clk_double); +sunxi_composer_mode_set (mode, address, monitor); +sunxi_lcdc_tcon1_mode_set (mode, &clk_div, &clk_double,0 , monitor); +sunxi_hdmi_mode_set (mode, clk_div, clk_double, monitor);sunxi_composer_enable (); -lcdc_enable (lcdc, sunxi_display.depth); +lcdc_enable (lcdc, sunxi_display->depth);sunxi_hdmi_enable ();#endif break ;
Quoted 7 lines
[..]
drivers/video/sunxi/sunxi_display.c static enum sunxi_monitor sunxi_get_default_mon(bool allow_hdmi) · line 1065
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +1
-1-void *video_hw_init (void ) +static int sunxi_de_probe (struct udevice *dev)This function is way too long and would benefit from splitting into several parts IMO.
Yeah, indeed. I started working on this, but it probably won't be part of the next version already.
Quoted 191 lines
Quoted 178 lines
{
drivers/video/sunxi/sunxi_display.c +36
-44-static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +struct video_priv *uc_priv =dev_get_uclass_priv (dev); +struct video_uc_plat *plat =dev_get_uclass_plat (dev); +struct sunxi_display *sunxi_display =dev_get_priv (dev);const struct ctfb_res_modes *mode;struct ctfb_res_modes custom;const char *options;@@ -1067,10 +1079,8 @@ void *video_hw_init(void)char mon[16 ];char *lcd_mode =CONFIG_VIDEO_LCD_MODE ; -memset (&sunxi_display,0 ,sizeof (struct sunxi_display )); -video_get_ctfb_res_modes (RES_MODE_1024x768,24 , &mode, - &sunxi_display.depth, &options); + &sunxi_display->depth, &options);#ifdef CONFIG_VIDEO_HDMI hpd =video_get_option_int (options,"hpd" ,1 ); hpd_delay =video_get_option_int (options,"hpd_delay" ,500 );@@ -1078,35 +1088,35 @@ void *video_hw_init(void)#endif overscan_x =video_get_option_int (options,"overscan_x" ,-1 ); overscan_y =video_get_option_int (options,"overscan_y" ,-1 ); - sunxi_display.monitor =sunxi_get_default_mon (true); + sunxi_display->monitor =sunxi_get_default_mon (true);video_get_option_string (options,"monitor" , mon,sizeof (mon), -sunxi_get_mon_desc (sunxi_display.monitor)); +sunxi_get_mon_desc (sunxi_display->monitor));for (i =0 ; i <=SUNXI_MONITOR_LAST ; i++) {if (strcmp (mon,sunxi_get_mon_desc (i)) ==0 ) { - sunxi_display.monitor = i; + sunxi_display->monitor = i;break ; } }if (i >SUNXI_MONITOR_LAST )printf ("Unknown monitor: '%s', falling back to '%s'\n" , - mon,sunxi_get_mon_desc (sunxi_display.monitor)); + mon,sunxi_get_mon_desc (sunxi_display->monitor));#ifdef CONFIG_VIDEO_HDMI /* If HDMI/DVI is selected do HPD & EDID, and handle fallback */ -if (sunxi_display.monitor == sunxi_monitor_dvi || - sunxi_display.monitor == sunxi_monitor_hdmi) { +if (sunxi_display->monitor == sunxi_monitor_dvi || + sunxi_display->monitor == sunxi_monitor_hdmi) {/* Always call hdp_detect, as it also enables clocks, etc. */ hdmi_present = (sunxi_hdmi_hpd_detect (hpd_delay) ==1 );if (hdmi_present && edid) {printf ("HDMI connected: " ); -if (sunxi_hdmi_edid_get_mode (&custom, true) ==0 ) +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, true) ==0 ) mode = &custom;else hdmi_present = false; }/* Fall back to EDID in case HPD failed */ if (edid && !hdmi_present) { -if (sunxi_hdmi_edid_get_mode (&custom, false) ==0 ) { +if (sunxi_hdmi_edid_get_mode (sunxi_display, &custom, false) ==0 ) { mode = &custom; hdmi_present = true; }@@ -1114,38 +1124,39 @@ void *video_hw_init(void)/* Shut down when display was not found */ if ((hpd || edid) && !hdmi_present) {sunxi_hdmi_shutdown (); - sunxi_display.monitor =sunxi_get_default_mon (false); + sunxi_display->monitor =sunxi_get_default_mon (false); }/* else continue with hdmi/dvi without a cable connected */ }#endif -switch (sunxi_display.monitor) { +switch (sunxi_display->monitor) {case sunxi_monitor_none: -return NULL ; +printf ("Unknown monitor\n" ); +return -EINVAL ;case sunxi_monitor_dvi:case sunxi_monitor_hdmi:if (!sunxi_has_hdmi ()) {printf ("HDMI/DVI not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; }break ;case sunxi_monitor_lcd:if (!sunxi_has_lcd ()) {printf ("LCD not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =video_get_params (&custom, lcd_mode); + sunxi_display->depth =video_get_params (&custom, lcd_mode); mode = &custom;break ;case sunxi_monitor_vga:if (!sunxi_has_vga ()) {printf ("VGA not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } - sunxi_display.depth =18 ; + sunxi_display->depth =18 ;break ;case sunxi_monitor_composite_pal:case sunxi_monitor_composite_ntsc:@@ -1153,85 +1164,103 @@ void *video_hw_init(void)case sunxi_monitor_composite_pal_nc:if (!sunxi_has_composite ()) {printf ("Composite video not supported on this board\n" ); - sunxi_display.monitor = sunxi_monitor_none; -return NULL ; + sunxi_display->monitor = sunxi_monitor_none; +return -EINVAL ; } -if (sunxi_display.monitor == sunxi_monitor_composite_pal || - sunxi_display.monitor == sunxi_monitor_composite_pal_nc) +if (sunxi_display->monitor == sunxi_monitor_composite_pal || + sunxi_display->monitor == sunxi_monitor_composite_pal_nc) mode = &composite_video_modes[0 ];else mode = &composite_video_modes[1 ]; - sunxi_display.depth =24 ; + sunxi_display->depth =24 ;break ; }/* Yes these defaults are quite high, overscan on composite sucks... */ if (overscan_x ==-1 ) - overscan_x =sunxi_is_composite () ?32 :0 ; + overscan_x =sunxi_is_composite (sunxi_display->monitor) ?32 :0 ;if (overscan_y ==-1 ) - overscan_y =sunxi_is_composite () ?20 :0 ; + overscan_y =sunxi_is_composite (sunxi_display->monitor) ?20 :0 ; - sunxi_display.fb_size = - (mode->xres * mode->yres *4 +0xfff ) & ~0xfff ; + sunxi_display->fb_size = plat->size; overscan_offset = (overscan_y * mode->xres + overscan_x) *4 ;/* We want to keep the fb_base for simplefb page aligned, where as * the sunxi dma engines will happily accept an unaligned address. */ if (overscan_offset) - sunxi_display.fb_size +=0x1000 ; - -if (sunxi_display.fb_size >CONFIG_SUNXI_MAX_FB_SIZE ) { -printf ("Error need %dkB for fb, but only %dkB is reserved\n" , - sunxi_display.fb_size >>10 , -CONFIG_SUNXI_MAX_FB_SIZE >>10 ); -return NULL ; - } + sunxi_display->fb_size +=0x1000 ;printf ("Setting up a %dx%d%s %s console (overscan %dx%d)\n" , mode->xres, mode->yres, (mode->vmode ==FB_VMODE_INTERLACED ) ?"i" :"" , -sunxi_get_mon_desc (sunxi_display.monitor), +sunxi_get_mon_desc (sunxi_display->monitor), overscan_x, overscan_y); - gd->fb_base = gd->bd->bi_dram[0 ].start + - gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + sunxi_display->fb_addr = plat->base;sunxi_engines_init ();#ifdef CONFIG_EFI_LOADER -efi_add_memory_map (gd->fb_base, sunxi_display.fb_size, +efi_add_memory_map (sunxi_display->fb_addr, sunxi_display->fb_size,EFI_RESERVED_MEMORY_TYPE );#endif drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1209
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +2
-5- fb_dma_addr = gd->fb_base -CONFIG_SYS_SDRAM_BASE ; - sunxi_display.fb_addr = gd->fb_base; + fb_dma_addr = sunxi_display->fb_addr -CONFIG_SYS_SDRAM_BASE ;if (overscan_offset) { fb_dma_addr +=0x1000 - (overscan_offset &0xfff ); - sunxi_display.fb_addr += (overscan_offset +0xfff ) & ~0xfff ; -memset ((void *)gd->fb_base,0 , sunxi_display.fb_size); -flush_cache (gd->fb_base, sunxi_display.fb_size); + sunxi_display->fb_addr += (overscan_offset +0xfff ) & ~0xfff ;
ALIGN(overscan_offset, 0x100)?
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1211
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +2
-0+memset ((void *)sunxi_display->fb_addr,0 , sunxi_display->fb_size); +flush_cache (sunxi_display->fb_addr, sunxi_display->fb_size);Driver model clears the frame buffer. Is this needed?
This is just when overscan is enabled (for composite video). I *think* it aims to clear the unused overscan area?
Quoted 29 lines
Quoted 12 lines
drivers/video/sunxi/sunxi_display.c +1
-4} -sunxi_mode_set (mode, fb_dma_addr); +sunxi_mode_set (sunxi_display, mode, fb_dma_addr);/* * These are the only members of this structure that are used. All the * others are driver specific. The pitch is stored in plnSizeX. */ - graphic_device->frameAdrs = sunxi_display.fb_addr; - graphic_device->gdfIndex =GDF_32BIT_X888RGB ; - graphic_device->gdfBytesPP =4 ;drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1223
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +5
-5- graphic_device->winSizeX = mode->xres -2 * overscan_x; - graphic_device->winSizeY = mode->yres -2 * overscan_y; - graphic_device->plnSizeX = mode->xres * graphic_device->gdfBytesPP; - -return graphic_device; + uc_priv->bpix =VIDEO_BPP32 ; + uc_priv->xsize = mode->xres; + uc_priv->ysize = mode->yres; + +video_set_flush_dcache (dev,1 );true
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +2
-0+ +return 0 ; }
Quoted 8 lines
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1233
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +6
-0+static int sunxi_de_bind (struct udevice *dev) +{ +struct video_uc_plat *plat =dev_get_uclass_plat (dev); + + plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<LCD_MAX_LOG2_BPP ) /8 ;Should use enum
video_log2_bpphere. Also seeVNBYTES().
LCD_MAX_LOG2_BPP is defined as VIDEO_BPP32 at the very top. Sure will use VNBYTES.
On a related topic: IIUC this is called several times, for a start once before relocation, where it's supposed to give an upper bound? Are subsequent calls then expected to be more precise? Our 32MB frame buffer is *very* generous, for the usual FullHD display we just need 8MB. But we would only know this in probe(), when we have learned the output device and the video modes it supports.
So is there a way to restrict (and possibly also move) the framebuffer in probe()?
Cheers,
Andre
Quoted 29 lines
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +4
-0+ +return 0 ; +} +drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1247
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +10
-0+static const struct video_ops sunxi_de_ops = { +}; + +U_BOOT_DRIVER (sunxi_de) = { + .name ="sunxi_de" , + .id =UCLASS_VIDEO , + .ops = &sunxi_de_ops, + .bind = sunxi_de_bind, + .probe = sunxi_de_probe, + .priv_auto =sizeof (struct sunxi_display ),Should ideally have an
_privsuffixdrivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1254
Quoted 7 lines
drivers/video/sunxi/sunxi_display.c +7
-0+ .flags = DM_FLAG_PRE_RELOC, +}; + +U_BOOT_DRVINFO (sunxi_de) = { + .name ="sunxi_de" +}; +[..]
Regards,
Simon
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Quoted 11 lines · Andre Przywara
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:Hi Simon,
coming back to this patch, answering to the other comments I skipped over the last time.
In general this patch is the shortest way to get to some kind of DM driver, in many ways it still looks like a non-DM driver on the inside, which shows.
For the record, I'm OK with pulling this patch in as-is and improving the situation rather than requiring further changes right now.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210220/fe0b532f/attachment.sig>
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Quoted 10 lines · On Sat, 20 Feb 2021 19:45:17 -0500 Tom Rini trini at konsulko.com wrote:
Quoted 8 lines · Andre Przywara
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:Hi Simon,
coming back to this patch, answering to the other comments I skipped over the last time.
Quoted 6 lines
Quoted 3 lines
In general this patch is the shortest way to get to some kind of DM driver, in many ways it still looks like a non-DM driver on the inside, which shows.
For the record, I'm OK with pulling this patch in as-is and improving the situation rather than requiring further changes right now.
OK, thanks! I'll queue it and will submit a pull request soon.
--
Anatolij
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
On Sun, 21 Feb 2021 17:47:53 +0100
Anatolij Gustschin <[email protected]> wrote:
Hi Anatolij,
Quoted 13 lines
Quoted 10 lines · On Sat, 20 Feb 2021 19:45:17 -0500 Tom Rini trini at konsulko.com wrote:
Quoted 8 lines · Andre Przywara
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:Hi Simon,
coming back to this patch, answering to the other comments I skipped over the last time.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
In general this patch is the shortest way to get to some kind of DM driver, in many ways it still looks like a non-DM driver on the inside, which shows.
For the record, I'm OK with pulling this patch in as-is and improving the situation rather than requiring further changes right now.
OK, thanks! I'll queue it and will submit a pull request soon.
Thanks for that. I just sent a v4 with some small fixes and all the tags.
And just to be sure: with "queue it" you mean for -next, so the April merge window? Because I would feel less comfortable with merging it now, as this has not been widely tested yet (only on A10 and A20, but not on all those other SoCs, especially in tablets with native LCDs).
Thanks!
Andre.
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Hi Andre,
On Mon, 22 Feb 2021 00:17:05 +0000
Andre Przywara andre.przywara at arm.com wrote:
...
Quoted 5 lines
Thanks for that. I just sent a v4 with some small fixes and all the tags.
And just to be sure: with "queue it" you mean for -next, so the April merge window?
I meant to queue it for my build testing, to merge the patch for v2021.04-rc3.
Quoted 3 lines
Because I would feel less comfortable with merging it now, as this has not been widely tested yet (only on A10 and A20, but not on all those other SoCs, especially in tablets with native LCDs).
OK, then I'll postpone it and will merge in the April merge window.
Thanks!
--
Anatolij
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
In reply to Andre PrzywaraHi Andre,
Quoted 112 lines · Andre Przywara
On Sun, 7 Feb 2021 07:37:34 -0700
Simon Glass <[email protected]> wrote:Hi Simon,
coming back to this patch, answering to the other comments I skipped over the last time.
In general this patch is the shortest way to get to some kind of DM driver, in many ways it still looks like a non-DM driver on the inside, which shows.
Quoted 83 lines · Andre Przywara
Quoted 38 lines
From: Jagan Teki <[email protected]>
DM_VIDEOmigration deadline is already expired, but around 80 Allwinner boards are still using video in a legacy way.===================== WARNING ====================== This board does not use
CONFIG_DM_VIDEOPlease update the board to useCONFIG_DM_VIDEObefore the v2019.07 release. Failure to update by the deadline may result in board removal. Seedoc/driver-model/migration.rstfor more info.
====================================================Convert the legacy video driver over to the
DM_VIDEOframework. This is a minimal conversion: it doesn't use the DT for finding its resources, nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)
Signed-off-by Jagan Teki <[email protected]>[Andre: rebase and smaller fixes]Signed-off-by Andre Przywara <[email protected]>---
Hi,I picked this one up to get rid of the warnings. I dropped the BMP support for now (v2 1/3 and v2 2/3), I need to have a closer look, as I am not convinced this was the right solution.
Cheers,
AndreChangelog v2 .. v3:
- rebase against master, fixing up renamed variables and structs
- replace enum with #define
- remove BMP fromKconfig
- fix memory node size calculation in simplefb setupQuoted 6 lines
arch/arm/mach-sunxi/Kconfig | 9 +- drivers/video/sunxi/sunxi_display.c | 262 ++++++++++++++++------------ include/configs/sunxi-common.h | 17 -- scripts/config_whitelist.txt | 1 - 4 files changed, 157 insertions(+), 132 deletions(-)Reviewed-by Simon Glass <[email protected]>Some thoughts below
arch/arm/mach-sunxi/Kconfig config VIDEO_SUNXI · line 819
Quoted 10 lines
arch/arm/mach-sunxi/Kconfig +1
-1@@ -816,13 +816,14 @@ config VIDEO_SUNXI depends on !MACH_SUN9I depends on !MACH_SUN50I depends on !SUN50I_GEN_H6 - select VIDEO + select DM_VIDEOI wonder whether instead
VIDEO_SUNXIshould depend onDM_VIDEO?Quoted 20 lines
arch/arm/mach-sunxi/Kconfig +4
-3+ select DISPLAY imply VIDEO_DT_SIMPLEFB default y ---help--- - Say Y here to add support for using a cfb console on the HDMI, LCD - or VGA output found on most sunxi devices. See doc/README.video for - info on how to select the video output and mode. + Say Y here to add support for using a graphical console on the HDMI, + LCD or VGA output found on older sunxi devices. This will also provide + a simple_framebuffer device for Linux. config VIDEO_HDMI bool "HDMI output support"drivers/video/sunxi/sunxi_display.c +0
-0@@ -7,6 +7,8 @@*/ Quoted 15 lines
drivers/video/sunxi/sunxi_display.c line 35
Quoted 13 lines
drivers/video/sunxi/sunxi_display.c +4
-0#include <common.h> +#include <display.h> +#include <dm.h> #include <cpu_func.h> #include <efi_loader.h> #include <init.h> @@ -28,7 +30,9 @@#include <fdt_support.h> #include <i2c.h> #include <malloc.h> +#include <video.h> #include <video_fb.h> +#include <dm/uclass-internal.h> Do you need that? Internal things should be avoided if posssible.
Quoted 9 lines
That's a good point. This is needed for
uclass_find_device_by_name()down in the simplefb setup function at the very end. This function will be called from a different context (fromft_board_setup()inboard.c), and tries to find the (only) instance of this very driver to populate the simplefb DT node accordingly. This is the approach thesunxi_de2.cuses, and back at the time this was seemingly the best way to achieve this. Alternatives I see:
1) Keep a global static variable, pointing to the struct udevice, set inprobe().
Best avoided.
Quoted 2 lines
2) Use
uclass_get_device_by_name()instead, but prevent the double probe by keeping an indication of the probe status.
Probing a probed device is a nop, so don't worry about that. We do it all the time.
Quoted 3 lines
3) Gather all data needed for the simplefb setup already in
probe(), and store them in global variables, to be picked up bysunxi_simplefb_setup()later.
Again, best to avoid a global.
Quoted 7 lines
4) as 3), but store the extra data (just the pipeline name to find the right DT node to enable?) in generic uclass storage. This has the potential of making this function platform and board agnostic (so meson could benefit as well?). We could then setup the simplefb in common code.
Any ideas on this? Maybe something else entirely?
I think what you have is OK...at present those functions are not called in device context. I don't really have a good solution. You want to avoid probing it just to fill in the data.
BTW it is a bit faster to call device_get_by_driver_info(DM_DRIVER_GET(sunxi_de), &dev)
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/video/sunxi/sunxi_display.c +0
-0#include "../videomodes.h" #include "../anx9804.h" #include "../hitachi_tx18d42vm_lcd.h" @@ -45,6 +49,11 @@DECLARE_GLOBAL_DATA_PTR ;
Quoted 9 lines
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c line 55
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +4
-0+/* Maximum LCD size we support */ +#define LCD_MAX_WIDTH 3840 +#define LCD_MAX_HEIGHT 2160 +#define LCD_MAX_LOG2_BPP VIDEO_BPP32So this resolution is not achievable with a maximum pixel clock of 165 MHz (not even at 24 Hz). Given that the framebuffer reservation is fixed, this wastes quite some memory. Realistically 165 MHz means 1920x1200 (at 60Hz), shall we use that one instead?
I'm not sure about that, but I suppose if the maximum is too high you can change it.
Quoted 19 lines
Quoted 19 lines
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +1
-0+enum sunxi_monitor { sunxi_monitor_none, sunxi_monitor_dvi,drivers/video/sunxi/sunxi_display.c enum sunxi_monitor { · line 74
Quoted 8 lines
drivers/video/sunxi/sunxi_display.c +0
-1@@ -59,12 +68,11 @@ enum sunxi_monitor {#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_ncstruct sunxi_display { -GraphicDevice graphic_device;enum sunxi_monitor monitor;unsigned int depth;unsigned int fb_addr;unsigned int fb_size;These last three are repeated from the uclass info. But
fb_addrseems to sometimes be different from the ucass frame buffer, in which case I wonder how output actually works.
Quoted 7 lines
Quoted 1 line
If you do actually need these, can you please document them here?
I think this might be mostly non-DM legacy, but for the composite overscan we tweak the framebuffer address. I haven't fully wrapped my mind around this, though, and ideally we can indeed lose those extra members.
I will try to find some device with composite input to test it.
Ah OK. Well yes it needs some docs for the next person :-)
[..]
Quoted 31 lines
Quoted 31 lines
Quoted 18 lines
drivers/video/sunxi/sunxi_display.c +1
-1printf("Setting up a %dx%d%s %s console (overscan %dx%d)\n", mode->xres, mode->yres, (mode->vmode == FB_VMODE_INTERLACED) ? "i" : "", - sunxi_get_mon_desc(sunxi_display.monitor), + sunxi_get_mon_desc(sunxi_display->monitor),overscan_x, overscan_y);drivers/video/sunxi/sunxi_display.c +2
-3- gd->fb_base = gd->bd->bi_dram[0 ].start + - gd->bd->bi_dram[0 ].size - sunxi_display.fb_size; + sunxi_display->fb_addr = plat->base;sunxi_engines_init ();#ifdef CONFIG_EFI_LOADER -efi_add_memory_map (gd->fb_base, sunxi_display.fb_size, +efi_add_memory_map (sunxi_display->fb_addr, sunxi_display->fb_size,EFI_RESERVED_MEMORY_TYPE );#endif drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1209
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +2
-5- fb_dma_addr = gd->fb_base -CONFIG_SYS_SDRAM_BASE ; - sunxi_display.fb_addr = gd->fb_base; + fb_dma_addr = sunxi_display->fb_addr -CONFIG_SYS_SDRAM_BASE ;if (overscan_offset) { fb_dma_addr +=0x1000 - (overscan_offset &0xfff ); - sunxi_display.fb_addr += (overscan_offset +0xfff ) & ~0xfff ; -memset ((void *)gd->fb_base,0 , sunxi_display.fb_size); -flush_cache (gd->fb_base, sunxi_display.fb_size); + sunxi_display->fb_addr += (overscan_offset +0xfff ) & ~0xfff ;
ALIGN(overscan_offset, 0x100)?
Quoted 7 lines
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1211
Quoted 2 lines
drivers/video/sunxi/sunxi_display.c +2
-0+memset ((void *)sunxi_display->fb_addr,0 , sunxi_display->fb_size); +flush_cache (sunxi_display->fb_addr, sunxi_display->fb_size);Driver model clears the frame buffer. Is this needed?
This is just when overscan is enabled (for composite video). I *think* it aims to clear the unused overscan area?
In that case I feel that the fb should be allocated large enough for the overscan area (how else could it be). But I'm not sure what is happening here, so perhaps this is needed.
Quoted 42 lines
Quoted 30 lines
Quoted 13 lines
}drivers/video/sunxi/sunxi_display.c +1
-4-sunxi_mode_set (mode, fb_dma_addr); +sunxi_mode_set (sunxi_display, mode, fb_dma_addr);/* * These are the only members of this structure that are used. All the * others are driver specific. The pitch is stored in plnSizeX. */ - graphic_device->frameAdrs = sunxi_display.fb_addr; - graphic_device->gdfIndex =GDF_32BIT_X888RGB ; - graphic_device->gdfBytesPP =4 ;drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1223
Quoted 10 lines
drivers/video/sunxi/sunxi_display.c +5
-5- graphic_device->winSizeX = mode->xres -2 * overscan_x; - graphic_device->winSizeY = mode->yres -2 * overscan_y; - graphic_device->plnSizeX = mode->xres * graphic_device->gdfBytesPP; - -return graphic_device; + uc_priv->bpix =VIDEO_BPP32 ; + uc_priv->xsize = mode->xres; + uc_priv->ysize = mode->yres; + +video_set_flush_dcache (dev,1 );true
Quoted 4 lines
drivers/video/sunxi/sunxi_display.c +2
-0+ +return 0 ; }Quoted 8 lines
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1233
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +6
-0+static int sunxi_de_bind (struct udevice *dev) +{ +struct video_uc_plat *plat =dev_get_uclass_plat (dev); + + plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<LCD_MAX_LOG2_BPP ) /8 ;Should use enum
video_log2_bpphere. Also seeVNBYTES().
LCD_MAX_LOG2_BPPis defined asVIDEO_BPP32at the very top. Sure will use VNBYTES.
Quoted 8 lines
On a related topic: IIUC this is called several times, for a start once before relocation, where it's supposed to give an upper bound? Are subsequent calls then expected to be more precise? Our 32MB frame buffer is *very* generous, for the usual FullHD display we just need 8MB. But we would only know this in
probe(), when we have learned the output device and the video modes it supports.
So is there a way to restrict (and possibly also move) the framebuffer inprobe()?
I suppose you can, but that is not what is expected. You don't save memory for U-Boot (and it doesn't matter), but making it smaller so that linux uses less would be worthwhile. We just need to make sure this is documented in video.h and tested.
To be clear, you have my review thg, so these are things that can be done later.
Regards,
Simon
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
Quoted 21 lines · Simon Glass
Quoted 12 lines
Quoted 8 lines
drivers/video/sunxi/sunxi_display.c void *video_hw_init(void) · line 1233
Quoted 6 lines
drivers/video/sunxi/sunxi_display.c +6
-0+static int sunxi_de_bind (struct udevice *dev) +{ +struct video_uc_plat *plat =dev_get_uclass_plat (dev); + + plat->size =LCD_MAX_WIDTH *LCD_MAX_HEIGHT * + (1 <<LCD_MAX_LOG2_BPP ) /8 ;Should use enum
video_log2_bpphere. Also seeVNBYTES().
LCD_MAX_LOG2_BPPis defined asVIDEO_BPP32at the very top. Sure will use VNBYTES.Quoted 8 lines
On a related topic: IIUC this is called several times, for a start once before relocation, where it's supposed to give an upper bound? Are subsequent calls then expected to be more precise? Our 32MB frame buffer is *very* generous, for the usual FullHD display we just need 8MB. But we would only know this in
probe(), when we have learned the output device and the video modes it supports.
So is there a way to restrict (and possibly also move) the framebuffer inprobe()?
Quoted 6 lines
I suppose you can, but that is not what is expected. You don't save memory for U-Boot (and it doesn't matter), but making it smaller so that linux uses less would be worthwhile. We just need to make sure this is documented in
video.hand tested.To be clear, you have my review thg, so these are things that can be done later.
Seems Andre seems to be motivated to rework that driver, I guess we could also rework how this is done.
Ideally, we should be describing the reserved buffer through a reserved-memory node in the DT instead of carving out some memory for Linux. That way, if we don't have simplefb support, or it's replaced by something else eventually, we have a chance a claiming that memory back at some point, instead of just ignoring it.
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210222/bf7f06fc/attachment.sig>
PATCH v3 1/1 video: sunxi_display: Convert to DM_VIDEO
In reply to Andre PrzywaraHi Andre,
Quoted 17 lines · Andre Przywara
Quoted 17 lines
drivers/video/sunxi/sunxi_display.c enum sunxi_monitor { · line 74
Quoted 12 lines
enum
sunxi_monitor{
sunxi_monitor_none,
sunxi_monitor_dvi,drivers/video/sunxi/sunxi_display.c +0
-1@@ -59,12 +68,11 @@ enum sunxi_monitor {#define SUNXI_MONITOR_LAST sunxi_monitor_composite_pal_ncstruct sunxi_display { -GraphicDevice graphic_device;enum sunxi_monitor monitor;unsigned int depth;unsigned int fb_addr;unsigned int fb_size;These last three are repeated from the uclass info. But
fb_addrseems to sometimes be different from the ucass frame buffer, in which case I wonder how output actually works.
Quoted 7 lines
Quoted 1 line
If you do actually need these, can you please document them here?
I think this might be mostly non-DM legacy, but for the composite overscan we tweak the framebuffer address. I haven't fully wrapped my mind around this, though, and ideally we can indeed lose those extra members.
I will try to find some device with composite input to test it.
So the overscan will put the edges of any displayed image out of the visible area of the screen, right? The amount of content non-visible due to this isn't really standard and any display will behave differently there.
One way to deal with this is to rescale the composited image to a slightly smaller and center it in the middle of the screen.
We don't have that option though, so the code will instead render in a slightly smaller resolution, centered in the framebuffer.
Note that composite isn't the only output that you can test this on:
HDMI TVs will also use overscan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210222/27d6640d/attachment.sig>