Closed Bug 764578 Opened 12 years ago Closed 12 years ago

WebGL context creation keeps failing after D3D device has been lost

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: bjacob, Assigned: bjacob)

References

Details

Attachments

(1 file, 1 obsolete file)

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
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.
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)
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.
Attachment #632939 - Attachment is obsolete: true
Attachment #632939 - Flags: review?(jgilbert)
Attachment #632950 - Flags: review?(jgilbert)
Attachment #632950 - Flags: review?(jgilbert) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/2af41a172a6c
Assignee: nobody → bjacob
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/2af41a172a6c
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: