From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 13/18] lcd: Add support for flushing LCD fb from dcache after update
Date: Thu, 09 Aug 2012 09:43:15 +0200 [thread overview]
Message-ID: <20120809094315.79012bd2@amdc308.digital.local> (raw)
In-Reply-To: <1342106718-3058-14-git-send-email-sjg@chromium.org>
Hi Simon,
> This provides an option for the LCD to flush the dcache after each
> update (puts, scroll or clear).
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> Changes in v2:
> - Put the LCD cache flush logic into lcd_putc() instead of lcd_puts()
>
> Changes in v3:
> - Put the LCD cache flush logic back into lcd_puts()
>
> common/lcd.c | 46 +++++++++++++++++++++++++++++++++++++++-------
> include/lcd.h | 8 ++++++++
> 2 files changed, 47 insertions(+), 7 deletions(-)
>
> diff --git a/common/lcd.c b/common/lcd.c
> index 18525a7..f7514a4 100644
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -97,6 +97,9 @@ static void lcd_setbgcolor (int color);
>
> char lcd_is_enabled = 0;
>
> +static char lcd_flush_dcache; /* 1 to flush dcache after each
> lcd update */ +
> +
> #ifdef NOT_USED_SO_FAR
> static void lcd_getcolreg (ushort regno,
> ushort *red, ushort *green, ushort
> *blue); @@ -105,6 +108,28 @@ static int lcd_getfgcolor (void);
>
> /************************************************************************/
>
> +/* Flush LCD activity to the caches */
> +void lcd_sync(void)
> +{
> + /*
> + * flush_dcache_range() is declared in common.h but it seems
> that some
> + * architectures do not actually implement it. Is there a
> way to find
> + * out whether it exists? For now, ARM is safe.
> + */
> +#ifdef CONFIG_ARM
> + int line_length;
> +
> + if (lcd_flush_dcache)
> + flush_dcache_range((u32)lcd_base,
> + (u32)(lcd_base +
> lcd_get_size(&line_length))); +#endif
I'm struggling with a similar problem - but not in console putc, but
at lcd_display_bitmap().
The solution (in mine case) is:
flush_dcache_range((unsigned long) fb,
(unsigned long) fb +
(lcd_line_length * height));
which takes the "real" image range (as it is defined by fb).
Flushing the lcd_base based range is a bit overkill for me.
> +}
> +
> +void lcd_set_flush_dcache(int flush)
> +{
> + lcd_flush_dcache = (flush != 0);
> +}
> +
I'm wondering if this flush_dcache_range cannot be added directly to
relevant places in the code?
flush_dcache_* calls are either defined (for a relevant - cache aware
archs) or are dummy.
> /*----------------------------------------------------------------------*/
>
> static void console_scrollup (void)
> @@ -114,6 +139,7 @@ static void console_scrollup (void)
>
> /* Clear the last one */
> memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg),
> CONSOLE_ROW_SIZE);
> + lcd_sync();
> }
>
> /*----------------------------------------------------------------------*/
> @@ -144,6 +170,8 @@ static inline void console_newline (void)
> /* Scroll everything up */
> console_scrollup () ;
> --console_row;
> + } else {
> + lcd_sync();
> }
> }
>
> @@ -198,6 +226,7 @@ void lcd_puts (const char *s)
> while (*s) {
> lcd_putc (*s++);
> }
> + lcd_sync();
> }
>
> /*----------------------------------------------------------------------*/
> @@ -365,13 +394,6 @@ int drv_lcd_init (void)
> }
>
> /*----------------------------------------------------------------------*/
> -static
> -int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc, char *const
> argv[]) -{
> - lcd_clear();
> - return 0;
> -}
> -
> void lcd_clear(void)
> {
> #if LCD_BPP == LCD_MONOCHROME
> @@ -413,6 +435,14 @@ void lcd_clear(void)
>
> console_col = 0;
> console_row = 0;
> + lcd_sync();
> +}
> +
> +static int do_lcd_clear(cmd_tbl_t *cmdtp, int flag, int argc,
> + char *const argv[])
> +{
> + lcd_clear();
> + return 0;
> }
>
> U_BOOT_CMD(
> @@ -607,6 +637,7 @@ void bitmap_plot (int x, int y)
> }
>
> WATCHDOG_RESET();
> + lcd_sync();
> }
> #else
> static inline void bitmap_plot(int x, int y) {}
> @@ -820,6 +851,7 @@ int lcd_display_bitmap(ulong bmp_image, int x,
> int y) break;
> };
>
> + lcd_sync();
> return (0);
> }
> #endif
> diff --git a/include/lcd.h b/include/lcd.h
> index 26f6d83..4363131 100644
> --- a/include/lcd.h
> +++ b/include/lcd.h
> @@ -57,6 +57,14 @@ extern void lcd_initcolregs (void);
> extern struct bmp_image *gunzip_bmp(unsigned long addr, unsigned
> long *lenp); extern int bmp_display(ulong addr, int x, int y);
>
> +/**
> + * Set whether we need to flush the dcache when changing the LCD
> image. This
> + * defaults to off.
> + *
> + * @param flush non-zero to flush cache after update,
> 0 to skip
> + */
> +void lcd_set_flush_dcache(int flush);
> +
> #if defined CONFIG_MPC823
> /*
> * LCD controller stucture for MPC823 CPU
Anyway, I'm looking forward for v4 version of this patch.
--
Best regards,
Lukasz Majewski
Samsung Poland R&D Center | Linux Platform Group
next prev parent reply other threads:[~2012-08-09 7:43 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 15:25 [U-Boot] [PATCH v3 0/18] tegra: Add display driver and LCD support for Seaboard Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 01/18] fdt: Tidy debugging, add to fdtdec_get_int/addr() Simon Glass
2012-09-21 20:06 ` Anatolij Gustschin
2012-07-12 15:25 ` [U-Boot] [PATCH v3 02/18] fdt: Add header guard to fdtdec.h Simon Glass
2012-07-19 13:49 ` Mike Frysinger
2012-09-21 20:08 ` Anatolij Gustschin
2012-07-12 15:25 ` [U-Boot] [PATCH v3 03/18] tegra: Use const for pinmux_config_pingroup/table() Simon Glass
2012-07-19 13:53 ` Mike Frysinger
2012-07-12 15:25 ` [U-Boot] [PATCH v3 04/18] tegra: Add display support to funcmux Simon Glass
2012-07-19 13:54 ` Mike Frysinger
2012-07-12 15:25 ` [U-Boot] [PATCH v3 05/18] tegra: fdt: Add pwm binding and node Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 06/18] tegra: fdt: Add LCD definitions for Tegra Simon Glass
2012-07-31 9:27 ` Simon Glass
2012-07-31 9:51 ` Thierry Reding
2012-09-27 19:44 ` Simon Glass
2012-07-31 16:12 ` Stephen Warren
2012-09-27 13:58 ` Simon Glass
2012-09-27 15:49 ` Stephen Warren
2012-09-27 20:27 ` Simon Glass
2012-09-27 23:21 ` Stephen Warren
2012-09-27 23:37 ` Simon Glass
2012-09-28 5:42 ` Thierry Reding
2012-07-12 15:25 ` [U-Boot] [PATCH v3 07/18] tegra: Add support for PWM Simon Glass
2012-07-19 13:55 ` Mike Frysinger
2012-09-27 13:51 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 08/18] tegra: Add SOC support for display/lcd Simon Glass
2012-07-19 7:37 ` Thierry Reding
2012-07-19 8:24 ` Adam Jiang
2012-07-19 8:28 ` Thierry Reding
2012-07-19 8:03 ` Adam Jiang
2012-07-19 14:13 ` Mike Frysinger
2012-09-27 17:44 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 09/18] tegra: Add LCD driver Simon Glass
2012-07-19 7:41 ` Thierry Reding
2012-09-27 17:28 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 10/18] tegra: Add LCD support to Nvidia boards Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 11/18] arm: Add control over cachability of memory regions Simon Glass
2012-07-12 18:12 ` Albert ARIBAUD
2012-07-19 14:10 ` Mike Frysinger
2012-09-27 17:54 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 12/18] lcd: Add CONFIG_LCD_ALIGNMENT to select frame buffer alignment Simon Glass
2012-07-19 13:59 ` Mike Frysinger
2012-09-27 19:20 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 13/18] lcd: Add support for flushing LCD fb from dcache after update Simon Glass
2012-07-19 14:01 ` Mike Frysinger
2012-07-19 16:52 ` Mike Frysinger
2012-08-09 7:43 ` Lukasz Majewski [this message]
2012-10-16 18:16 ` Simon Glass
2012-10-17 10:38 ` Lukasz Majewski
2012-10-17 15:34 ` Eric Nelson
2012-10-17 22:07 ` Simon Glass
2012-10-18 0:41 ` Eric Nelson
2012-10-18 0:50 ` Simon Glass
2012-10-18 1:07 ` Eric Nelson
2012-10-19 23:49 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 14/18] tegra: Align LCD frame buffer to section boundary Simon Glass
2012-07-19 14:01 ` Mike Frysinger
2012-07-12 15:25 ` [U-Boot] [PATCH v3 15/18] tegra: Support control of cache settings for LCD Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 16/18] tegra: fdt: Add LCD definitions for Seaboard Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 17/18] lcd: Add CONSOLE_SCROLL_LINES option to speed console Simon Glass
2012-07-19 14:04 ` Mike Frysinger
2012-09-27 19:23 ` Simon Glass
2012-07-12 15:25 ` [U-Boot] [PATCH v3 18/18] tegra: Enable display/lcd support on Seaboard Simon Glass
2012-07-19 7:58 ` [U-Boot] [PATCH v3 0/18] tegra: Add display driver and LCD support for Seaboard Thierry Reding
2012-07-31 9:28 ` Simon Glass
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=20120809094315.79012bd2@amdc308.digital.local \
--to=l.majewski@samsung.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox