From 7b4d513e222fb717417ae3e67314651528a93d0e Mon Sep 17 00:00:00 2001 From: joevt Date: Sun, 3 Dec 2023 01:25:08 -0800 Subject: [PATCH] videoctrl: Add change resolution support. PDM defaults to 640x480. If you set --mon_id to MacRGB12in then it would draw 512x384 inside a 640x480 window. If you set --mon_id to Multiscan20in then it would try to draw 832x624 inside a 640x480 window and crash. If you set the Monitors control panel to switch multiscan display from 640x480 to 832x624 and restart then it would crash. Now it will correctly change the window size every time the mode changes. --- devices/video/display_sdl.cpp | 1 - devices/video/videoctrl.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/devices/video/display_sdl.cpp b/devices/video/display_sdl.cpp index 17df446..e1b322a 100644 --- a/devices/video/display_sdl.cpp +++ b/devices/video/display_sdl.cpp @@ -74,7 +74,6 @@ bool Display::configure(int width, int height) { is_initialization = true; } else { // resize display window SDL_SetWindowSize(impl->display_wnd, width, height); - impl->resizing = true; } if (impl->disp_texture) diff --git a/devices/video/videoctrl.cpp b/devices/video/videoctrl.cpp index b26b5ff..bfd309c 100644 --- a/devices/video/videoctrl.cpp +++ b/devices/video/videoctrl.cpp @@ -79,6 +79,8 @@ void VideoCtrlBase::update_screen() } void VideoCtrlBase::start_refresh_task() { + this->display.configure(this->active_width, this->active_height); + uint64_t refresh_interval = static_cast(1.0f / refresh_rate * NS_PER_SEC + 0.5); this->refresh_task_id = TimerManager::get_instance()->add_cyclic_timer( refresh_interval,