All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 4/4] api: export LCD and video to external apps
Date: Wed, 19 Oct 2011 10:56:21 +0200	[thread overview]
Message-ID: <20111019105621.040e828a@wker> (raw)
In-Reply-To: <2c86043ade74a43ffa5308b44b2d7bfe0022c931.1318928915.git.clchiou@chromium.org>

Hi,

On Tue, 18 Oct 2011 17:15:38 +0800
Che-Liang Chiou <clchiou@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.

  reply	other threads:[~2011-10-19  8:56 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04  8:16 [U-Boot] [PATCH 0/2] api: export LCD and video to external apps Che-Liang Chiou
2011-10-04  8:16 ` [U-Boot] [PATCH 1/2] lcd: video: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-06 18:34   ` Wolfgang Denk
2011-10-04  8:16 ` [U-Boot] [PATCH 2/2] api: export LCD and video to external apps Che-Liang Chiou
2011-10-06 18:33   ` Wolfgang Denk
2011-10-07  8:32     ` Che-liang Chiou
2011-10-07  9:05       ` Wolfgang Denk
2011-10-07  9:45         ` Che-liang Chiou
2011-10-09 20:00           ` Wolfgang Denk
2011-10-07  8:28 ` [U-Boot] [PATCH V2 0/2] " Che-Liang Chiou
2011-10-07  8:28   ` [U-Boot] [PATCH V2 1/2] lcd: video: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-07  8:28   ` [U-Boot] [PATCH V2 2/2] api: export LCD and video to external apps Che-Liang Chiou
2011-10-17 21:13     ` Anatolij Gustschin
2011-10-18  6:12       ` Che-liang Chiou
2011-10-18  7:17         ` Anatolij Gustschin
2011-10-18  8:24           ` Che-liang Chiou
2011-10-18  9:15 ` [U-Boot] [PATCH V3 0/4] " Che-Liang Chiou
2011-10-18  9:15   ` [U-Boot] [PATCH V3 1/4] lcd: video: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-18  9:15   ` [U-Boot] [PATCH V3 2/4] tools: logo: add static and unused to bmp arrays Che-Liang Chiou
2011-10-18  9:15   ` [U-Boot] [PATCH V3 3/4] video: add access to GraphicDevice struct Che-Liang Chiou
2011-10-19  8:27     ` Anatolij Gustschin
2011-10-18  9:15   ` [U-Boot] [PATCH V3 4/4] api: export LCD and video to external apps Che-Liang Chiou
2011-10-19  8:56     ` Anatolij Gustschin [this message]
2011-10-20  5:41       ` Che-liang Chiou
2011-10-20  5:38   ` [U-Boot] [PATCH V4 0/3] " Che-Liang Chiou
2011-10-20  5:38     ` [U-Boot] [PATCH V4 1/3] lcd: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-20 12:38       ` Mike Frysinger
2011-10-20  5:38     ` [U-Boot] [PATCH V4 2/3] tools: logo: add static and unused to bmp arrays Che-Liang Chiou
2011-10-20 12:42       ` Mike Frysinger
2011-10-20 18:43         ` Wolfgang Denk
2011-10-20  5:38     ` [U-Boot] [PATCH V4 3/3] api: export LCD device to external apps Che-Liang Chiou
2011-10-20 13:25       ` Mike Frysinger
2011-10-21  9:04   ` [U-Boot] [PATCH V5 0/4] " Che-Liang Chiou
2011-10-21  9:04     ` [U-Boot] [PATCH V5 1/4] lcd: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-30 15:16       ` Mike Frysinger
2011-10-30 18:21       ` [U-Boot] [PATCH v6 " Anatolij Gustschin
2011-11-10 22:31         ` Anatolij Gustschin
2011-10-21  9:04     ` [U-Boot] [PATCH V5 2/4] tools: logo: split bmp arrays from bmp_logo.h Che-Liang Chiou
2011-10-30 15:24       ` Mike Frysinger
2011-10-30 18:24       ` [U-Boot] [PATCH v6 " Anatolij Gustschin
2011-11-10 22:33         ` Anatolij Gustschin
2011-10-21  9:04     ` [U-Boot] [PATCH V5 3/4] font: split font data from video_font.h Che-Liang Chiou
2011-10-30 15:36       ` Mike Frysinger
2011-10-30 18:33       ` Anatolij Gustschin
2011-10-31  2:23         ` Che-liang Chiou
2011-11-10 22:36       ` Anatolij Gustschin
2011-10-21  9:04     ` [U-Boot] [PATCH V5 4/4] api: export LCD device to external apps Che-Liang Chiou
2011-11-10 22:41       ` Anatolij Gustschin
2011-10-21  9:07   ` [U-Boot] [PATCH V5 1/4] lcd: add clear and draw bitmap declaration Che-Liang Chiou
2011-10-30 15:37     ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111019105621.040e828a@wker \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.