summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHo Ming Shun <cyph1984@gmail.com>2021-09-06 14:05:12 +0800
committerDudemanguy <random342@airmail.cc>2021-09-28 16:46:52 +0000
commit940f8715141dfb133ff34f6899608a379f8be5ca (patch)
tree31de8b56a372a6c26924e0360b34d342663218a9
parentcc4ada655aae06218b900bb434e3521566394cde (diff)
downloadmpv-940f8715141dfb133ff34f6899608a379f8be5ca.tar.bz2
mpv-940f8715141dfb133ff34f6899608a379f8be5ca.tar.xz
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.
-rw-r--r--video/out/vo_rpi.c7
1 files 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);