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.
This commit is contained in:
joevt 2023-12-03 01:25:08 -08:00 committed by dingusdev
parent 5b51cd06c0
commit 7b4d513e22
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -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<uint64_t>(1.0f / refresh_rate * NS_PER_SEC + 0.5);
this->refresh_task_id = TimerManager::get_instance()->add_cyclic_timer(
refresh_interval,