aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-12-10 15:41:15 -0500
committerTom Rini <trini@konsulko.com>2019-12-10 15:41:15 -0500
commitfd4b8f813f11879bb38a0d3a5839279e85325476 (patch)
tree1710610287d3903ac05922c05e59c7e9abd885c9 /drivers
parent520f9559020894950d4e962aba52220c8a1d6bfe (diff)
parent2cc393f32fd9ffcf47f4877e8d1345a7981a0d02 (diff)
downloadu-boot-fd4b8f813f11879bb38a0d3a5839279e85325476.zip
u-boot-fd4b8f813f11879bb38a0d3a5839279e85325476.tar.gz
u-boot-fd4b8f813f11879bb38a0d3a5839279e85325476.tar.bz2
Merge tag 'fixes-for-2020.01' of https://gitlab.denx.de/u-boot/custodians/u-boot-video
- fix crash and board reset when drawing RLE8 bitmaps bigger than the framebuffer resolution - reduce dead code in video and console uclass routines (tested on mx53cx9020, sama5d2_xplained, stm32mp157c-ev1, stm32f746-disco, stm32f769-disco and wandboard)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/Kconfig8
-rw-r--r--drivers/video/console_normal.c10
-rw-r--r--drivers/video/vidconsole-uclass.c6
-rw-r--r--drivers/video/video-uclass.c4
-rw-r--r--drivers/video/video_bmp.c12
5 files changed, 24 insertions, 16 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 805713c..4cde0ac 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -38,7 +38,7 @@ config BACKLIGHT_GPIO
config VIDEO_BPP8
bool "Support 8-bit-per-pixel displays"
depends on DM_VIDEO
- default y if DM_VIDEO
+ default n
help
Support drawing text and bitmaps onto a 8-bit-per-pixel display.
Enabling this will include code to support this display. Without
@@ -48,7 +48,7 @@ config VIDEO_BPP8
config VIDEO_BPP16
bool "Support 16-bit-per-pixel displays"
depends on DM_VIDEO
- default y if DM_VIDEO
+ default n
help
Support drawing text and bitmaps onto a 16-bit-per-pixel display.
Enabling this will include code to support this display. Without
@@ -58,7 +58,7 @@ config VIDEO_BPP16
config VIDEO_BPP32
bool "Support 32-bit-per-pixel displays"
depends on DM_VIDEO
- default y if DM_VIDEO
+ default n
help
Support drawing text and bitmaps onto a 32-bit-per-pixel display.
Enabling this will include code to support this display. Without
@@ -68,7 +68,7 @@ config VIDEO_BPP32
config VIDEO_ANSI
bool "Support ANSI escape sequences in video console"
depends on DM_VIDEO
- default y if DM_VIDEO
+ default n
help
Enable ANSI escape sequence decoding for a more fully functional
console.
diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 7f01ee9..2f25af7 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -16,9 +16,9 @@
static int console_normal_set_row(struct udevice *dev, uint row, int clr)
{
struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
- void *line;
- int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
- int i;
+ void * __maybe_unused line;
+ int __maybe_unused pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
+ int __maybe_unused i;
line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
switch (vid_priv->bpix) {
@@ -76,7 +76,7 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
struct video_priv *vid_priv = dev_get_uclass_priv(vid);
- int i, row;
+ int __maybe_unused i, row;
void *line = vid_priv->fb + y * vid_priv->line_length +
VID_TO_PIXEL(x_frac) * VNBYTES(vid_priv->bpix);
@@ -85,7 +85,7 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
unsigned int idx = (u8)ch * VIDEO_FONT_HEIGHT + row;
- uchar bits = video_fontdata[idx];
+ uchar __maybe_unused bits = video_fontdata[idx];
switch (vid_priv->bpix) {
#ifdef CONFIG_VIDEO_BPP8
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index af88588..c690ece 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -116,6 +116,7 @@ static void vidconsole_newline(struct udevice *dev)
video_sync(dev->parent, false);
}
+#if CONFIG_IS_ENABLED(VIDEO_BPP16) || CONFIG_IS_ENABLED(VIDEO_BPP32)
static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0x00, 0x00 }, /* black */
{ 0xc0, 0x00, 0x00 }, /* red */
@@ -134,18 +135,23 @@ static const struct vid_rgb colors[VID_COLOR_COUNT] = {
{ 0x00, 0xff, 0xff }, /* bright cyan */
{ 0xff, 0xff, 0xff }, /* white */
};
+#endif
u32 vid_console_color(struct video_priv *priv, unsigned int idx)
{
switch (priv->bpix) {
+#if CONFIG_IS_ENABLED(VIDEO_BPP16)
case VIDEO_BPP16:
return ((colors[idx].r >> 3) << 11) |
((colors[idx].g >> 2) << 5) |
((colors[idx].b >> 3) << 0);
+#endif
+#if CONFIG_IS_ENABLED(VIDEO_BPP32)
case VIDEO_BPP32:
return (colors[idx].r << 16) |
(colors[idx].g << 8) |
(colors[idx].b << 0);
+#endif
default:
/*
* For unknown bit arrangements just support
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f660c52..5ea7568 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -92,6 +92,7 @@ int video_clear(struct udevice *dev)
struct video_priv *priv = dev_get_uclass_priv(dev);
switch (priv->bpix) {
+#ifdef CONFIG_VIDEO_BPP16
case VIDEO_BPP16: {
u16 *ppix = priv->fb;
u16 *end = priv->fb + priv->fb_size;
@@ -100,6 +101,8 @@ int video_clear(struct udevice *dev)
*ppix++ = priv->colour_bg;
break;
}
+#endif
+#ifdef CONFIG_VIDEO_BPP32
case VIDEO_BPP32: {
u32 *ppix = priv->fb;
u32 *end = priv->fb + priv->fb_size;
@@ -108,6 +111,7 @@ int video_clear(struct udevice *dev)
*ppix++ = priv->colour_bg;
break;
}
+#endif
default:
memset(priv->fb, priv->colour_bg, priv->fb_size);
break;
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 193f37d..8768228 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -40,18 +40,16 @@ static void draw_encoded_bitmap(ushort **fbp, ushort col, int cnt)
static void video_display_rle8_bitmap(struct udevice *dev,
struct bmp_image *bmp, ushort *cmap,
- uchar *fb, int x_off, int y_off)
+ uchar *fb, int x_off, int y_off,
+ ulong width, ulong height)
{
struct video_priv *priv = dev_get_uclass_priv(dev);
uchar *bmap;
- ulong width, height;
ulong cnt, runlen;
int x, y;
int decode = 1;
debug("%s\n", __func__);
- width = get_unaligned_le32(&bmp->header.width);
- height = get_unaligned_le32(&bmp->header.height);
bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
x = 0;
@@ -157,8 +155,8 @@ __weak void fb_put_word(uchar **fb, uchar **from)
static void video_splash_align_axis(int *axis, unsigned long panel_size,
unsigned long picture_size)
{
- unsigned long panel_picture_delta = panel_size - picture_size;
- unsigned long axis_alignment;
+ long panel_picture_delta = panel_size - picture_size;
+ long axis_alignment;
if (*axis == BMP_ALIGN_CENTER)
axis_alignment = panel_picture_delta / 2;
@@ -277,7 +275,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
return -EPROTONOSUPPORT;
}
video_display_rle8_bitmap(dev, bmp, cmap_base, fb, x,
- y);
+ y, width, height);
break;
}
#endif