Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(55)

Issue 7567045: Fix crash after reseting device. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by apatrick1
Modified:
11 years, 1 month ago
Reviewers:
shannon.woods, nicolas, John Bauman
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Fix crash after reseting device. After calling Reset in testDeviceLost to acknowledge a display mode change, D3D sometimes crashes on the next Present call on an existing swap chain. I couldn't get it to happen with nVidia. The stack looks like this with the debug runtime: ntdll.dll!_ZwRaiseException@12() + 0x12 bytes ntdll.dll!_ZwRaiseException@12() + 0x12 bytes d3d9d.dll!__DDAssert() + 0x1ca bytes d3d9d.dll!CSwapChain::PresentMain() + 0xf52 bytes d3d9d.dll!CSwapChain::Present() + 0x24 bytes libEGL.dll!egl::Surface::swapRect(int x, int y, int width, int height) Line 458 + 0x2a bytes C++ > libEGL.dll!egl::Surface::swap() Line 605 C++ libEGL.dll!eglSwapBuffers(void * dpy, void * surface) Line 1063 + 0x8 bytes C++ gl_wrapper.dll!gfx::EGLApiBase::eglSwapBuffersFn(void * dpy, void * surface) Line 813 + 0x18 bytes C++ gl_wrapper.dll!gfx::NativeViewGLSurfaceEGL::SwapBuffers() Line 363 + 0x35 bytes C++ gl_wrapper.dll!gfx::GLSurfaceAdapter::SwapBuffers() Line 201 + 0x1d bytes C++ content.dll!content::PassThroughImageTransportSurface::SwapBuffers() Line 216 + 0xb bytes C++ The error is "BitBlt or StretchBlt failed in Present". With the release runtime either Present continually fails with E_INVALIDARG or, less commonly, crashes. It seems that by recreating all the swap chains after reset, it recovers. I didn't call resetSwapChain because there is no need to recreate all the other surfaces. As far as I know, this should not be necessary with WDDM. Committed: https://code.google.com/p/angleproject/source/detail?r=1993

Patch Set 1 : #

Total comments: 4

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -0 lines) Patch
M src/libEGL/Display.cpp View 1 1 chunk +6 lines, -0 lines 0 comments Download
M src/libEGL/Surface.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/libEGL/Surface.cpp View 1 1 chunk +32 lines, -0 lines 0 comments Download

Messages

Total messages: 6
apatrick1
This is a bit of a hack. Let me know if you have better ideas. ...
11 years, 1 month ago (2013-03-08 00:21:11 UTC) #1
apatrick1
Is this going to be okay? The GPU process crash rate has increased about 4x ...
11 years, 1 month ago (2013-03-11 19:54:00 UTC) #2
apatrick1
This issue has made it to Chrome Dev channel so I've got to fix it ...
11 years, 1 month ago (2013-03-13 18:55:16 UTC) #3
John Bauman
lgtm This is probably ok, but I'd be worried about getting into a state where ...
11 years, 1 month ago (2013-03-13 19:07:59 UTC) #4
nicolas
Sorry for the delay. Other than what John already mentioned it looks ok to me ...
11 years, 1 month ago (2013-03-13 20:21:07 UTC) #5
apatrick1
11 years, 1 month ago (2013-03-13 20:38:10 UTC) #6
Since I wrote this patch I've started seeing reports of a similar crash that I
can't reproduce on Optimus. They will identify themselves as Intel vendor.

Thread 0 *CRASHED* ( EXCEPTION_ACCESS_VIOLATION_EXEC @ 0x00000000 )

0x74558d50	 [nvumdshim.dll]	 + 0x00018d50]	
0x6ff5b30c	 [d3d9.dll]	 + 0x0011b30c]	CBatchFilterI::LHBatchOpenResource(void
*,_D3DDDIARG_OPENRESOURCE *)
0x6fe69b5f	 [d3d9.dll]	 + 0x00029b5f]	OpenResourceLH
0x6fe69cdd	 [d3d9.dll]	 + 0x00029cdd]	OpenResourceLH
0x6fe47640	 [d3d9.dll]	 + 0x00007640]	CSwapChain::PresentMain(tagRECT const
*,tagRECT const *,HWND__ *,_RGNDATA const *,unsigned long)
0x6fe47842	 [d3d9.dll]	 + 0x00007842]	CSwapChain::Present(tagRECT const
*,tagRECT const *,HWND__ *,_RGNDATA const *,unsigned long)
0x743d19fc	 [libegl.dll]	 -
surface.cpp:427]	egl::Surface::swapRect(int,int,int,int)
0x743d1b3d	 [libegl.dll]	 - surface.cpp:573]	egl::Surface::swap()
0x743d8754	 [libegl.dll]	 - libegl.cpp:1063]	eglSwapBuffers
0x657e367d	 [chrome.dll]	 -
gl_surface_egl.cc:371]	gfx::NativeViewGLSurfaceEGL::SwapBuffers()

Hopefully this will fix both.

https://codereview.appspot.com/7567045/diff/5001/src/libEGL/Display.cpp
File src/libEGL/Display.cpp (right):

https://codereview.appspot.com/7567045/diff/5001/src/libEGL/Display.cpp#newco...
src/libEGL/Display.cpp:923: // Existing swap chains sometimes crash on the next
present after a reset. Seems to be ATI specific.
This path is always WDDM. I'll update the comment though. From the crash
reports, it is not ATI specific.

I think what might be happening is the call to Reset resets the, dummy in our
case, default device swap chain but additional swap chains are left in some kind
of broken state.

https://codereview.appspot.com/7567045/diff/5001/src/libEGL/Surface.cpp
File src/libEGL/Surface.cpp (right):

https://codereview.appspot.com/7567045/diff/5001/src/libEGL/Surface.cpp#newco...
src/libEGL/Surface.cpp:373: result = mSwapChain->GetBackBuffer(0,
D3DBACKBUFFER_TYPE_MONO, &mBackBuffer);
On 2013/03/13 19:07:59, John Bauman wrote:
> I think you need to release mBackBuffer as well.

Right.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b