Closed Bug 617475 Opened 14 years ago Closed 14 years ago

WebGL doesn't work on my Mac

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta8+

People

(Reporter: iangilman, Assigned: bjacob)

Details

(Keywords: regression)

Attachments

(6 files, 1 obsolete file)

Running: 

http://azarask.in/projects/webgl/

... in today's nightly gives me "Could not initialize WebGL, sorry :-(", with this in the error console: 

Error: gl is undefined
Source File: http://azarask.in/projects/webgl/
Line: 84

I'm running on a 2 year old Mac pro with snow leopard. Here's my graphics info:

ATI Radeon HD 2600 XT:

  Chipset Model:	ATI Radeon HD 2600
  Type:	GPU
  Bus:	PCIe
  Slot:	Slot-1
  PCIe Lane Width:	x16
  VRAM (Total):	256 MB
  Vendor:	ATI (0x1002)
  Device ID:	0x9588
  Revision ID:	0x0000
  ROM Revision:	113-B1480A-252
  EFI Driver Version:	01.00.252
  Displays:
DELL E172FP:
  Resolution:	1280 x 1024 @ 60 Hz
  Pixel Depth:	32-Bit Color (ARGB8888)
  Mirror:	Off
  Online:	Yes
  Rotation:	Supported
DELL U2410:
  Resolution:	1200 x 1920 @ 60 Hz
  Pixel Depth:	32-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Rotation:	90

My webgl.enabled_for_all_sites is set to true. 

I asked in #gfx and no body knew what might be wrong, so they suggested I file a bug. Please let me know what additional information you might need.
Can you paste here the contents of the Graphics part of about:support ?

I first need to check if this might be related to bug 611292, depending on your CGL 'Adapter Description'.

The second thing to check is: is this affected by toggling webgl.shader_validator ?

Thirdly, I guess a useful thing would be if you could bisect this regression. Alternatively, if you have a debug build of Minefield, set a breakpoint at the beginning of WebGLContext::SetDimensions and step through it. If you're in the MV office, Vlad could do that with you.
Here's my about:support:

  Graphics

        Adapter Description
        0x21a00,0x20400

        Vendor ID
        1a00

        Device ID
        1a00

        Adapter RAM

        Adapter Drivers

        Driver Version

        Driver Date

        Direct2D Enabled
        Blocked on your graphics card because of unresolved driver issues.

        DirectWrite Enabled
        false

      GPU Accelerated Windows
      1/1 OpenGL
Toggling webgl.shader_validator (without restarting the browser) has no effect; fails the same either way. 

By bisect the regression, do you mean figure out what build it started failing on? For what it's worth, I've never tried running WebGL until now. 

I'm not in MV, and I don't have a good set up for debugging Minefield's c++ (I'm just developing on the JavaScript side), but I'd be happy to try if someone can walk me through it.

Thanks!

btw, I'm getting into this now as we're hoping to use WebGL for Panorama's animations to improve performance.
Hrm, we'd need to pull the GL renderer info -- I believe either the OpenGL Profiler or OpenGL Driver Monitor should have a renderer info bit.  Copy and paste the whole thing if you can, for the radeon card (not the software renderer), in particular the values of GL_MAX_VERTEX_ATTRIBS and GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS.
Actually, looking through http://developer.apple.com/graphicsimaging/opengl/capabilities/ that card should be fine.. so I'm not sure.  Is it a mac with switchable graphics?
Limi is also getting the exact same issue as Ian. He has a brand-new 11" Air. I have the new 13" Air but WebGL works perfectly for me. I believe the two air's have exactly the same graphics card, which makes this all triply weird.
Notice that Paul Rouget told me that WebGL recently started failing to initialize for him on Linux. So I'm keeping open the possibility of a recent non-Mac-specific regression.
(In reply to comment #6)
> Limi is also getting the exact same issue as Ian. He has a brand-new 11" Air. I
> have the new 13" Air but WebGL works perfectly for me. I believe the two air's
> have exactly the same graphics card, which makes this all triply weird.

Can you too paste the Graphics section in about:support on your Mac on which WebGL works?
Vladimir: the Vendor/Device IDs are wrong on Mac, because the code is just taking the 16 least significant bits from the CGL Adapted Description.

>         Vendor ID
>         1a00
> 
>         Device ID
>         1a00

This doesn't really matter since only the CGL Adapted Description is actually used, but we should fix this to avoid displaying wrong info in about:support:
So, I checked, the GL blacklist on Mac is only for GL layers, not WebGL, so that isn't the explanation. I also checked that we didn't accidentally blacklist this graphics card.

> By bisect the regression, do you mean figure out what build it started failing
> on? For what it's worth, I've never tried running WebGL until now. 

Yes. It would already be very useful if you could check if it works with beta7. If it does, then try past nightly builds to narrow down the regression window.

> I'm not in MV, and I don't have a good set up for debugging Minefield's c++
> (I'm just developing on the JavaScript side), but I'd be happy to try if
> someone can walk me through it.

OK, don't worry. I'm going to make you a build that prints useful info in the Terminal.

> btw, I'm getting into this now as we're hoping to use WebGL for Panorama's
> animations to improve performance.

That's great to hear; and indeed sounds like a very good idea. That will get you much more consistent hardware acceleration across platforms than you could otherwise get.
Works in 20101203030309
Please making it blocking beta8. This is a major regression.
blocking2.0: --- → ?
Pushed to try:
http://tbpl.mozilla.org/?tree=MozillaTry

so tinderbox builds will soon be available.
(In reply to comment #7)
> Notice that Paul Rouget told me that WebGL recently started failing to
> initialize for him on Linux. So I'm keeping open the possibility of a recent
> non-Mac-specific regression.

WebGL is disabled on linux due to build system brokenness currently.
This is a major regression from beta 7; WebGL seems to be broken on basically all macs, including mine. I don't think we should release beta 8 with WebGL broken like this.
blocking2.0: ? → beta8+
Keywords: regression
Humph noticed this assertion that occurs everytime a WebGLContext gets created:

###!!! ASSERTION: Class name and proto chain interface name mismatch!: 'nsCRT::strcmp(CutPrefix(name), mData->mName) == 0', file /home/bjacob/mozilla-central/dom/base/nsDOMClassInfo.cpp, line 4688

Running in valgrind, just after this assertion occurs, I get a valgrind error in OpenGL:

==18607== Conditional jump or move depends on uninitialised value(s)
==18607==    at 0x323FE59B40: ??? (in /usr/lib64/nvidia/libGLcore.so.195.36.31)
==18607==  Uninitialised value was created by a stack allocation
==18607==    at 0x324029B2A9: ??? (in /usr/lib64/nvidia/libGLcore.so.195.36.31)
==18607== 

Running with XPCOM_DEBUG_BREAK=abort, shows that this assertions does originate from GetContext():

(gdb) bt
#0  0x000000322d2329a5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x000000322d234185 in abort () at abort.c:92
#2  0x00007ffff6edc321 in mozalloc_abort (msg=
    0x7fffffffa9c0 "###!!! ASSERTION: Class name and proto chain interface name mismatch!: 'nsCRT::strcmp(CutPrefix(name), mData->mName) == 0', file /home/bjacob/mozilla-central/dom/base/nsDOMClassInfo.cpp, line 4688") at /home/bjacob/mozilla-central/memory/mozalloc/mozalloc_abort.cpp:75
#3  0x00007ffff71c727f in Abort (aMsg=
    0x7fffffffa9c0 "###!!! ASSERTION: Class name and proto chain interface name mismatch!: 'nsCRT::strcmp(CutPrefix(name), mData->mName) == 0', file /home/bjacob/mozilla-central/dom/base/nsDOMClassInfo.cpp, line 4688") at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:379
#4  0x00007ffff71c724d in NS_DebugBreak_P (aSeverity=1, aStr=
    0x7fffe6ec85b0 "Class name and proto chain interface name mismatch!", aExpr=
    0x7fffe6ec8578 "nsCRT::strcmp(CutPrefix(name), mData->mName) == 0", aFile=
    0x7fffe6ec7630 "/home/bjacob/mozilla-central/dom/base/nsDOMClassInfo.cpp", aLine=4688)
    at /home/bjacob/mozilla-central/xpcom/base/nsDebugImpl.cpp:366
#5  0x00007fffe67737fa in nsDOMClassInfo::PostCreatePrototype (this=0x1dfc3e0, cx=0x15a6060, 
    proto=0x7fffd01078f0) at /home/bjacob/mozilla-central/dom/base/nsDOMClassInfo.cpp:4687
#6  0x00007fffe6cd4005 in XPCWrappedNativeProto::Init (this=0x1e00c10, ccx=..., isGlobal=0, 
    scriptableCreateInfo=0x7fffffffb1b0)
    at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcwrappednativeproto.cpp:143
#7  0x00007fffe6cd457d in XPCWrappedNativeProto::GetNewOrUsed (ccx=..., Scope=0x1a8e240, 
    ClassInfo=0x1dfc3e0, ScriptableCreateInfo=0x7fffffffb1b0, ForceNoSharing=0, isGlobal=0, 
    offsets=0x1)
    at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcwrappednativeproto.cpp:264
#8  0x00007fffe6cbd71c in XPCWrappedNative::GetNewOrUsed (ccx=..., helper=..., Scope=0x1a8e240, 
    Interface=0x938890, isGlobal=0, resultWrapper=0x7fffffffb3b0)
    at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcwrappednative.cpp:541
#9  0x00007fffe6c93a39 in XPCConvert::NativeInterface2JSObject (lccx=..., d=0x7fffda7fe0a0, 
    dest=0x0, aHelper=..., iid=0x7fffe6d9fa30, Interface=0x7fffe76ce3c0, scope=0x7fffd0107898, 
    allowNativeWrapper=1, isGlobal=0, pErr=0x7fffffffb50c)
    at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcconvert.cpp:1290
#10 0x00007fffe6cdba75 in xpc_qsXPCOMObjectToJsval (lccx=..., aHelper=..., iid=0x7fffe6d9fa30, 
    iface=0x7fffe76ce3c0, rval=0x7fffda7fe0a0)
    at /home/bjacob/mozilla-central/js/src/xpconnect/src/xpcquickstubs.cpp:1098
#11 0x00007fffe6d318b7 in nsIDOMHTMLCanvasElement_GetContext (cx=0x15a6060, argc=1, vp=
    0x7fffda7fe0a0) at dom_quickstubs.cpp:20040
#12 0x00007ffff779ffdc in js::CallJSNative (cx=0x15a6060, native=
---Type <return> to continue, or q <return> to quit---
    0x7fffe6d315cb <nsIDOMHTMLCanvasElement_GetContext(JSContext*, uintN, jsval*)>, argc=1, vp=
    0x7fffda7fe0a0) at /home/bjacob/mozilla-central/js/src/jscntxtinlines.h:684
#13 0x00007ffff79693c9 in CallCompiler::generateNativeStub (this=0x7fffffffc020)
    at /home/bjacob/mozilla-central/js/src/methodjit/MonoIC.cpp:691
#14 0x00007ffff7965d08 in js::mjit::ic::NativeCall (f=..., ic=0x1a10020)
    at /home/bjacob/mozilla-central/js/src/methodjit/MonoIC.cpp:898
#15 0x00007fffec032b49 in ?? ()
#16 0x00007fffec032068 in ?? ()
#17 0x0000000000000027 in ?? ()
#18 0x00000000015a6060 in ?? ()
#19 0x0000000000000000 in ?? ()
The assertion is a red herring and dealt with in bug 615994.
Here's the info from my 11" MacBook Air:

OpenGL Driver Monitor:
  MAX_VERTEX_ATTRIBS_ARB = 16
  GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 16



System info:
  Chipset Model:	NVIDIA GeForce 320M
  Type:	GPU
  Bus:	PCI
  VRAM (Total):	256 MB
  Vendor:	NVIDIA (0x10de)
  Device ID:	0x08a2
  Revision ID:	0x00a2
  ROM Revision:	3571
  Displays:
Color LCD:
  Resolution:	1366 x 768
  Pixel Depth:	32-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Built-In:	Yes
  Connection Type:	DisplayPort
Display Connector:
  Status:	No Display Connected



From about:support:

  Graphics
        Adapter Description
        0x22600,0x20400

        Vendor ID
        2600

        Device ID
        2600

        Adapter RAM

        Adapter Drivers

        Driver Version

        Driver Date

        Direct2D Enabled
        Blocked on your graphics card because of unresolved driver issues.

        DirectWrite Enabled
        false

      GPU Accelerated Windows
      1/1 OpenGL


OpenGL info
Attached file Ian's OpenGL stats
(In reply to comment #4)
> Hrm, we'd need to pull the GL renderer info -- I believe either the OpenGL
> Profiler or OpenGL Driver Monitor should have a renderer info bit.  Copy and
> paste the whole thing if you can, for the radeon card (not the software
> renderer), in particular the values of GL_MAX_VERTEX_ATTRIBS and
> GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS.

Attached.
(In reply to comment #10)
> Yes. It would already be very useful if you could check if it works with beta7.
> If it does, then try past nightly builds to narrow down the regression window.

I've verified that Beta7 WebGL works fine on my computer; haven't yet narrowed it down beyond that.

I'll try the logging patch.
Attached file Limi's OpenGL info
Here's my full OpenGL info too.
This bug needs a regression range if comment 16 is correct.
Assignee: nobody → bjacob
Attached patch fix bugSplinter Review
Here's the fix, thanks to Joe for debugging this.

Will write a mochitest to ensure that this doesnt happen again.
Attachment #496223 - Flags: review?(joe)
Attachment #496223 - Flags: review?(joe) → review+
Attached patch fix bug, updated (obsolete) — Splinter Review
New version: Ehsan found a more elegant way to write this code and a couple more things to fix.
Attachment #496236 - Flags: review?(ehsan)
Regenerated: use 0 instead of -1 as the special 'bad' value, no need to introduce another special case, and my previous patch had it wrong as since this unsigned, -1 > 0.

Also removed the bogus implementations of GetAdapterVendorID and GetAdapterDeviceID. Now they're just returning 0.
Attachment #496236 - Attachment is obsolete: true
Attachment #496246 - Flags: review?(ehsan)
Attachment #496236 - Flags: review?(ehsan)
Attachment #496246 - Flags: review?(ehsan) → review?(vladimir)
Attachment #496246 - Flags: review?(vladimir) → review?(joe)
Comment on attachment 496246 [details] [diff] [review]
fix bug, updated again

Looks correct. My only suggestion is to change the comment just below FEATURE_OPENGL_LAYERS to reflect the fact that we don't default to blocked device any more; instead, we blacklist a bunch of known-bad renderers.
Attachment #496246 - Flags: review?(joe) → review+
http://hg.mozilla.org/mozilla-central/rev/04d3958be743
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Attached patch TestcaseSplinter Review
Attachment #496352 - Flags: review?(bjacob)
Comment on attachment 496352 [details] [diff] [review]
Testcase

looks ok if it passed on try!
Attachment #496352 - Flags: review?(bjacob) → review+
Flags: in-testsuite?
So, the test is failing on Windows debug: <http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1291884814.1291887992.4257.gz>.  I don't have Windows opt results available yet.  It passed on Mac and Linux.

32049 INFO TEST-START | /tests/content/canvas/test/test_bug617475.html
++DOMWINDOW == 18 (0A563F48) [serial = 796] [outer = 064A3538]
WARNING: Couldn't load EGL LIB.: file e:/builds/moz2_slave/tryserver-win32-debug/build/gfx/thebes/GLContextProviderEGL.cpp, line 326
Can't find symbol 'wglCreatePbufferARB'
Can't find symbol 'wglDestroyPbufferARB'
Can't find symbol 'wglGetPbufferDCARB'
Can't find symbol 'wglBindTexImageARB'
Can't find symbol 'wglReleaseTexImageARB'
Can't find symbol 'wglChoosePixelFormatARB'
Can't find symbol 'wglGetPixelFormatAttribivARB'
Can't find symbol 'ActiveTexture'
Can't find symbol 'AttachShader'
Can't find symbol 'BindAttribLocation'
Can't find symbol 'BindBuffer'
Can't find symbol 'BlendColor'
Can't find symbol 'BlendEquation'
Can't find symbol 'BlendEquationSeparate'
Can't find symbol 'BlendFuncSeparate'
Can't find symbol 'BufferData'
Can't find symbol 'BufferSubData'
Can't find symbol 'DetachShader'
Can't find symbol 'DisableVertexAttribArray'
Can't find symbol 'EnableVertexAttribArray'
Can't find symbol 'GetActiveAttrib'
Can't find symbol 'GetActiveUniform'
Can't find symbol 'GetAttachedShaders'
Can't find symbol 'GetAttribLocation'
Can't find symbol 'GetBufferParameteriv'
Can't find symbol 'GetProgramiv'
Can't find symbol 'GetProgramInfoLog'
Can't find symbol 'GetUniformfv'
Can't find symbol 'GetUniformiv'
Can't find symbol 'GetUniformLocation'
Can't find symbol 'GetVertexAttribfv'
Can't find symbol 'GetVertexAttribiv'
Can't find symbol 'IsBuffer'
Can't find symbol 'IsProgram'
Can't find symbol 'IsShader'
Can't find symbol 'LinkProgram'
Can't find symbol 'SampleCoverage'
Can't find symbol 'StencilFuncSeparate'
Can't find symbol 'StencilMaskSeparate'
Can't find symbol 'StencilOpSeparate'
Can't find symbol 'Uniform1f'
Can't find symbol 'Uniform1fv'
Can't find symbol 'Uniform1i'
Can't find symbol 'Uniform1iv'
Can't find symbol 'Uniform2f'
Can't find symbol 'Uniform2fv'
Can't find symbol 'Uniform2i'
Can't find symbol 'Uniform2iv'
Can't find symbol 'Uniform3f'
Can't find symbol 'Uniform3fv'
Can't find symbol 'Uniform3i'
Can't find symbol 'Uniform3iv'
Can't find symbol 'Uniform4f'
Can't find symbol 'Uniform4fv'
Can't find symbol 'Uniform4i'
Can't find symbol 'Uniform4iv'
Can't find symbol 'UniformMatrix2fv'
Can't find symbol 'UniformMatrix3fv'
Can't find symbol 'UniformMatrix4fv'
Can't find symbol 'UseProgram'
Can't find symbol 'ValidateProgram'
Can't find symbol 'VertexAttribPointer'
Can't find symbol 'VertexAttrib1f'
Can't find symbol 'VertexAttrib2f'
Can't find symbol 'VertexAttrib3f'
Can't find symbol 'VertexAttrib4f'
Can't find symbol 'VertexAttrib1fv'
Can't find symbol 'VertexAttrib2fv'
Can't find symbol 'VertexAttrib3fv'
Can't find symbol 'VertexAttrib4fv'
Can't find symbol 'CompileShader'
Can't find symbol 'GetShaderiv'
Can't find symbol 'GetShaderInfoLog'
Can't find symbol 'GetShaderSource'
Can't find symbol 'ShaderSource'
Can't find symbol 'VertexAttribPointer'
Can't find symbol 'BindFramebuffer'
Can't find symbol 'BindRenderbuffer'
Can't find symbol 'CheckFramebufferStatus'
Can't find symbol 'FramebufferRenderbuffer'
Can't find symbol 'FramebufferTexture2D'
Can't find symbol 'GenerateMipmap'
Can't find symbol 'GetFramebufferAttachmentParameteriv'
Can't find symbol 'GetRenderbufferParameteriv'
Can't find symbol 'IsFramebuffer'
Can't find symbol 'IsRenderbuffer'
Can't find symbol 'RenderbufferStorage'
Can't find symbol 'GenBuffers'
Can't find symbol 'CreateProgram'
Can't find symbol 'CreateShader'
Can't find symbol 'GenFramebuffers'
Can't find symbol 'GenRenderbuffers'
Can't find symbol 'DeleteBuffers'
Can't find symbol 'DeleteProgram'
Can't find symbol 'DeleteShader'
Can't find symbol 'DeleteFramebuffers'
Can't find symbol 'DeleteRenderbuffers'
WARNING: Global context GLContext initialization failed?: file e:/builds/moz2_slave/tryserver-win32-debug/build/gfx/thebes/GLContextProviderWGL.cpp, line 734
JavaScript warning: http://mochi.test:8888/tests/content/canvas/test/test_bug617475.html, line 27: WebGL: Can't get a usable WebGL context
32050 ERROR TEST-UNEXPECTED-FAIL | /tests/content/canvas/test/test_bug617475.html | We should have a webgl context

Does that mean that WebGL is broken on Windows too?
(In reply to comment #31)
> Does that mean that WebGL is broken on Windows too?

No, you need Vlad here, I think there are subtleties about running WebGL on windows test servers that he understands and I don't. Apparently it tried loading the ANGLE library (seen as EGL) and failed to find it. We may have to play with the preferences webgl.prefer_egl and webgl.prefer_gl.
FWIW, the test run on Windows 7 passed (comment 31 was about Windows XP).

Benoit, I'm sure you can drive the test through the rest of the way!  :-)
I've now verified that the fix works on my Mac... thanks!
Works here too in the nightly.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: