Emscripten generated WebGL app hangs the Mac driver

RESOLVED INCOMPLETE

Status

()

defect
RESOLVED INCOMPLETE
7 years ago
a month ago

People

(Reporter: Ehsan, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Posted file Testcase
It seems like opening the testcase on Mac stops rendering in Firefox completely.  I saw the following calls being made in Instruments:

Running Time	Self		Symbol Name
3545.0ms    4.0%	3545.0	 	ATIRadeonX3000AMDLinkedList::getNextIterator()
3520.0ms    4.0%	0.0	 	 ATIRadeonX3000Hardware::handleSemaphoreProxyFreeEvent(void*)
3520.0ms    4.0%	0.0	 	  ATIRadeonX3000Hardware::processEventNotification(_eAMD_HW_EVENT_TYPE, void*)
3520.0ms    4.0%	0.0	 	   ATIRadeonX3000AMDHWSemaphoreProxy::free()
3520.0ms    4.0%	0.0	 	    ATIRadeonX3000Hardware::waitOnUsedResource(VendorTextureBuffer*, _eAMD_HW_ENGINE_TYPE, char const*, unsigned int)
1570.0ms    1.8%	0.0	 	     ATIR800GLContext::restore_state(VendorGLStreamInfo&)
1570.0ms    1.8%	0.0	 	      IOATIR800GLContext::processCommandBuffer(VendorCommandDescriptor*)
1570.0ms    1.8%	0.0	 	       ATIR800GLContext::processCommandBuffer(VendorCommandDescriptor*)
1570.0ms    1.8%	0.0	 	        IOATIR800GLContext::clientMemoryForType(unsigned int, unsigned int*, IOMemoryDescriptor**)
1570.0ms    1.8%	0.0	 	         IOATIR800GLContext::submit_command_buffer(unsigned int, sIOGLGetCommandBuffer*)
1570.0ms    1.8%	0.0	 	          shim_io_connect_method_scalarI_structureO
1570.0ms    1.8%	0.0	 	           IOUserClient::externalMethod(unsigned int, IOExternalMethodArguments*, IOExternalMethodDispatch*, OSObject*, void*)
1570.0ms    1.8%	0.0	 	            is_io_connect_method
1570.0ms    1.8%	0.0	 	             iokit_server_routine
1570.0ms    1.8%	0.0	 	              ipc_kobject_server
1570.0ms    1.8%	0.0	 	               ipc_kmsg_send
1570.0ms    1.8%	0.0	 	                mach_msg_overwrite_trap
1570.0ms    1.8%	0.0	 	                 thread_set_child
1570.0ms    1.8%	0.0	 	                  mach_msg_trap
1570.0ms    1.8%	0.0	 	                   mach_msg
1570.0ms    1.8%	0.0	 	                    io_connect_method
1570.0ms    1.8%	0.0	 	                     IOConnectCallMethod
1570.0ms    1.8%	0.0	 	                      0x1159ba709
1287.0ms    1.4%	0.0	 	                       0x1159daf94
1287.0ms    1.4%	0.0	 	                        glDrawArrays_ACC_Exec
1287.0ms    1.4%	0.0	 	                         mozilla::WebGLContext::DrawArrays(unsigned int, int, int)
1287.0ms    1.4%	0.0	 	                          mozilla::WebGLContext::MozDrawArrays(unsigned int, int, int)
1287.0ms    1.4%	0.0	 	                           _ZL41nsIDOMWebGLRenderingContext_MozDrawArraysP9JSContextjPN2JS5ValueE
APItrace says that the following pattern is repeated infinitely.

The most likely explanation would be a bug in emscripten's handling of the original application's animation loop. In WebGL, compositing only happens after the current JS callback has returned, so you have to return at least at the end of the frame drawing.

The absence of any compositor commands in this trace suggests that the JS callback doesn't return.

5031362 glClear(mask = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
5031364 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 3)
5031366 glBufferSubData(target = GL_ARRAY_BUFFER, offset = 0, size = 432, data = blob(432))
5031368 glUseProgram(program = 24)
5031370 glUniformMatrix4fv(location = 1, count = 1, transpose = GL_FALSE, value = {0.7071068, 0, -0.7071068, 0, 0, 1, 0, 0, 0.7071068, 0, 0.7071068, 0, 0, 0, -5, 1})
5031372 glUniformMatrix4fv(location = 2, count = 1, transpose = GL_FALSE, value = {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan})
5031374 glVertexAttribPointer(index = 0, size = 3, type = GL_FLOAT, normalized = GL_FALSE, stride = 12, pointer = NULL)
5031376 glEnableVertexAttribArray(index = 0)
5031377 glUniform4fv(location = 0, count = 1, value = {1, 1, 1, 1})
5031380 glActiveTexture(texture = GL_TEXTURE0)
5031382 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
5031384 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 36)
5031387 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 0)
5031389 glUseProgram(program = 0)
5031391 glClear(mask = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
5031393 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 3)
5031395 glBufferSubData(target = GL_ARRAY_BUFFER, offset = 0, size = 432, data = blob(432))
5031397 glUseProgram(program = 24)
5031399 glUniformMatrix4fv(location = 1, count = 1, transpose = GL_FALSE, value = {0.6946584, 0, -0.7193398, 0, 0, 1, 0, 0, 0.7193398, 0, 0.6946584, 0, 0, 0, -5, 1})
5031401 glUniformMatrix4fv(location = 2, count = 1, transpose = GL_FALSE, value = {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan})
5031403 glVertexAttribPointer(index = 0, size = 3, type = GL_FLOAT, normalized = GL_FALSE, stride = 12, pointer = NULL)
5031405 glEnableVertexAttribArray(index = 0)
5031406 glUniform4fv(location = 0, count = 1, value = {1, 1, 1, 1})
5031409 glActiveTexture(texture = GL_TEXTURE0)
5031411 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
5031413 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 36)
5031416 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 0)
5031418 glUseProgram(program = 0)
5031420 glClear(mask = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
5031422 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 3)
5031424 glBufferSubData(target = GL_ARRAY_BUFFER, offset = 0, size = 432, data = blob(432))
5031426 glUseProgram(program = 24)
5031428 glUniformMatrix4fv(location = 1, count = 1, transpose = GL_FALSE, value = {0.6819984, 0, -0.7313537, 0, 0, 1, 0, 0, 0.7313537, 0, 0.6819984, 0, 0, 0, -5, 1})
5031430 glUniformMatrix4fv(location = 2, count = 1, transpose = GL_FALSE, value = {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan})
5031432 glVertexAttribPointer(index = 0, size = 3, type = GL_FLOAT, normalized = GL_FALSE, stride = 12, pointer = NULL)
5031434 glEnableVertexAttribArray(index = 0)
5031435 glUniform4fv(location = 0, count = 1, value = {1, 1, 1, 1})
5031438 glActiveTexture(texture = GL_TEXTURE0)
5031440 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
5031442 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 36)
5031445 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 0)
5031447 glUseProgram(program = 0)
5031449 glClear(mask = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
5031451 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 3)
5031453 glBufferSubData(target = GL_ARRAY_BUFFER, offset = 0, size = 432, data = blob(432))
5031455 glUseProgram(program = 24)
5031457 glUniformMatrix4fv(location = 1, count = 1, transpose = GL_FALSE, value = {0.6691306, 0, -0.7431448, 0, 0, 1, 0, 0, 0.7431448, 0, 0.6691306, 0, 0, 0, -5, 1})
5031459 glUniformMatrix4fv(location = 2, count = 1, transpose = GL_FALSE, value = {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan})
5031461 glVertexAttribPointer(index = 0, size = 3, type = GL_FLOAT, normalized = GL_FALSE, stride = 12, pointer = NULL)
5031463 glEnableVertexAttribArray(index = 0)
5031464 glUniform4fv(location = 0, count = 1, value = {1, 1, 1, 1})
5031467 glActiveTexture(texture = GL_TEXTURE0)
5031469 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
5031471 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 36)
5031474 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 0)
5031476 glUseProgram(program = 0)
5031478 glClear(mask = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
5031480 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 3)
5031482 glBufferSubData(target = GL_ARRAY_BUFFER, offset = 0, size = 432, data = blob(432))
5031484 glUseProgram(program = 24)
5031486 glUniformMatrix4fv(location = 1, count = 1, transpose = GL_FALSE, value = {0.656059, 0, -0.7547096, 0, 0, 1, 0, 0, 0.7547096, 0, 0.656059, 0, 0, 0, -5, 1})
5031488 glUniformMatrix4fv(location = 2, count = 1, transpose = GL_FALSE, value = {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan})
5031490 glVertexAttribPointer(index = 0, size = 3, type = GL_FLOAT, normalized = GL_FALSE, stride = 12, pointer = NULL)
5031492 glEnableVertexAttribArray(index = 0)
5031493 glUniform4fv(location = 0, count = 1, value = {1, 1, 1, 1})
5031496 glActiveTexture(texture = GL_TEXTURE0)
5031498 glBindTexture(target = GL_TEXTURE_2D, texture = 0)
5031500 glDrawArrays(mode = GL_TRIANGLES, first = 0, count = 36)
5031503 glBindBuffer(target = GL_ARRAY_BUFFER, buffer = 0)
5031505 glUseProgram(program = 0)
Hmm, OK, I'll look into this.
Perhaps try to make it draw 1 frame and halt (say by throwing an exception), and see what that does.
Whiteboard: [games:p?]
This is probably my own mistake.  I have not had the time to investigate it, but I'm convinced that it's not anything important for Gecko, definitely not a priority for the games effort.
Whiteboard: [games:p?]
No longer blocks: gecko-games
Status: NEW → RESOLVED
Last Resolved: a month ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.