diff --git a/commands/splash.c b/commands/splash.c index 29e30ae..15b296b 100644 --- a/commands/splash.c +++ b/commands/splash.c @@ -15,7 +15,6 @@ int opt; char *fbdev = "/dev/fb0"; char *image_file; - int offscreen = 0; u32 bg_color = 0x00000000; bool do_bg = false; void *buf; @@ -42,8 +41,6 @@ case 'y': s.y = simple_strtoul(optarg, NULL, 0); break; - case 'o': - offscreen = 1; } } @@ -53,7 +50,7 @@ } image_file = argv[optind]; - sc = fb_open(fbdev, offscreen); + sc = fb_open(fbdev); if (IS_ERR(sc)) { perror("fd_open"); return PTR_ERR(sc); @@ -86,7 +83,6 @@ BAREBOX_CMD_HELP_OPT ("-x XOFFS", "x offset (default center)") BAREBOX_CMD_HELP_OPT ("-y YOFFS", "y offset (default center)") BAREBOX_CMD_HELP_OPT ("-b COLOR", "background color in 0xttrrggbb") -BAREBOX_CMD_HELP_OPT ("-o\t", "render offscreen") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(splash) diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c index b798307..8805b55 100644 --- a/drivers/video/fbconsole.c +++ b/drivers/video/fbconsole.c @@ -376,7 +376,7 @@ if (ret) return ret; - priv->sc = fb_create_screen(fb, 0); + priv->sc = fb_create_screen(fb); if (IS_ERR(priv->sc)) return PTR_ERR(priv->sc); diff --git a/include/gui/graphic_utils.h b/include/gui/graphic_utils.h index ab8c3fc..ff4d9a0 100644 --- a/include/gui/graphic_utils.h +++ b/include/gui/graphic_utils.h @@ -19,8 +19,8 @@ void gu_set_rgb_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b); void gu_set_rgba_pixel(struct fb_info *info, void *adr, u8 r, u8 g, u8 b, u8 a); void gu_memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size); -struct screen *fb_create_screen(struct fb_info *info, bool offscreen); -struct screen *fb_open(const char *fbdev, bool offscreen); +struct screen *fb_create_screen(struct fb_info *info); +struct screen *fb_open(const char *fbdev); void fb_close(struct screen *sc); void gu_screen_blit(struct screen *sc); void gu_invert_area(struct fb_info *info, void *buf, int startx, int starty, int width, diff --git a/include/gui/gui.h b/include/gui/gui.h index 03e60aa..133149b 100644 --- a/include/gui/gui.h +++ b/include/gui/gui.h @@ -23,16 +23,12 @@ struct surface s; void *fb; - void *offscreenbuf; int fbsize; }; static inline void *gui_screen_render_buffer(struct screen *sc) { - if (sc->offscreenbuf) - return sc->offscreenbuf; - return sc->fb; + return fb_get_screen_base(sc->info); } - #endif /* __GUI_H__ */ diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c index f928ee1..b57b4a1 100644 --- a/lib/gui/graphic_utils.c +++ b/lib/gui/graphic_utils.c @@ -245,7 +245,7 @@ } } -struct screen *fb_create_screen(struct fb_info *info, bool offscreen) +struct screen *fb_create_screen(struct fb_info *info) { struct screen *sc; @@ -257,19 +257,12 @@ sc->s.height = info->yres; sc->fbsize = info->line_length * sc->s.height; sc->fb = info->screen_base; - - if (offscreen) { - /* - * Don't fail if malloc fails, just continue rendering directly - * on the framebuffer - */ - sc->offscreenbuf = malloc(sc->fbsize); - } + sc->info = info; return sc; } -struct screen *fb_open(const char * fbdev, bool offscreen) +struct screen *fb_open(const char * fbdev) { int fd, ret; struct fb_info *info; @@ -286,7 +279,7 @@ goto failed_screeninfo; } - sc = fb_create_screen(info, offscreen); + sc = fb_create_screen(info); if (IS_ERR(sc)) { ret = PTR_ERR(sc); goto failed_create; @@ -298,7 +291,6 @@ return sc; failed_create: - free(sc->offscreenbuf); free(sc); failed_screeninfo: close(fd); @@ -308,8 +300,6 @@ void fb_close(struct screen *sc) { - free(sc->offscreenbuf); - if (sc->fd > 0) close(sc->fd); @@ -318,8 +308,8 @@ void gu_screen_blit(struct screen *sc) { - if (!sc->offscreenbuf) - return; + struct fb_info *info = sc->info; - memcpy(sc->fb, sc->offscreenbuf, sc->fbsize); + if (info->screen_base_shadow) + memcpy(info->screen_base, info->screen_base_shadow, sc->fbsize); }