aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/sdl.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-07-22 11:15:52 -0400
committerTom Rini <trini@konsulko.com>2021-07-22 11:15:52 -0400
commita15fa1ba67d7b3c8061b515e7713f733fa328018 (patch)
treef7746e2e7a3410043e9ea3f3f7c0a97e2c5e6dbb /arch/sandbox/cpu/sdl.c
parent806734f41b25931798fdf667b5a2ae830229c13f (diff)
parent1b098b3e655451572054ce933a87231ee16f7133 (diff)
Merge tag 'dm-pull-21jul21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
dtoc improvements to show better warnings minor test build fixes sandbox fixes for SDL2 and running TPL bloblist resize feature binman multithreading
Diffstat (limited to 'arch/sandbox/cpu/sdl.c')
-rw-r--r--arch/sandbox/cpu/sdl.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c
index 8102649be3..bef5abd039 100644
--- a/arch/sandbox/cpu/sdl.c
+++ b/arch/sandbox/cpu/sdl.c
@@ -123,6 +123,9 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp,
sdl.vis_height = sdl.height;
}
+ if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"))
+ printf("Unable to init hinting: %s", SDL_GetError());
+
sdl.depth = 1 << log2_bpp;
sdl.pitch = sdl.width * sdl.depth / 8;
SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED,
@@ -164,8 +167,29 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp,
int sandbox_sdl_sync(void *lcd_base)
{
+ struct SDL_Rect rect;
+ int ret;
+
+ if (!sdl.texture)
+ return 0;
+ SDL_RenderClear(sdl.renderer);
SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch);
- SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL);
+ ret = SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL);
+ if (ret) {
+ printf("SDL copy %d: %s\n", ret, SDL_GetError());
+ return -EIO;
+ }
+
+ /*
+ * On some machines this does not appear. Draw an empty rectangle which
+ * seems to fix that.
+ */
+ rect.x = 0;
+ rect.y = 0;
+ rect.w = 0;
+ rect.h = 0;
+ SDL_RenderDrawRect(sdl.renderer, &rect);
+
SDL_RenderPresent(sdl.renderer);
sandbox_sdl_poll_events();