summaryrefslogtreecommitdiffstats
path: root/commands/fbtest.c
diff options
context:
space:
mode:
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>2017-10-12 20:52:27 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2017-10-16 09:12:49 +0200
commite69017c868aee07409ea2e031207a6154aa4babe (patch)
treece5d7ff1845249370ad820413c3aa5c364630788 /commands/fbtest.c
parent8973abf57a5302d1dd7c62331d9c20c233fb6638 (diff)
downloadbarebox-e69017c868aee07409ea2e031207a6154aa4babe.tar.gz
fbtest: add solid pattern
This just fills entire screen with single color, as passed in -c argument in RRGGBB format. Suggested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Tested-by: Chris Healy <[1]cphealy@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/fbtest.c')
-rw-r--r--commands/fbtest.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/commands/fbtest.c b/commands/fbtest.c
index ca6ec21..9981c13 100644
--- a/commands/fbtest.c
+++ b/commands/fbtest.c
@@ -9,6 +9,15 @@
#include <linux/gcd.h>
#include <int_sqrt.h>
+static void fbtest_pattern_solid(struct screen *sc, u32 color)
+{
+ const u8 r = (color >> 16) & 0xff;
+ const u8 g = (color >> 8) & 0xff;
+ const u8 b = (color >> 0) & 0xff;
+
+ gu_fill_rectangle(sc, 0, 0, -1, -1, r, g, b, 0xff);
+}
+
static void fbtest_pattern_bars(struct screen *sc, u32 unused)
{
int i;
@@ -122,6 +131,7 @@ static int do_fbtest(int argc, char *argv[])
const char *name;
void (*func) (struct screen *sc, u32 color);
} patterns[] = {
+ { "solid", fbtest_pattern_solid },
{ "geometry", fbtest_pattern_geometry },
{ "bars", fbtest_pattern_bars }
};
@@ -191,8 +201,8 @@ BAREBOX_CMD_HELP_TEXT("This command displays a test pattern on a screen")
BAREBOX_CMD_HELP_TEXT("")
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-d <fbdev>\t", "framebuffer device (default /dev/fb0)")
-BAREBOX_CMD_HELP_OPT ("-c color\t", "color")
-BAREBOX_CMD_HELP_OPT ("-p pattern\t", "pattern name (geometry, bars)")
+BAREBOX_CMD_HELP_OPT ("-c color\t", "color, in hex RRGGBB format")
+BAREBOX_CMD_HELP_OPT ("-p pattern\t", "pattern name (solid, geometry, bars)")
BAREBOX_CMD_HELP_END
BAREBOX_CMD_START(fbtest)