From 6be88c72828923f2df8c441ee12f5829e0d06f32 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 3 Feb 2020 07:36:13 -0700 Subject: sandbox: sdl: Add an option to double the screen size On high-DPI displays U-Boot's LCD window can look very small. Add a -K flag to expand it to make things easier to read, while still using the existing resolution internally. Signed-off-by: Simon Glass Reviewed-by: Anatolij Gustschin --- arch/sandbox/cpu/sdl.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'arch/sandbox/cpu/sdl.c') diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index 58a9cc8168e..6416cab96c1 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -30,6 +30,8 @@ struct buf_info { * * @width: Width of simulated LCD display * @height: Height of simulated LCD display + * @vis_width: Visible width (may be larger to allow for scaling up) + * @vis_height: Visible height (may be larger to allow for scaling up) * @depth: Depth of the display in bits per pixel (16 or 32) * @pitch: Number of bytes per line of the display * @sample_rate: Current sample rate for audio @@ -46,6 +48,8 @@ struct buf_info { static struct sdl_info { int width; int height; + int vis_width; + int vis_height; int depth; int pitch; uint sample_rate; @@ -94,7 +98,8 @@ static int sandbox_sdl_ensure_init(void) return 0; } -int sandbox_sdl_init_display(int width, int height, int log2_bpp) +int sandbox_sdl_init_display(int width, int height, int log2_bpp, + bool double_size) { struct sandbox_state *state = state_get_current(); int err; @@ -110,11 +115,19 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp) } sdl.width = width; sdl.height = height; + if (double_size) { + sdl.vis_width = sdl.width * 2; + sdl.vis_height = sdl.height * 2; + } else { + sdl.vis_width = sdl.width; + sdl.vis_height = sdl.height; + } + sdl.depth = 1 << log2_bpp; sdl.pitch = sdl.width * sdl.depth / 8; SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - sdl.width, sdl.height, 0); + sdl.vis_width, sdl.vis_height, 0); if (!screen) { printf("Unable to initialise SDL screen: %s\n", SDL_GetError()); -- cgit v1.2.3