WebGL context creation keeps failing after D3D device has been lost

RESOLVED FIXED in mozilla16

Status

()

Core
Canvas: WebGL
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: bjacob, Assigned: bjacob)

Tracking

unspecified
mozilla16
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

STR at least on WinXP:
 - go to a webgl page
 - do something that causes the D3D device to get lost. In WinXP, it's enough to lock the screen (Win+L).
 - reload the webgl page

Expected:
the webgl page should work normally after reloading

Actual:
upon reloading, webgl context creation fails.

the problem is that in gfx/angle/src/libEGL/Display.cpp, in Display::createOffscreenSurface, at line 682, we have:

    if (testDeviceLost()) 
    {
        if (!restoreLostDevice())
            return EGL_NO_SURFACE;
    }

and in the circumstances reproducing this bug, testDeviceLost() return true here so we bail out with EGL_NO_SURFACE here.

Need a D3D expert to see if there is anything to do here...

Note: this is a follow-up from bug 760415
(Assignee)

Comment 1

5 years ago
So, the above code snippet tries to restore the device, and here's where this is failing:

bool Display::restoreLostDevice()
{
    for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
    {
        if ((*ctx)->isResetNotificationEnabled())
            return false;   // If reset notifications have been requested, application must delete all contexts first
    }

Here, isResetNotificationEnabled returns true as we asked to get context loss on reset (EXT_robustness). Anyway, the question is what is this other GL context that is still around here? And the answer is probably the global context --- which we don't make use of on Windows. Let's try disabling it.
(Assignee)

Comment 2

5 years ago
Created attachment 632939 [details] [diff] [review]
do not create a global context on Windows EGL

So, this makes it work for me on this WinXP box.

So the GL context that was lying around and preventing resetting the device was indeed the global context. We don't use the global context on Windows EGL at all, do we? I mean, it should have nothing to do with the D3D share handles, right?

This should make the WebGL success rates go up significantly on Windows, as people do keep long-running sessions and if any device loss occurred, without this patch, they couldn't get WebGL anymore until they quit and restarted Firefox. So I would like to backport this to aurora/beta.

This patch also adds some comment around the recently added equivalent line for Android.
Attachment #632939 - Flags: review?(jgilbert)
(Assignee)

Comment 3

5 years ago
Note: the only WinXP specific thing here should be that Win+L loses the device. Similar symptoms should be observable on Win7 when device loss happens.
(Assignee)

Comment 4

5 years ago
Created attachment 632950 [details] [diff] [review]
do not create a global context on Windows EGL
Attachment #632939 - Attachment is obsolete: true
Attachment #632939 - Flags: review?(jgilbert)
Attachment #632950 - Flags: review?(jgilbert)
Attachment #632950 - Flags: review?(jgilbert) → review+
(Assignee)

Comment 5

5 years ago
https://tbpl.mozilla.org/?tree=Try&rev=06db9c45a0bf
(Assignee)

Comment 6

5 years ago
http://hg.mozilla.org/integration/mozilla-inbound/rev/2af41a172a6c
Assignee: nobody → bjacob
Target Milestone: --- → mozilla16

Comment 7

5 years ago
https://hg.mozilla.org/mozilla-central/rev/2af41a172a6c
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Duplicate of this bug: 730684
You need to log in before you can comment on or make changes to this bug.