diff --git a/repos/os/src/drivers/framebuffer/sdl/fb_sdl.cc b/repos/os/src/drivers/framebuffer/sdl/fb_sdl.cc index e61b05bc2..5473c2b62 100644 --- a/repos/os/src/drivers/framebuffer/sdl/fb_sdl.cc +++ b/repos/os/src/drivers/framebuffer/sdl/fb_sdl.cc @@ -22,16 +22,27 @@ #include #include #include +#include /* local includes */ #include +/** + * Read integer value from config attribute + */ +void config_arg(const char *attr, long *value) +{ + try { Genode::config()->xml_node().attribute(attr).value(value); } + catch (...) { } +} + + /* * Variables for the libSDL output window */ static SDL_Surface *screen; -static int scr_width = 1024, scr_height = 768; +static long scr_width = 1024, scr_height = 768; static Framebuffer::Mode::Format scr_format = Framebuffer::Mode::RGB565; /* @@ -113,9 +124,8 @@ extern "C" int main(int, char**) using namespace Genode; using namespace Framebuffer; - /* - * FIXME: Read configuration (screen parameters) - */ + config_arg("width", &scr_width); + config_arg("height", &scr_height); /* * Initialize libSDL window @@ -130,7 +140,7 @@ extern "C" int main(int, char**) screen = SDL_SetVideoMode(scr_width, scr_height, bpp*8, SDL_SWSURFACE); SDL_ShowCursor(0); - Genode::printf("creating virtual framebuffer for mode %dx%d@%zd\n", + Genode::printf("creating virtual framebuffer for mode %ldx%ld@%zd\n", scr_width, scr_height, bpp*8); /* diff --git a/repos/os/src/drivers/framebuffer/sdl/target.mk b/repos/os/src/drivers/framebuffer/sdl/target.mk index 33f046170..94106e429 100644 --- a/repos/os/src/drivers/framebuffer/sdl/target.mk +++ b/repos/os/src/drivers/framebuffer/sdl/target.mk @@ -1,5 +1,5 @@ TARGET = fb_sdl -LIBS = lx_hybrid +LIBS = lx_hybrid config REQUIRES = linux sdl SRC_CC = fb_sdl.cc input.cc LX_LIBS = sdl