Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Issue 1870323002: Mac h264: Plug GL program leak (Closed)

Created:
4 years, 8 months ago by ccameron
Modified:
4 years, 8 months ago
CC:
chromium-reviews, sandersd (OOO until July 31)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac h264: Plug GL program leak The state for YUV to RGB conversion for GLImageIOSurface is stored in the GLImageIOSurface object. This is objectionable because - This means every GLImage object will re-create all shaders - For hardware decode, we create a new GLImage for every decoded frame, which means allocating a shader for every frame. - It is not clear which CGLContextObj the GL objects are associated with. - For hardware decode, we do not specify that a GL context is current when we free GLImages, so we end up leaking one GL program every frame. - This memory leak ends up causing GL context destroy to take more than ten seconds, causing a GPU hang when the GL context is destroyed. Move the program object into an RGBConverter class. Keep a global registry of RGBConverter classes for each CGLContextObj, and share RGBConverter objects across GLImages. Make the RGBConverter always destroy its objects when it is destroyed. It can do this because it retains the CGLContextObj that was used to allocate them. This could be better in that a pathological user of GLImages could still cause the RGBConverter to be created and destroyed every frame. BUG=598388, 599314 Committed: https://crrev.com/c9295d4075c1e4a32977c446ab9734a88abf8391 Cr-Commit-Position: refs/heads/master@{#386757}

Patch Set 1 #

Total comments: 12

Patch Set 2 : Incorporate review feedback #

Total comments: 2

Patch Set 3 : Add thread checker #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -107 lines) Patch
M ui/gl/gl_image_io_surface.h View 2 chunks +5 lines, -7 lines 0 comments Download
M ui/gl/gl_image_io_surface.mm View 1 2 4 chunks +168 lines, -100 lines 0 comments Download

Messages

Total messages: 26 (6 generated)
ccameron
ptal. We shot down the idea of an RGBAConverter in a previous patch. Given that ...
4 years, 8 months ago (2016-04-09 00:41:07 UTC) #3
Daniele Castagna
On 2016/04/09 at 00:41:07, ccameron wrote: > ptal. > > We shot down the idea ...
4 years, 8 months ago (2016-04-09 01:02:23 UTC) #4
ccameron
On 2016/04/09 01:02:23, Daniele Castagna wrote: > On 2016/04/09 at 00:41:07, ccameron wrote: > > ...
4 years, 8 months ago (2016-04-09 01:26:59 UTC) #5
Daniele Castagna
https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm#newcode221 ui/gl/gl_image_io_surface.mm:221: CGLContextObj current_context = CGLGetCurrentContext(); Should we DCHECK that current_context ...
4 years, 8 months ago (2016-04-11 19:55:30 UTC) #6
ccameron
Thanks! Updated. https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm#newcode221 ui/gl/gl_image_io_surface.mm:221: CGLContextObj current_context = CGLGetCurrentContext(); On 2016/04/11 19:55:30, ...
4 years, 8 months ago (2016-04-11 20:41:21 UTC) #7
Daniele Castagna
https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm#newcode222 ui/gl/gl_image_io_surface.mm:222: auto found = g_rgb_converters.Get().find(current_context); On 2016/04/11 at 20:41:21, ccameron ...
4 years, 8 months ago (2016-04-11 20:56:16 UTC) #8
ccameron
https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm#newcode222 ui/gl/gl_image_io_surface.mm:222: auto found = g_rgb_converters.Get().find(current_context); On 2016/04/11 20:56:16, Daniele Castagna ...
4 years, 8 months ago (2016-04-12 00:34:35 UTC) #9
Daniele Castagna
On 2016/04/12 at 00:34:35, ccameron wrote: > https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm > File ui/gl/gl_image_io_surface.mm (right): > > https://codereview.chromium.org/1870323002/diff/1/ui/gl/gl_image_io_surface.mm#newcode222 ...
4 years, 8 months ago (2016-04-12 01:16:04 UTC) #10
ccameron
On 2016/04/12 01:16:04, Daniele Castagna wrote: > On 2016/04/12 at 00:34:35, ccameron wrote: > > ...
4 years, 8 months ago (2016-04-12 03:21:09 UTC) #11
Daniele Castagna
On 2016/04/12 at 03:21:09, ccameron wrote: > On 2016/04/12 01:16:04, Daniele Castagna wrote: > > ...
4 years, 8 months ago (2016-04-12 04:56:26 UTC) #12
ccameron
On 2016/04/12 04:56:26, Daniele Castagna wrote: > On 2016/04/12 at 03:21:09, ccameron wrote: > > ...
4 years, 8 months ago (2016-04-12 06:28:22 UTC) #13
ccameron
reveman@, did you want to take a look at this as well?
4 years, 8 months ago (2016-04-12 15:42:48 UTC) #14
reveman
https://codereview.chromium.org/1870323002/diff/20001/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/20001/ui/gl/gl_image_io_surface.mm#newcode225 ui/gl/gl_image_io_surface.mm:225: if (found != g_rgb_converters.Get().end()) This isn't thread safe. Can ...
4 years, 8 months ago (2016-04-12 15:51:03 UTC) #15
ccameron
Thanks -- updated. https://codereview.chromium.org/1870323002/diff/20001/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1870323002/diff/20001/ui/gl/gl_image_io_surface.mm#newcode225 ui/gl/gl_image_io_surface.mm:225: if (found != g_rgb_converters.Get().end()) On 2016/04/12 ...
4 years, 8 months ago (2016-04-12 16:16:59 UTC) #16
ccameron
I'm getting pressure from PMs to get this landed for a build at 5pm today ...
4 years, 8 months ago (2016-04-12 18:39:33 UTC) #17
reveman
lgtm
4 years, 8 months ago (2016-04-12 18:44:44 UTC) #18
ccameron
Thanks!!
4 years, 8 months ago (2016-04-12 18:52:27 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1870323002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1870323002/40001
4 years, 8 months ago (2016-04-12 18:53:13 UTC) #22
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 8 months ago (2016-04-12 19:29:38 UTC) #24
commit-bot: I haz the power
4 years, 8 months ago (2016-04-12 19:30:50 UTC) #26
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/c9295d4075c1e4a32977c446ab9734a88abf8391
Cr-Commit-Position: refs/heads/master@{#386757}

Powered by Google App Engine
This is Rietveld 408576698