* [U-Boot] [PATCH] Add support for 32-bit organized framebuffers
@ 2014-03-06 13:53 Hannes Petermaier
2014-03-06 19:41 ` Gerhard Sittig
2014-03-07 17:55 ` [U-Boot] [PATCH v2] " Hannes Petermaier
0 siblings, 2 replies; 4+ messages in thread
From: Hannes Petermaier @ 2014-03-06 13:53 UTC (permalink / raw)
To: u-boot
- Adds support for 32-bit organized framebuffers to the LCD-framework.
- cleaned up unused functions
Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
---
common/lcd.c | 52 +++++++++++++++++++++++++++++++++-------------------
include/lcd.h | 19 ++++++++++++++++---
2 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c
index aa81522..e552340 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -94,7 +94,8 @@
#if LCD_BPP == LCD_MONOCHROME
# define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
(c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
-#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
+ (LCD_BPP == LCD_COLOR32)
# define COLOR_MASK(c) (c)
#else
# error Unsupported LCD BPP.
@@ -110,7 +111,6 @@ static int lcd_init(void *lcdbase);
static void *lcd_logo(void);
-static int lcd_getbgcolor(void);
static void lcd_setfgcolor(int color);
static void lcd_setbgcolor(int color);
@@ -164,10 +164,20 @@ static void console_scrollup(void)
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
/* Clear the last rows */
+#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
COLOR_MASK(lcd_color_bg),
CONSOLE_ROW_SIZE * rows);
-
+#else
+ u32 *ppix = lcd_console_address +
+ CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
+ u32 i;
+ for (i = 0;
+ i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
lcd_sync();
console_row -= rows;
}
@@ -285,13 +295,15 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
ushort off = x * (1 << LCD_BPP) % 8;
#endif
- dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+ dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
int i;
#if LCD_BPP == LCD_COLOR16
ushort *d = (ushort *)dest;
+#elif LCD_BPP == LCD_COLOR32
+ u32 *d = (u32 *)dest;
#else
uchar *d = dest;
#endif
@@ -324,6 +336,12 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
+#elif LCD_BPP == LCD_COLOR32
+ for (c = 0; c < 8; ++c) {
+ *d++ = (bits & 0x80) ?
+ lcd_color_fg : lcd_color_bg;
+ bits <<= 1;
+ }
#endif
}
#if LCD_BPP == LCD_MONOCHROME
@@ -453,9 +471,19 @@ void lcd_clear(void)
test_pattern();
#else
/* set framebuffer to background color */
+#if (LCD_BPP != LCD_COLOR32)
memset((char *)lcd_base,
- COLOR_MASK(lcd_getbgcolor()),
+ COLOR_MASK(lcd_color_bg),
lcd_line_length * panel_info.vl_row);
+#else
+ u32 *ppix = lcd_base;
+ u32 i;
+ for (i = 0;
+ i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
#endif
/* Paint the logo and retrieve LCD base address */
debug("[LCD] Drawing the logo...\n");
@@ -563,20 +591,6 @@ static void lcd_setbgcolor(int color)
lcd_color_bg = color;
}
-/*----------------------------------------------------------------------*/
-
-int lcd_getfgcolor(void)
-{
- return lcd_color_fg;
-}
-
-/*----------------------------------------------------------------------*/
-
-static int lcd_getbgcolor(void)
-{
- return lcd_color_bg;
-}
-
/************************************************************************/
/* ** Chipset depending Bitmap / Logo stuff... */
/************************************************************************/
diff --git a/include/lcd.h b/include/lcd.h
index d06d6f1..df707f6 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -26,8 +26,6 @@ void lcd_enable(void);
void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
void lcd_initcolregs(void);
-int lcd_getfgcolor(void);
-
/* gunzip_bmp used if CONFIG_VIDEO_BMP_GZIP */
struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
void **alloc_addr);
@@ -334,7 +332,7 @@ int lcd_dt_simplefb_enable_existing_node(void *blob);
#define LCD_COLOR4 2
#define LCD_COLOR8 3
#define LCD_COLOR16 4
-
+#define LCD_COLOR32 5
/*----------------------------------------------------------------------*/
#if defined(CONFIG_LCD_INFO_BELOW_LOGO)
# define LCD_INFO_X 0
@@ -385,6 +383,21 @@ int lcd_dt_simplefb_enable_existing_node(void *blob);
# define CONSOLE_COLOR_GREY 14
# define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
+#elif LCD_BPP == LCD_COLOR32
+/*
+ * 32bpp color definitions
+ */
+# define CONSOLE_COLOR_RED 0x00ff0000
+# define CONSOLE_COLOR_GREEN 0x0000ff00
+# define CONSOLE_COLOR_YELLOW 0x00ffff00
+# define CONSOLE_COLOR_BLUE 0x000000ff
+# define CONSOLE_COLOR_MAGENTA 0x00ff00ff
+# define CONSOLE_COLOR_CYAN 0x0000ffff
+# define CONSOLE_COLOR_GREY 0x00aaaaaa
+# define CONSOLE_COLOR_BLACK 0x00000000
+# define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest*/
+# define NBYTES(bit_code) (NBITS(bit_code) >> 3)
+
#else
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH] Add support for 32-bit organized framebuffers
2014-03-06 13:53 [U-Boot] [PATCH] Add support for 32-bit organized framebuffers Hannes Petermaier
@ 2014-03-06 19:41 ` Gerhard Sittig
2014-03-07 17:55 ` [U-Boot] [PATCH v2] " Hannes Petermaier
1 sibling, 0 replies; 4+ messages in thread
From: Gerhard Sittig @ 2014-03-06 19:41 UTC (permalink / raw)
To: u-boot
On Thu, Mar 06, 2014 at 14:53 +0100, Hannes Petermaier wrote:
>
> - Adds support for 32-bit organized framebuffers to the LCD-framework.
> - cleaned up unused functions
These are two unrelated changes, and should be kept in two
individual commits (usually the cleanup first, the feature change
next).
virtually yours
Gerhard Sittig
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v2] Add support for 32-bit organized framebuffers
2014-03-06 13:53 [U-Boot] [PATCH] Add support for 32-bit organized framebuffers Hannes Petermaier
2014-03-06 19:41 ` Gerhard Sittig
@ 2014-03-07 17:55 ` Hannes Petermaier
2014-08-11 13:55 ` Anatolij Gustschin
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Petermaier @ 2014-03-07 17:55 UTC (permalink / raw)
To: u-boot
- Adds support for 32-bit organized framebuffers to the LCD-framework.
Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
Cc: agust at denx.de
---
Changes for v2:
- separated from 'function-cleanup' changes
---
common/lcd.c | 35 ++++++++++++++++++++++++++++++++---
include/lcd.h | 17 ++++++++++++++++-
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c
index 3f73541..e552340 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -94,7 +94,8 @@
#if LCD_BPP == LCD_MONOCHROME
# define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
(c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
-#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
+#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
+ (LCD_BPP == LCD_COLOR32)
# define COLOR_MASK(c) (c)
#else
# error Unsupported LCD BPP.
@@ -163,10 +164,20 @@ static void console_scrollup(void)
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
/* Clear the last rows */
+#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
COLOR_MASK(lcd_color_bg),
CONSOLE_ROW_SIZE * rows);
-
+#else
+ u32 *ppix = lcd_console_address +
+ CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
+ u32 i;
+ for (i = 0;
+ i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
lcd_sync();
console_row -= rows;
}
@@ -284,13 +295,15 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
ushort off = x * (1 << LCD_BPP) % 8;
#endif
- dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+ dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
int i;
#if LCD_BPP == LCD_COLOR16
ushort *d = (ushort *)dest;
+#elif LCD_BPP == LCD_COLOR32
+ u32 *d = (u32 *)dest;
#else
uchar *d = dest;
#endif
@@ -323,6 +336,12 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
+#elif LCD_BPP == LCD_COLOR32
+ for (c = 0; c < 8; ++c) {
+ *d++ = (bits & 0x80) ?
+ lcd_color_fg : lcd_color_bg;
+ bits <<= 1;
+ }
#endif
}
#if LCD_BPP == LCD_MONOCHROME
@@ -452,9 +471,19 @@ void lcd_clear(void)
test_pattern();
#else
/* set framebuffer to background color */
+#if (LCD_BPP != LCD_COLOR32)
memset((char *)lcd_base,
COLOR_MASK(lcd_color_bg),
lcd_line_length * panel_info.vl_row);
+#else
+ u32 *ppix = lcd_base;
+ u32 i;
+ for (i = 0;
+ i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
+ i++) {
+ *ppix++ = COLOR_MASK(lcd_color_bg);
+ }
+#endif
#endif
/* Paint the logo and retrieve LCD base address */
debug("[LCD] Drawing the logo...\n");
diff --git a/include/lcd.h b/include/lcd.h
index d1cb6b1..df707f6 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -332,7 +332,7 @@ int lcd_dt_simplefb_enable_existing_node(void *blob);
#define LCD_COLOR4 2
#define LCD_COLOR8 3
#define LCD_COLOR16 4
-
+#define LCD_COLOR32 5
/*----------------------------------------------------------------------*/
#if defined(CONFIG_LCD_INFO_BELOW_LOGO)
# define LCD_INFO_X 0
@@ -383,6 +383,21 @@ int lcd_dt_simplefb_enable_existing_node(void *blob);
# define CONSOLE_COLOR_GREY 14
# define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
+#elif LCD_BPP == LCD_COLOR32
+/*
+ * 32bpp color definitions
+ */
+# define CONSOLE_COLOR_RED 0x00ff0000
+# define CONSOLE_COLOR_GREEN 0x0000ff00
+# define CONSOLE_COLOR_YELLOW 0x00ffff00
+# define CONSOLE_COLOR_BLUE 0x000000ff
+# define CONSOLE_COLOR_MAGENTA 0x00ff00ff
+# define CONSOLE_COLOR_CYAN 0x0000ffff
+# define CONSOLE_COLOR_GREY 0x00aaaaaa
+# define CONSOLE_COLOR_BLACK 0x00000000
+# define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest*/
+# define NBYTES(bit_code) (NBITS(bit_code) >> 3)
+
#else
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH v2] Add support for 32-bit organized framebuffers
2014-03-07 17:55 ` [U-Boot] [PATCH v2] " Hannes Petermaier
@ 2014-08-11 13:55 ` Anatolij Gustschin
0 siblings, 0 replies; 4+ messages in thread
From: Anatolij Gustschin @ 2014-08-11 13:55 UTC (permalink / raw)
To: u-boot
On Fri, 7 Mar 2014 18:55:40 +0100
Hannes Petermaier <oe5hpm@oevsv.at> wrote:
> - Adds support for 32-bit organized framebuffers to the LCD-framework.
>
> Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
> Cc: agust at denx.de
> ---
> Changes for v2:
> - separated from 'function-cleanup' changes
> ---
> common/lcd.c | 35 ++++++++++++++++++++++++++++++++---
> include/lcd.h | 17 ++++++++++++++++-
> 2 files changed, 48 insertions(+), 4 deletions(-)
applied to u-boot-video/master. Thanks!
Anatolij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-11 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 13:53 [U-Boot] [PATCH] Add support for 32-bit organized framebuffers Hannes Petermaier
2014-03-06 19:41 ` Gerhard Sittig
2014-03-07 17:55 ` [U-Boot] [PATCH v2] " Hannes Petermaier
2014-08-11 13:55 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox