From patchwork Wed Oct 19 08:56:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 120575 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3B3F4B70B1 for ; Wed, 19 Oct 2011 19:56:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 95ECE28A1C; Wed, 19 Oct 2011 10:56:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gSFb0Sn1G9mM; Wed, 19 Oct 2011 10:56:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A89928A09; Wed, 19 Oct 2011 10:56:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 67C4228A09 for ; Wed, 19 Oct 2011 10:56:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SESB6UZ6FJnp for ; Wed, 19 Oct 2011 10:56:25 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTP id 0E7BA28A04 for ; Wed, 19 Oct 2011 10:56:23 +0200 (CEST) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id DFABA182446D; Wed, 19 Oct 2011 10:56:22 +0200 (CEST) X-Auth-Info: fb0RVi001b77M8bStzJ5cBH5MUM1FwnEUGCunoJbvBE= Received: from wker (p4FDE71A5.dip.t-dialin.net [79.222.113.165]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id AD4471C0020A; Wed, 19 Oct 2011 10:56:22 +0200 (CEST) Date: Wed, 19 Oct 2011 10:56:21 +0200 From: Anatolij Gustschin To: Che-Liang Chiou Message-ID: <20111019105621.040e828a@wker> In-Reply-To: <2c86043ade74a43ffa5308b44b2d7bfe0022c931.1318928915.git.clchiou@chromium.org> References: <2c86043ade74a43ffa5308b44b2d7bfe0022c931.1318928915.git.clchiou@chromium.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH V3 4/4] api: export LCD and video to external apps X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Hi, On Tue, 18 Oct 2011 17:15:38 +0800 Che-Liang Chiou 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.