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

Issue 1862183003: Mac h264: Work around CGLContext+VTDecompresionSession deadlock (Closed)

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

Description

Mac h264: Work around CGLContext+VTDecompresionSession deadlock When we converted h264 to be decoded as 4:2:0 instead of 4:2:2, we noticed a spike in GPU crash rates, in particular, in CGLDestroyContext. Many of these crashes had other threads in VideoToolbox in what appears to be a deadlock. Part of the change from 4:2:2 to 4:2:0 is adding a path where we will do manual YUV->RGB conversion if we cannot display directly with CoreAnimation. In the process of this conversion, we bind the planes of the IOSurface allocated by VideoToolbox to OpenGL textures. We leave these bound until the GLImage is destroyed. My guess here is that the destruction of these resources in the driver is being deferred until CGLDestroyContext (we have seen that IOSurfaces can be kept around in the OpenGL driver long after they are unbound in crbug.com/158469), whereupon they are triggering a deadlock with VideoToolbox, which may be re-using them. This patch forces us to destroy the OpenGL texture objects that reference the IOSurfaces immediately after use (and while their owning CVPixelBuffer is still retained), which will hopefully avoid the conflict with VideoToolbox. Note that this is a speculative fix. BUG=598388 Committed: https://crrev.com/f838f5f4880b9f4fe54e6e10812708c1c89b23d7 Cr-Commit-Position: refs/heads/master@{#385690}

Patch Set 1 #

Patch Set 2 : Add me as ui owner for Mac #

Total comments: 10

Patch Set 3 : Reduce scope #

Total comments: 1

Patch Set 4 : Switch back to BindBlock #

Patch Set 5 : format #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -8 lines) Patch
M ui/OWNERS View 1 1 chunk +1 line, -0 lines 0 comments Download
M ui/gl/gl_image_io_surface.h View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M ui/gl/gl_image_io_surface.mm View 1 2 3 4 6 chunks +17 lines, -7 lines 0 comments Download

Messages

Total messages: 20 (7 generated)
ccameron
Adding dcastagna@ for YUV->RGB change. I tried to get the diffs to be minimal, but ...
4 years, 8 months ago (2016-04-06 19:57:57 UTC) #2
Avi (use Gerrit)
lgtm Owner stamp; I don't know this GL stuff to say. https://codereview.chromium.org/1862183003/diff/20001/ui/OWNERS File ui/OWNERS (right): ...
4 years, 8 months ago (2016-04-06 20:16:50 UTC) #3
Daniele Castagna
CCing reveman@ since he suggested to avoid adding an explicit struct for the converter in ...
4 years, 8 months ago (2016-04-06 20:36:58 UTC) #4
Daniele Castagna
Actually ccing reveman@
4 years, 8 months ago (2016-04-06 20:37:17 UTC) #5
reveman
As a speculative fix, I'd much rather have a minimal patch than something that also ...
4 years, 8 months ago (2016-04-06 20:46:21 UTC) #7
ccameron
I'd much prefer to change this to have 1 GL shader per GLContextObj -- but ...
4 years, 8 months ago (2016-04-06 22:35:21 UTC) #9
reveman
lgtm, thanks! https://codereview.chromium.org/1862183003/diff/40001/ui/OWNERS File ui/OWNERS (right): https://codereview.chromium.org/1862183003/diff/40001/ui/OWNERS#newcode7 ui/OWNERS:7: ccameron@chromium.org sgtm but please keep me in ...
4 years, 8 months ago (2016-04-07 01:31:47 UTC) #10
Daniele Castagna
LGTM https://codereview.chromium.org/1862183003/diff/20001/ui/gl/gl_image_io_surface.mm File ui/gl/gl_image_io_surface.mm (right): https://codereview.chromium.org/1862183003/diff/20001/ui/gl/gl_image_io_surface.mm#newcode379 ui/gl/gl_image_io_surface.mm:379: base::ScopedClosureRunner destroy_resources_runner(base::BindBlock(^{ On 2016/04/06 at 22:35:21, ccameron wrote: ...
4 years, 8 months ago (2016-04-07 01:35:07 UTC) #11
ccameron
Thanks! Updated back to the BindBlock bit. I'll keep reveman@ in the loop for the ...
4 years, 8 months ago (2016-04-07 07:10:34 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1862183003/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1862183003/80001
4 years, 8 months ago (2016-04-07 07:13:03 UTC) #15
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 8 months ago (2016-04-07 07:44:46 UTC) #17
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/f838f5f4880b9f4fe54e6e10812708c1c89b23d7 Cr-Commit-Position: refs/heads/master@{#385690}
4 years, 8 months ago (2016-04-07 07:45:38 UTC) #19
ccameron
4 years, 8 months ago (2016-04-08 22:18:41 UTC) #20
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in
https://codereview.chromium.org/1874013002/ by ccameron@chromium.org.

The reason for reverting is: This didn't fix the issue.

The issue appears to be a GL program leak..

Powered by Google App Engine
This is Rietveld 408576698