Open Bug 660072 Opened 10 years ago Updated 9 years ago
GL layers recover from lost/reset GL contexts
Just like D3D Layers recover from D3D context losses, we need the same for GL layers. This is probably harder, because when we lost the GL context, we lost all its state. Everything needs to be reinitialized from non-GL data. My limited understanding is that we need to reconstruct the whole layers tree? Roc, do you have any pointers for me? How is the layers tree constructed in the first place?
Reconstructing the whole layer tree is not a problem. Just construct yourself a new LayerManager in nsWindow::GetLayerManager, just like Windows does (see the layerManagerD3D10->device() != gfxWindowsPlatform::GetPlatform()->GetD3D10Device() check).
Thanks for the pointer. It turns out that implementing this is also likely a blocker for GL layers on mobile. Indeed, on Android, in Fennec with GL layers, pressing the 'back' button to go back to desktop, then clicking the Fennec icon to go back to Fennec, gives an entirely black window, and repeating these steps leads to GL_INVALID_OPERATION in innocent GL calls, so, while I haven't formally verified it, it seems that Android Application restore causes a GLES context loss. (And I'm not even talking about powering the device off and back on)
Note that losing the layers and resetting the layer manager means we lose the contents of canvases. We can also lose active video frames. I guess we can live with that for now.
(In reply to comment #2) > It turns out that implementing this is also likely a blocker for GL layers > on mobile. Benoit, can you update this bug? I recall you making some discoveries.
(In reply to comment #2) > Indeed, on Android, in Fennec with GL layers, pressing the 'back' > button to go back to desktop, then clicking the Fennec icon to go back to > Fennec, gives an entirely black window, Note that in this case, rotating the device and then rotating it back "resolves" the problem -- the page is drawn correctly at the same position it was before.
I did some work on this same problem for meego about half a year ago - let me see if I can still find my patches.
The black window on restart problem seems to be a separate issue, so I've created a new bug: bug 672574
Hello nhirata, Douglas Sherk tells me that you have information on how to reproduce the EGL_CONTEXT_LOST on Android. Do you have any information you can share?
10 years ago
Ali, is this bug still valid?
Sure is valid; might just not be a priority if context loss is exceedingly hard to reproduce.
(In reply to Benoit Jacob [:bjacob] from comment #10) > Sure is valid; might just not be a priority if context loss is exceedingly > hard to reproduce. Right. Though we have no evidence that we're running into context loss with any non-negligible frequency, it's still something we should handle correctly.
You need to log in before you can comment on or make changes to this bug.