New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 598388 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows , Mac
Pri: 1
Type: Bug



Sign in to add a comment

Sudden spike in GPU process crashes - '[GPU hang] gfx::GLContextCGL::Destroy'

Project Member Reported by erikc...@chromium.org, Mar 28 2016

Issue description

https://crash.corp.google.com/browse?q=product.name%3D%27Chrome_Mac%27%20AND%20product.version%3D%2751.0.2692.0%27%20AND%20custom_data.ChromeCrashProto.ptype%3D%27gpu-process%27%20AND%20custom_data.ChromeCrashProto.magic_signature_1.name%3D%27%5BGPU%20hang%5D%20gfx%3A%3AGLContextCGL%3A%3ADestroy%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D

Crash happens on all GPUs and OS X versions. Crash started between 2688 and 2689.
https://chromium.googlesource.com/chromium/src/+log/51.0.2688.0..51.0.2689.0?pretty=fuller&n=10000

Looks like a shutdown crash:

Thread 0 MAGIC SIGNATURE THREAD
0x00007fff979e8f72	(libsystem_kernel.dylib + 0x00010f72 )	mach_msg_trap
0x00007fff950f9c20	(IOKit + 0x00065c20 )	io_connect_method
0x00007fff9509a13b	(IOKit + 0x0000613b )	IOConnectCallMethod
0x00007fff8fddc032	(IOAccelerator + 0x00004032 )	ioAccelResourceFinalize
0x00007fff97fe4af2	(CoreFoundation + 0x0000eaf2 )	CFRelease
0x00007fff9589e604	(libGPUSupportMercury.dylib + 0x00001604 )	gldDestroyMemoryPlugin
0x00007fff9589e5b8	(libGPUSupportMercury.dylib + 0x000015b8 )	gldDestroyBuffer
0x00007fffa01113d9	(libGFXShared.dylib + 0x000053d9 )	gfxDestroyPluginBuffer
0x00007fff9b030926	(GLEngine + 0x00108926 )	gleFreeBufferObject
0x00007fffa01116ad	(libGFXShared.dylib + 0x000056ad )	gfxReleaseSharedStateAndHash
0x00007fff9af44db0	(GLEngine + 0x0001cdb0 )	gliDestroyContext
0x00007fffa1b07209	(OpenGL + 0x00005209 )	CGLReleaseContext
0x00007fffa1b0642f	(OpenGL + 0x0000442f )	CGLDestroyContext
0x0000000104023593	(Google Chrome Framework -gl_context_cgl.cc:151 )	gfx::GLContextCGL::Destroy()
0x0000000104023a17	(Google Chrome Framework -gl_context_cgl.cc:268 )	gfx::GLContextCGL::~GLContextCGL()
0x0000000103f70da7	(Google Chrome Framework -ref_counted.h:134 )	gpu::GLContextVirtual::~GLContextVirtual()
0x0000000103f70dfd	(Google Chrome Framework -gl_context_virtual.cc:124 )	gpu::GLContextVirtual::~GLContextVirtual()
0x0000000103f929f4	(Google Chrome Framework -ref_counted.h:134 )	gpu::gles2::GLES2DecoderImpl::Destroy(bool)
0x0000000103dcec45	(Google Chrome Framework -gpu_command_buffer_stub.cc:487 )	content::GpuCommandBufferStub::Destroy()
0x0000000103dce702	(Google Chrome Framework -gpu_command_buffer_stub.cc:260 )	content::GpuCommandBufferStub::~GpuCommandBufferStub()
0x0000000103dcecfd	(Google Chrome Framework -gpu_command_buffer_stub.cc:259 )	<name omitted>
0x0000000103dc8cf0	(Google Chrome Framework -memory:2545 )	content::GpuChannel::OnDestroyCommandBuffer(int)
0x0000000103dc8588	(Google Chrome Framework -tuple.h:204 )	content::GpuChannel::OnControlMessageReceived(IPC::Message const&)
0x0000000103dc8fa4	(Google Chrome Framework -gpu_channel.cc:821 )	content::GpuChannel::HandleMessageHelper(IPC::Message const&)
0x0000000103dc8f58	(Google Chrome Framework -gpu_channel.cc:805 )	content::GpuChannel::HandleMessage(scoped_refptr<content::GpuChannelMessageQueue> const&)
0x0000000103dcb261	(Google Chrome Framework -bind_internal.h:181 )	base::internal::Invoker<base::IndexSequence<0ul, 1ul>, base::internal::BindState<base::internal::RunnableAdapter<void (content::GpuChannel::*)(scoped_refptr<content::GpuChannelMessageQueue> const&)>, void (content::GpuChannel*, scoped_refptr<content::GpuChannelMessageQueue> const&), base::WeakPtr<content::GpuChannel>, scoped_refptr<content::GpuChannelMessageQueue> const&>, base::internal::InvokeHelper<true, void, base::internal::RunnableAdapter<void (content::GpuChannel::*)(scoped_refptr<content::GpuChannelMessageQueue> const&)> >, void ()>::Run(base::internal::BindStateBase*)
0x000000010327823a	(Google Chrome Framework -callback.h:397 )	base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask const&)
0x000000010329a652	(Google Chrome Framework -message_loop.cc:476 )	base::MessageLoop::RunTask(base::PendingTask const&)
0x000000010329a92b	(Google Chrome Framework -message_loop.cc:485 )	base::MessageLoop::DeferOrRunPendingTask(base::PendingTask const&)
0x000000010329ab1a	(Google Chrome Framework -message_loop.cc:597 )	base::MessageLoop::DoWork()
0x000000010326d710	(Google Chrome Framework -message_pump_mac.mm:330 )	base::MessagePumpCFRunLoopBase::RunWork()
0x000000010328ffb9	(Google Chrome Framework + 0x00565fb9 )	base::mac::CallWithEHFrame(void () block_pointer)
0x000000010326d113	(Google Chrome Framework -message_pump_mac.mm:306 )	base::MessagePumpCFRunLoopBase::RunWorkSource(void*)
0x00007fff98080880	(CoreFoundation + 0x000aa880 )	__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
0x00007fff9805ffbb	(CoreFoundation + 0x00089fbb )	__CFRunLoopDoSources0
0x00007fff9805f4de	(CoreFoundation + 0x000894de )	__CFRunLoopRun
0x00007fff9805eed7	(CoreFoundation + 0x00088ed7 )	CFRunLoopRunSpecific
0x000000010326dade	(Google Chrome Framework -message_pump_mac.mm:554 )	base::MessagePumpCFRunLoop::DoRun(base::MessagePump::Delegate*)
0x000000010326d563	(Google Chrome Framework -message_pump_mac.mm:238 )	base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*)
0x00000001032b07f2	(Google Chrome Framework -run_loop.cc:35 )	base::RunLoop::Run()
0x0000000103299dfc	(Google Chrome Framework -message_loop.cc:293 )	base::MessageLoop::Run()
0x0000000103224724	(Google Chrome Framework -gpu_main.cc:426 )	content::GpuMain(content::MainFunctionParams const&)
0x000000010322f993	(Google Chrome Framework -content_main_runner.cc:754 )	content::ContentMainRunnerImpl::Run()
0x000000010322ef05	(Google Chrome Framework -content_main.cc:19 )	content::ContentMain(content::ContentMainParams const&)
0x0000000102d2d491	(Google Chrome Framework -chrome_main.cc:84 )	ChromeMain
0x0000000102ac3d51	(Google Chrome Helper -chrome_exe_main_mac.c:87 )	main
0x0000000102ac3b33	(Google Chrome Helper + 0x00000b33 )	start


Thread 2 CRASHED [EXC_BAD_ACCESS / KERN_INVALID_ADDRESS @ 0x00000000 ]
0x0000000103225853	(Google Chrome Framework -gpu_watchdog_thread.cc:366 )	content::GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang()
0x0000000103225c5a	(Google Chrome Framework -bind_internal.h:181 )	base::internal::Invoker<base::IndexSequence<0ul>, base::internal::BindState<base::internal::RunnableAdapter<void (content::GpuWatchdogThread::*)()>, void (content::GpuWatchdogThread*), base::WeakPtr<content::GpuWatchdogThread> >, base::internal::InvokeHelper<true, void, base::internal::RunnableAdapter<void (content::GpuWatchdogThread::*)()> >, void ()>::Run(base::internal::BindStateBase*)
0x000000010327823a	(Google Chrome Framework -callback.h:397 )	base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask const&)
0x000000010329a652	(Google Chrome Framework -message_loop.cc:476 )	base::MessageLoop::RunTask(base::PendingTask const&)
0x000000010329a92b	(Google Chrome Framework -message_loop.cc:485 )	base::MessageLoop::DeferOrRunPendingTask(base::PendingTask const&)
0x000000010329ad8a	(Google Chrome Framework -message_loop.cc:635 )	base::MessageLoop::DoDelayedWork(base::TimeTicks*)
0x000000010326d72c	(Google Chrome Framework -message_pump_mac.mm:334 )	base::MessagePumpCFRunLoopBase::RunWork()
0x000000010328ffb9	(Google Chrome Framework + 0x00565fb9 )	base::mac::CallWithEHFrame(void () block_pointer)
0x000000010326d113	(Google Chrome Framework -message_pump_mac.mm:306 )	base::MessagePumpCFRunLoopBase::RunWorkSource(void*)
0x00007fff98080880	(CoreFoundation + 0x000aa880 )	__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
0x00007fff9805ffbb	(CoreFoundation + 0x00089fbb )	__CFRunLoopDoSources0
0x00007fff9805f4de	(CoreFoundation + 0x000894de )	__CFRunLoopRun
0x00007fff9805eed7	(CoreFoundation + 0x00088ed7 )	CFRunLoopRunSpecific
0x000000010326dade	(Google Chrome Framework -message_pump_mac.mm:554 )	base::MessagePumpCFRunLoop::DoRun(base::MessagePump::Delegate*)
0x000000010326d563	(Google Chrome Framework -message_pump_mac.mm:238 )	base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*)
0x00000001032b07f2	(Google Chrome Framework -run_loop.cc:35 )	base::RunLoop::Run()
0x0000000103299dfc	(Google Chrome Framework -message_loop.cc:293 )	base::MessageLoop::Run()
0x00000001032d2757	(Google Chrome Framework -thread.cc:254 )	base::Thread::ThreadMain()
0x00000001032cec56	(Google Chrome Framework -platform_thread_posix.cc:68 )	base::(anonymous namespace)::ThreadFunc(void*)
0x00007fff9169299c	(libsystem_pthread.dylib + 0x0000399c )	_pthread_body
0x00007fff91692919	(libsystem_pthread.dylib + 0x00003919 )	_pthread_start
0x00007fff91690350	(libsystem_pthread.dylib + 0x00001350 )	thread_start
0x00000001032cebff	(Google Chrome Framework + 0x005a4bff )	
 
Cc: jbau...@chromium.org
Owner: kbr@chromium.org
Status: Assigned (was: Untriaged)
Link to all the Builds on which this crash is seen:

https://crash.corp.google.com/browse?q=product.name%3D%27Chrome_Mac%27%20AND%20custom_data.ChromeCrashProto.ptype%3D%27gpu-process%27%20AND%20custom_data.ChromeCrashProto.magic_signature_1.name%3D%27%5BGPU%20hang%5D%20gfx%3A%3AGLContextCGL%3A%3ADestroy%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D#-samplereports:5,productversion:1000


Crash rate on the recent M51 builds:

51.0.2692.0	0.29%	58	
51.0.2691.0	0.37%	75	
51.0.2690.0	0.42%	85	
51.0.2689.0	0.50%	100	
51.0.2688.0	0.01%	3	


Looping in chromium//src/content/common/gpu/OWNERS as i am unable to find any recent changes in the code search.

@Ken, can you please take a look at it and assign it accordingly ?
Owner: ccameron@chromium.org
The most likely culprit is ccameron@ with:

Mac: Use AVSampleBufferDisplayLayer for 4:2:0 surfaces
https://codereview.chromium.org/1828523003

Mac: Decode hardware to 420 instead of 422
https://codereview.chromium.org/1822173002
Project Member

Comment 3 by sheriffbot@chromium.org, Mar 28 2016

Labels: OS-Windows Fracas
Users experienced this crash on the following builds:

Win Dev 51.0.2687.0 - 443 reports, 406 clients (signature [GPU hang] content::DXVAVideoDecodeAccelerator::SendMFTMessage)
Mac Canary 51.0.2692.0 - 63 reports, 51 clients (signature [GPU hang] gfx::GLContextCGL::Destroy)

If this update was incorrect, please add "Fracas-Wrong" label to prevent future updates.

- Go/Fracas
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bd8763305febe8b7c2467734848bfd42bead244a

commit bd8763305febe8b7c2467734848bfd42bead244a
Author: ccameron <ccameron@chromium.org>
Date: Tue Mar 29 21:07:54 2016

Revert of Mac: Decode hardware to 420 instead of 422 (patchset #3 id:40001 of https://codereview.chromium.org/1822173002/ )

Reason for revert:
This likely spiked the crash rates.
BUG= 598388 

Original issue's description:
> Mac: Decode hardware to 420 instead of 422
>
> If the decoded frame is going to be used as a CALayer overlay, then
> it will never be converted to RGBA. If it is used by OpenGL, then the
> same infrastructure for software frames will be employed to make an
> expensive RGBA copy of the frame.
>
> BUG= 594452 
>
> Committed: https://crrev.com/24da601d444c8822c5ff0a10751b9384f25dd1b4
> Cr-Commit-Position: refs/heads/master@{#382797}

TBR=sandersd@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG= 594452 

Review URL: https://codereview.chromium.org/1842673003

Cr-Commit-Position: refs/heads/master@{#383823}

[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/gpu_video_decode_accelerator.cc
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/gpu_video_decode_accelerator.h
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/vaapi_video_decode_accelerator.cc
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/vaapi_video_decode_accelerator.h
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/video_decode_accelerator_unittest.cc
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/vt_video_decode_accelerator_mac.cc
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/content/common/gpu/media/vt_video_decode_accelerator_mac.h
[modify] https://crrev.com/bd8763305febe8b7c2467734848bfd42bead244a/media/video/video_decode_accelerator.h

Cc: sande...@chromium.org
The following crash looks promising:
https://crash.corp.google.com/browse?q=product.name%3D%27Chrome_Mac%27%20AND%20product.version%3D%2751.0.2692.0%27%20AND%20custom_data.ChromeCrashProto.ptype%3D%27gpu-process%27%20AND%20custom_data.ChromeCrashProto.magic_signature_1.name%3D%27%5BGPU%20hang%5D%20gfx%3A%3AGLContextCGL%3A%3ADestroy%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D&stbtiq=&reportid=810faaf800000000&index=12#3

We see that one thread has the stack:
  (AppleIntelHD3000GraphicsGLDriver + 0x002c538b)   
  (AppleIntelHD3000GraphicsGLDriver + 0x002c21ab)   
  (AppleIntelHD3000GraphicsGLDriver + 0x002af8f1)   
  (AppleIntelHD3000GraphicsGLDriver + 0x002f4a1b)   
  (AppleIntelHD3000GraphicsGLDriver + 0x002faeb4)   
  (libGPUSupport.dylib)     gpumDeleteCachedProgram
  (libGPUSupport.dylib)     gldDestroyContext
  (GLEngine)                gliDestroyContext
  (OpenGL)                  CGLReleaseContext
  (OpenGL)                  CGLDestroyContext
  (Google Chrome Framework) gfx::GLContextCGL::Destroy()
  (Google Chrome Framework) gfx::GLContextCGL::~GLContextCGL()
  (Google Chrome Framework) gpu::GLContextVirtual::~GLContextVirtual()
  (Google Chrome Framework) gpu::GLContextVirtual::~GLContextVirtual()
  (Google Chrome Framework) gpu::gles2::GLES2DecoderImpl::Destroy(bool)
  (Google Chrome Framework) content::GpuCommandBufferStub::Destroy()

And another thread has the stack:
  (libsystem_kernel.dylib + 0x00016162 )  __psynch_mutexwait
  (AppleGVA)                AVF_CreateMediaAcceleratorInterface
  (AppleGVA)                AVF_CreateMediaAcceleratorInterface
  (AppleGVA)                AVF_CreateMediaAcceleratorInterface
  (VideoToolbox)            VTGetGVADecoderAvailability
  (VideoToolbox)            VTDecompressionSessionDecodeFrame
  (VideoToolbox)            VTDecompressionSessionDecodeFrame
  (Google Chrome Framework) content::VTVideoDecodeAccelerator::DecodeTask(media::BitstreamBuffer const&, content::VTVideoDecodeAccelerator::Frame*)

I would hazard a guess that we're seeing some sort of deadlock between decode and CGLContext tear-down.

I'm re-introducing the patch piecemeal. It could have been decode-to-420 or draw-with-AVSampleBufferDisplayLayer that caused this. Hopefully we'll get a clear signal as to which it was.

Cc: tkonch...@chromium.org
This crash seen on latest builds as below

51.0.2693.2	2.01%	380	
51.0.2693.0	0.01%	1	
51.0.2692.0	1.30%	246	
51.0.2691.0	0.57%	107	
51.0.2690.0	0.65%	123	
51.0.2689.0	0.74%	139	
51.0.2688.0	0.02%	3	
51.0.2687.0	0.01%	2	
51.0.2686.0	0.01%	1	
51.0.2685.0	0.01%	1	
51.0.2680.0	0.01%	1	
51.0.2678.0	0.01%	1	
51.0.2673.0	0.02%	4	
51.0.2672.0	0.01%	2	
51.0.2669.0	0.01%	1	
51.0.2668.0	0.01%	1	
51.0.2667.0	0.01%	1	
51.0.2665.0	0.01%	1	
50.0.2661.57	0.01%	1	
50.0.2661.49	0.03%	6	
50.0.2661.37	0.06%	11	
50.0.2661.26	0.02%	4	
50.0.2661.18	0.01%	2	
50.0.2661.11	0.01%	1	
50.0.2659.0	0.01%	2	
50.0.2658.0	0.01%	1	
50.0.2657.0	0.02%	4	
50.0.2656.0	0.01%	1	

Link to the builds:
	
https://crash.corp.google.com/browse?q=product.name%3D%27Chrome_Mac%27%20AND%20custom_data.ChromeCrashProto.ptype%3D%27gpu-process%27%20AND%20custom_data.ChromeCrashProto.magic_signature_1.name%3D%27%5BGPU%20hang%5D%20gfx%3A%3AGLContextCGL%3A%3ADestroy%27&ignore_case=false&enable_rewrite=true&omit_field_name=&omit_field_value=&omit_field_opt=%3D#-samplereports:5,productversion:1000
Issue 600524 has been merged into this issue.
This disappeared in 51.0.2700.0 and re-appeared in 51.0.2700.1. The difference is https://codereview.chromium.org/1851293004/, which moves us to 4:2:0 format.

So ... at least we know exactly what is causing the problem. Now we need to figure out how to fix this.
Cc: dcasta...@chromium.org
I have a guess about this: We leave GL texture bound to the Y and UV IOSurfaces while the GLImage is still around. I'll change this to delete the textures immediately and see if that fixes the problem.
Project Member

Comment 10 by bugdroid1@chromium.org, Apr 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f838f5f4880b9f4fe54e6e10812708c1c89b23d7

commit f838f5f4880b9f4fe54e6e10812708c1c89b23d7
Author: ccameron <ccameron@chromium.org>
Date: Thu Apr 07 07:44:35 2016

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 

Review URL: https://codereview.chromium.org/1862183003

Cr-Commit-Position: refs/heads/master@{#385690}

[modify] https://crrev.com/f838f5f4880b9f4fe54e6e10812708c1c89b23d7/ui/OWNERS
[modify] https://crrev.com/f838f5f4880b9f4fe54e6e10812708c1c89b23d7/ui/gl/gl_image_io_surface.h
[modify] https://crrev.com/f838f5f4880b9f4fe54e6e10812708c1c89b23d7/ui/gl/gl_image_io_surface.mm

This didn't fix the issue:  51 .0.2703.0 (cut at r385938, after the above patch) still has this as the #1 GPU process crasher.

Other ideas... issue 599314 is leaving the IOSurface bound to some texture units, so that may be some of the issue. Also, r386027 has us keep the CVPixelBufferRef retained, so maybe that is part of the issue.

It would be nice to have any idea what causes this to happen. Is this happening at GPU process shutdown?
Cc: reve...@chromium.org
Omg... I think I found the issue -- 99% of the calls to GLImageIOSurface::Destroy are *leaking* their GL programs.

That's why all of these stacks are hanging in gpuiCleanContextFromProgram.

So, we really need to stop creating a new GL shader for every video frame, especially if we're going to leak them...
The reason that has_context is false is that we're hitting this through
VTVideoDecodeAccelerator::ReusePictureBuffer, which releases the GLImage without a context attached.

VTVideoDecodeAccelerator will necessarily create a new GLImageIOSurface every video frame (because its IOSurfaces come from the VTDecompressionSession, and we don't have control of the reuse pool there).
I have a definitive fix at https://codereview.chromium.org/1870323002/.
Project Member

Comment 16 by sheriffbot@chromium.org, Apr 11 2016

Labels: M-52
Users experienced this crash on the following builds:

Win Dev 51.0.2700.0 -  0.63 CPM, 486 reports, 448 clients (signature [GPU hang] content::DXVAVideoDecodeAccelerator::SendMFTMessage)
Mac Canary 52.0.2705.0 -  1.70 CPM, 4 reports, 4 clients (signature [GPU hang] gfx::GLContextCGL::Destroy)

If this update was incorrect, please add "Fracas-Wrong" label to prevent future updates.

- Go/Fracas
Project Member

Comment 17 by bugdroid1@chromium.org, Apr 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c9295d4075c1e4a32977c446ab9734a88abf8391

commit c9295d4075c1e4a32977c446ab9734a88abf8391
Author: ccameron <ccameron@chromium.org>
Date: Tue Apr 12 19:29:27 2016

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

Review URL: https://codereview.chromium.org/1870323002

Cr-Commit-Position: refs/heads/master@{#386757}

[modify] https://crrev.com/c9295d4075c1e4a32977c446ab9734a88abf8391/ui/gl/gl_image_io_surface.h
[modify] https://crrev.com/c9295d4075c1e4a32977c446ab9734a88abf8391/ui/gl/gl_image_io_surface.mm

Project Member

Comment 18 by bugdroid1@chromium.org, Apr 12 2016

Labels: merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c5d9e014c2adc935365cb443444c7b28e52f9ad0

commit c5d9e014c2adc935365cb443444c7b28e52f9ad0
Author: Christopher Cameron <ccameron@chromium.org>
Date: Tue Apr 12 20:50:17 2016

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

Review URL: https://codereview.chromium.org/1870323002

Cr-Commit-Position: refs/heads/master@{#386757}
(cherry picked from commit c9295d4075c1e4a32977c446ab9734a88abf8391)

Review URL: https://codereview.chromium.org/1884763003 .

Cr-Commit-Position: refs/branch-heads/2704@{#15}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[modify] https://crrev.com/c5d9e014c2adc935365cb443444c7b28e52f9ad0/ui/gl/gl_image_io_surface.h
[modify] https://crrev.com/c5d9e014c2adc935365cb443444c7b28e52f9ad0/ui/gl/gl_image_io_surface.mm

Status: Fixed (was: Assigned)
Closing

Sign in to add a comment