From 9696cdde7f3d5980a59be00e9129dca62f5d6e75 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Laurini Date: Sat, 3 Feb 2024 19:38:48 -0300 Subject: [PATCH 1/2] Force fullscreen when using the KMSDRM driver The KMSDRM video driver switches to a low resolution unless fullscreen is enabled - so we force it in that case. We also ignore any requests to switch to "windowed" mode. --- app/src/screen.c | 8 +++++++- app/src/screen.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/screen.c b/app/src/screen.c index 091001bcbf..d713191877 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -362,12 +362,14 @@ sc_screen_init(struct sc_screen *screen, screen->maximized = false; screen->minimized = false; screen->mouse_capture_key_pressed = 0; + screen->is_kmsdrm = strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0; screen->req.x = params->window_x; screen->req.y = params->window_y; screen->req.width = params->window_width; screen->req.height = params->window_height; - screen->req.fullscreen = params->fullscreen; + // The kmsdrm video driver switches to a low resolution on "windowed" mode + screen->req.fullscreen = screen->is_kmsdrm ? true : params->fullscreen; screen->req.start_fps_counter = params->start_fps_counter; bool ok = sc_frame_buffer_init(&screen->fb); @@ -657,6 +659,10 @@ sc_screen_update_frame(struct sc_screen *screen) { void sc_screen_switch_fullscreen(struct sc_screen *screen) { + if (screen->is_kmsdrm && screen->fullscreen) { + LOGD("Ignored mode switch"); + } + uint32_t new_mode = screen->fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP; if (SDL_SetWindowFullscreen(screen->window, new_mode)) { LOGW("Could not switch fullscreen mode: %s", SDL_GetError()); diff --git a/app/src/screen.h b/app/src/screen.h index 46591be5cc..bc597cee82 100644 --- a/app/src/screen.h +++ b/app/src/screen.h @@ -58,6 +58,7 @@ struct sc_screen { bool fullscreen; bool maximized; bool minimized; + bool is_kmsdrm; // To enable/disable mouse capture, a mouse capture key (LALT, LGUI or // RGUI) must be pressed. This variable tracks the pressed capture key. From a3bfef6c1c13572703cfb1e41c28aed83478bcfd Mon Sep 17 00:00:00 2001 From: Luiz Henrique Laurini Date: Sun, 4 Feb 2024 19:19:05 -0300 Subject: [PATCH 2/2] Fix mode switch not actually being ignored --- app/src/screen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/screen.c b/app/src/screen.c index d713191877..e4fa34991c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -661,6 +661,7 @@ void sc_screen_switch_fullscreen(struct sc_screen *screen) { if (screen->is_kmsdrm && screen->fullscreen) { LOGD("Ignored mode switch"); + return; } uint32_t new_mode = screen->fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP;