summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-07-13 08:14:39 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-20 07:11:21 +0200
commitcfec57d89808343bb6b043955e39411a0e29be5d (patch)
treedf172524d9d5bef3d15e8c461bf395e90d17f635 /commands
parent772ab4f1722c5d166fe0677aa779e7b8628f0a79 (diff)
downloadbarebox-cfec57d89808343bb6b043955e39411a0e29be5d.tar.gz
barebox-cfec57d89808343bb6b043955e39411a0e29be5d.tar.xz
graphics_utils: Let fb_open allocate the screen
Allocate the screen dynamically in fb_open. This opens the way to create a fb_create_screen function which takes a struct fb_info * instead of a filename. This is suitable for the framebuffer console which already has a struct fb_info *. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/splash.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/commands/splash.c b/commands/splash.c
index 04562e303a..90f0a0cdf2 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -10,9 +10,9 @@
static int do_splash(int argc, char *argv[])
{
struct surface s;
- struct screen sc;
+ struct screen *sc;
int ret = 0;
- int opt, fd;
+ int opt;
char *fbdev = "/dev/fb0";
char *image_file;
int offscreen = 0;
@@ -20,7 +20,6 @@ static int do_splash(int argc, char *argv[])
bool do_bg = false;
memset(&s, 0, sizeof(s));
- memset(&sc, 0, sizeof(sc));
s.x = -1;
s.y = -1;
@@ -53,29 +52,29 @@ static int do_splash(int argc, char *argv[])
}
image_file = argv[optind];
- fd = fb_open(fbdev, &sc, offscreen);
- if (fd < 0) {
+ sc = fb_open(fbdev, offscreen);
+ if (IS_ERR(sc)) {
perror("fd_open");
- return fd;
+ return PTR_ERR(sc);
}
- if (sc.offscreenbuf) {
+ if (sc->offscreenbuf) {
if (do_bg)
- gu_memset_pixel(&sc.info, sc.offscreenbuf, bg_color,
- sc.s.width * sc.s.height);
+ gu_memset_pixel(sc->info, sc->offscreenbuf, bg_color,
+ sc->s.width * sc->s.height);
else
- memcpy(sc.offscreenbuf, sc.fb, sc.fbsize);
+ memcpy(sc->offscreenbuf, sc->fb, sc->fbsize);
} else if (do_bg) {
- gu_memset_pixel(&sc.info, sc.fb, bg_color, sc.s.width * sc.s.height);
+ gu_memset_pixel(sc->info, sc->fb, bg_color, sc->s.width * sc->s.height);
}
- ret = image_renderer_file(&sc, &s, image_file);
+ ret = image_renderer_file(sc, &s, image_file);
if (ret > 0)
ret = 0;
- gu_screen_blit(&sc);
+ gu_screen_blit(sc);
- fb_close(&sc);
+ fb_close(sc);
return ret;
}