[U-Boot] [PATCH V3 4/4] api: export LCD and video to external apps

Anatolij Gustschin agust at denx.de
Wed Oct 19 10:56:21 CEST 2011


Hi,

On Tue, 18 Oct 2011 17:15:38 +0800
Che-Liang Chiou <clchiou at chromium.org> wrote:
...
> +int display_get_info(int type, struct display_info *di)
> +{
> +#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
> +	GraphicDevice *gdev;
> +#endif
> +
> +	switch (type) {
> +	default:
> +		debug("%s: unsupport display device type: %d\n",
> +				__FILE__, type);
> +		return API_ENODEV;
> +
> +#ifdef CONFIG_LCD
> +	case DISPLAY_TYPE_LCD:
> +		di->pixel_width  = panel_info.vl_col;
> +		di->pixel_height = panel_info.vl_row;
> +		di->screen_rows = CONSOLE_ROWS;
> +		di->screen_cols = CONSOLE_COLS;
> +		break;
> +#endif
> +
> +#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
> +	case DISPLAY_TYPE_VIDEO:
> +		gdev = video_devinfo();
> +		di->pixel_width  = gdev->winSizeX;
> +		di->pixel_height = gdev->winSizeY;
> +		di->screen_rows = CONSOLE_ROWS;
> +		di->screen_cols = CONSOLE_COLS;

the return value of video_devinfo() should be checked before
dereferencing gdev pointer (it could be NULL).

Another issue is that CONSOLE_ROWS and CONSOLE_COLS macros
expand to 'panel_info' structure usage here which is only
okay for CONFIG_LCD case. For CONFIG_VIDEO case these
macros are defined in cfb_console.c file and thus can not
be used here as you currently do (compile breakage again).

...
> +
> +void display_clear(void)
> +{
> +#ifdef CONFIG_LCD
> +	lcd_clear();
> +#endif
> +#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
> +	video_clear();

video_clear() is used here but it is not defined. Below is
a small patch included. It shows how video_clear() could look
like (but this was not tested yet).

Anatolij

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 4e653b8..5336937 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1753,6 +1753,23 @@ static int video_init(void)
 	return 0;
 }
 
+void video_clear(void)
+{
+#ifdef VIDEO_HW_RECTFILL
+	video_hw_rectfill(VIDEO_PIXEL_SIZE,	/* bytes per pixel */
+			  0,			/* dest pos x */
+			  0,			/* dest pos y */
+			  VIDEO_VISIBLE_COLS,	/* frame width */
+			  VIDEO_VISIBLE_ROWS,	/* frame height */
+			  CONSOLE_BG_COL	/* fill color */
+		);
+#else
+	memsetl(CONSOLE_ROW_FIRST, CONSOLE_SIZE >> 2, CONSOLE_BG_COL);
+#endif
+	console_col = 0;
+	console_row = 0;
+}
+
 /*
  * Implement a weak default function for boards that optionally
  * need to skip the video initialization.


More information about the U-Boot mailing list