frame buffer init now reads splash screen data from resources

This commit is contained in:
Amy G. Bowersox 2021-08-29 22:24:37 -06:00
parent bda9fc6883
commit c30d15742c

View File

@ -29,11 +29,7 @@
#include "log.h"
#include "fbinit.h"
#include "scode.h"
/* references to splash screen data in splash.o/splash.bin */
extern uint8_t _binary_splash_bin_start[];
extern uint8_t _binary_splash_bin_end;
extern uint8_t _binary_splash_bin_size;
#include "resources.h"
static int fb_fd = -1; /* framebuffer file descriptor */
@ -62,6 +58,8 @@ static void do_cleanup(void)
HRESULT Fb_setup(void)
{
HRESULT hr = S_OK;
HRESULT hr2 = S_OK;
HRSRC splash;
struct fb_fix_screeninfo fixed;
struct fb_var_screeninfo var;
@ -84,7 +82,7 @@ HRESULT Fb_setup(void)
local_info.linebytes = fixed.line_length;
local_info.screenbytes = fixed.smem_len;
/* variable info is used to get scren geometry and color info */
/* variable info is used to get screen geometry and color info */
if (ioctl(fb_fd, FBIOGET_VSCREENINFO, &var))
{
hr = ERRNO_AS_SCODE;
@ -118,8 +116,16 @@ HRESULT Fb_setup(void)
return hr;
}
/* display the splash screen */
memcpy(Fb_Ptr, _binary_splash_bin_start, (size_t)(&_binary_splash_bin_size));
/* The splash screen is in the system resources. Use the resource API to load it straight to the frame buffer. */
hr2 = Rsrc_find_resource(NULL, "splash.bin", NULL, &splash);
if (SUCCEEDED(hr2))
{
ASSERT(Rsrc_sizeof_resource(splash) == fixed.smem_len);
hr2 = Rsrc_read_resource_here(splash, Fb_Ptr, fixed.smem_len, NULL);
Rsrc_free_resource(splash);
}
if (FAILED(hr2))
Log(LWARN, "splash screen rendering failed (%08X)", hr2);
hr = Config_exitfunc(do_cleanup);
if (FAILED(hr))