From 940f8715141dfb133ff34f6899608a379f8be5ca Mon Sep 17 00:00:00 2001 From: Ho Ming Shun Date: Mon, 6 Sep 2021 14:05:12 +0800 Subject: vo_rpi: fix DISPMANX_UPDATE_HANDLE_T leak Fixes handle leak that happened whenever tvservice callback was invoked. Powering on the TV causes HDMI unplug and attached events to be sent to the tvservice callback. This meant you could only power on/off your TV a finite number of times before you were unable to allocate additional resources from VideoCore (usually resulting in a "Could not get DISPMANX objects." error). Furthermore because the VideoCore kernel driver does not cleanup handles when a process dies, the only way to recover from the leak was to reboot the RPI. --- video/out/vo_rpi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c index 47100285ec..0d89cfa4d3 100644 --- a/video/out/vo_rpi.c +++ b/video/out/vo_rpi.c @@ -804,6 +804,10 @@ static void destroy_dispmanx(struct vo *vo) disable_renderer(vo); destroy_overlays(vo); + if (p->update) + vc_dispmanx_update_submit_sync(p->update); + p->update = 0; + if (p->display) { vc_dispmanx_vsync_callback(p->display, NULL, NULL); vc_dispmanx_display_close(p->display); @@ -856,9 +860,6 @@ static void uninit(struct vo *vo) destroy_dispmanx(vo); - if (p->update) - vc_dispmanx_update_submit_sync(p->update); - if (p->renderer) mmal_component_release(p->renderer); -- cgit v1.2.3