Bug 99085 - [EGL] dEQP-EGL.functional.sharing.gles2.multithread intermittent
Summary: [EGL] dEQP-EGL.functional.sharing.gles2.multithread intermittent
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Chad Versace
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 98315
  Show dependency treegraph
 
Reported: 2016-12-14 16:25 UTC by Mark Janes
Modified: 2016-12-28 19:15 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Backtrace of crash in dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.create_texture_render (6.15 KB, text/plain)
2016-12-27 22:10 UTC, Chad Versace
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Janes 2016-12-14 16:25:13 UTC
Many multithread tests were resolved by properly initializing threads for Xlib in dEQP.

However, the following category of tests continues to be intermittent:

dEQP-EGL.functional.sharing.gles2.multithread

for example:

dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.create_texture_render

Took 39 ms.
Standard Output

[18] (0) Begin -- eglBindAPI(EGL_OPENGL_ES_API)
[22] (0) End -- eglBindAPI()
[24] (0) Begin -- eglCreateContext(0x1fb2230, 0x29b2fc0, EGL_NO_CONTEXT, { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE })
[550] (0) End -- 0x7f27f8001320 = eglCreateContext()
[556] (0) Begin -- eglCreatePbufferSurface(0x1fb2230, 0x29b2fc0, { EGL_WIDTH, 400, EGL_HEIGHT, 400, EGL_NONE })
[557] (1) Begin -- eglBindAPI(EGL_OPENGL_ES_API)
[560] (1) End -- eglBindAPI()
[563] (1) Begin -- eglCreateContext(0x1fb2230, 0x29b2fc0, 0x7f27f8001320, { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE })
[598] (0) End -- 0x7f27f803dfb0= eglCreatePbufferSurface()
[804] (1) End -- 0x7f280003a770 = eglCreateContext()
[810] (1) Begin -- eglCreatePbufferSurface(0x1fb2230, 0x29b2fc0, { EGL_WIDTH, 400, EGL_HEIGHT, 400, EGL_NONE })
[812] (0) Begin -- eglMakeCurrent(0x1fb2230, 0x7f27f803dfb0, 0x7f27f803dfb0, 0x7f27f8001320)
[840] (1) End -- 0x7f2800038700= eglCreatePbufferSurface()
[844] (1) Begin -- eglMakeCurrent(0x1fb2230, 0x7f2800038700, 0x7f2800038700, 0x7f280003a770)
[998] (0) End -- eglMakeCurrent()
[1002] (0) Begin -- glGetString(GL_EXTENSIONS)
[1007] (0) End -- glGetString()
[1028] (0) Begin -- eglGetProcAddress("glEGLImageTargetTexture2DOES")
[1031] (0) End --  0x7f2808d793c0 = eglGetProcAddress()
[1034] (0) Begin -- glCreateShader(35633)
[1037] (0) End -- 1 = glCreateShader(35633)
[1038] (0) Begin -- glFinish()
[1059] (0) End -- glFinish()
[1063] (0) Begin -- glShaderSource(1, 1, "attribute highp vec2 a_pos;
varying mediump vec2 v_pos;
void main(void)
{
	v_pos = a_pos;
	gl_Position = vec4(a_pos, 0.0, 1.0);
}
", DE_NULL)
[1075] (0) End -- glShaderSource()
[1076] (0) Begin -- glFinish()
[1079] (0) End -- glFinish()
[1082] (0) Begin -- glCompileShader(1)
[1163] (1) End -- eglMakeCurrent()
[1167] (1) Begin -- glGetString(GL_EXTENSIONS)
[1169] (1) End -- glGetString()
[1188] (1) Begin -- eglGetProcAddress("glEGLImageTargetTexture2DOES")
[1191] (1) End --  0x7f2808d793c0 = eglGetProcAddress()
[1310] (0) End -- glCompileShader()
[1312] (0) Begin -- glFinish()
[1314] (0) End -- glFinish()
[1316] (0) Begin -- glCreateShader(35632)
[1318] (0) End -- 2 = glCreateShader(35632)
[1318] (0) Begin -- glFinish()
[1319] (0) End -- glFinish()
[1321] (0) Begin -- glShaderSource(2, 1, "varying mediump vec2 v_pos;
uniform sampler2D u_sampler;
void main(void)
{
	gl_FragColor = texture2D(u_sampler, v_pos);
}
", DE_NULL)
[1323] (0) End -- glShaderSource()
[1324] (0) Begin -- glFinish()
[1324] (0) End -- glFinish()
[1326] (0) Begin -- glCompileShader(2)
[3798] (0) End -- glCompileShader()
[3800] (0) Begin -- glFinish()
[3803] (0) End -- glFinish()
[3806] (0) Begin -- glCreateProgram()
[3809] (0) End -- 3 = glCreateProgram()
[3810] (0) Begin -- glFinish()
[3811] (0) End -- glFinish()
[3812] (0) Begin -- glAttachShader(3, 2)
[3814] (0) End -- glAttachShader()
[3814] (0) Begin -- glFinish()
[3815] (0) End -- glFinish()
[3817] (0) Begin -- glAttachShader(3, 1)
[3818] (0) End -- glAttachShader()
[3819] (0) Begin -- glFinish()
[3820] (0) End -- glFinish()
[3821] (0) Begin -- glLinkProgram(3)
[5217] (0) End -- glLinkProgram()
[5219] (0) Begin -- glFinish()
[5222] (0) End -- glFinish()
[5228] (0) Begin -- glGenTextures(1, { 0 })
[5233] (0) End -- glGenTextures(1, { 1 })
[5234] (0) Begin -- glFinish()
[5235] (0) End -- glFinish()
[5291] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 1)
[5293] (0) End -- glBindTexture()
[5295] (0) Begin -- glTexImage2D(GL_TEXTURE_2D, 0, 6408, 256, 256, 0, 6408, 5121, data)
[9278] (0) End -- glTexImage2D()
[9280] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 0)
[9281] (0) End -- glBindTexture()
[9282] (0) Begin -- glFinish()
[9293] (0) End -- glFinish()
[9296] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 1)
[9298] (0) End -- glBindTexture()
[9298] (0) Begin -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
[9300] (0) End -- glTexParameteri()
[9301] (0) Begin -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
[9302] (0) End -- glTexParameteri()
[9302] (0) Begin -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
[9303] (0) End -- glTexParameteri()
[9304] (0) Begin -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
[9305] (0) End -- glTexParameteri()
[9307] (0) Begin -- eglCreateImageKHR(0x1fb2230, 0x7f27f8001320, EGL_GL_TEXTURE_2D_KHR, 1, { EGL_GL_TEXTURE_LEVEL_KHR, 0, EGL_NONE })
[9311] (0) End -- 0x7f27f8041920 = eglCreateImageKHR()
[9311] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 0)
[9312] (0) End -- glBindTexture()
[9313] (0) Begin -- glFinish()
[9314] (0) End -- glFinish()
[9316] (0) Begin -- glGenTextures(1, { 0 })
[9318] (0) End -- glGenTextures(1, { 2 })
[9319] (0) Begin -- glFinish()
[9320] (0) End -- glFinish()
[9322] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 2)
[9323] (0) End -- glBindTexture()
[9324] (0) Begin -- glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, 0x7f27f8041920)
[9326] (0) End -- glEGLImageTargetTexture2DOES()
[9327] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 0)
[9328] (0) End -- glBindTexture()
[9329] (0) Begin -- glFinish()
[9330] (0) End -- glFinish()
[9334] (0) Begin -- glDeleteTextures(1, { 1 })
[9338] (0) End -- glDeleteTextures()
[9338] (1) Begin -- glClearColor(0.5f, 0.5f, 0.5f, 1.0f)
[9340] (0) Begin -- glFinish()
[9341] (0) End -- glFinish()
[9341] (1) End -- glClearColor()
[9343] (1) Begin -- glClear(GL_COLOR_BUFFER_BIT)
[9344] (0) Begin -- glClearColor(0.5f, 0.5f, 0.5f, 1.0f)
[9345] (0) End -- glClearColor()
[9346] (0) Begin -- glClear(GL_COLOR_BUFFER_BIT)
[13580] (0) End -- glClear()
[13580] (1) End -- glClear()
[13583] (0) Begin -- glUseProgram(3)
[13583] (1) Begin -- glUseProgram(3)
[13587] (0) End -- glUseProgram()
[13587] (1) End -- glUseProgram()
[13588] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 2)
[13588] (1) Begin -- glBindTexture(GL_TEXTURE_2D, 2)
[13591] (0) End -- glBindTexture()
[13592] (0) Begin -- glGetUniformLocation(3, "u_sampler")
[13594] (1) End -- glBindTexture()
[13595] (0) End -- glGetUniformLocation()
[13595] (1) Begin -- glGetUniformLocation(3, "u_sampler")
[13597] (0) Begin -- glUniform1i(0, 0)
[13597] (1) End -- glGetUniformLocation()
[13599] (0) End -- glUniform1i()
[13599] (1) Begin -- glUniform1i(0, 0)
[13600] (0) Begin -- glGetAttribLocation(3, "a_pos")
[13600] (1) End -- glUniform1i()
[13602] (0) End -- 0 = glGetAttribLocation()
[13602] (1) Begin -- glGetAttribLocation(3, "a_pos")
[13604] (0) Begin -- glEnableVertexAttribArray(0)
[13604] (1) End -- 0 = glGetAttribLocation()
[13605] (1) Begin -- glEnableVertexAttribArray(0)
[13606] (0) End -- glEnableVertexAttribArray()
[13607] (0) Begin -- glBindBuffer(GL_ARRAY_BUFFER, 0)
[13607] (1) End -- glEnableVertexAttribArray()
[13608] (1) Begin -- glBindBuffer(GL_ARRAY_BUFFER, 0)
[13609] (0) End -- glBindBuffer()
[13609] (1) End -- glBindBuffer()
[13611] (0) Begin -- glVertexAttribPointer(0, GL_FLOAT, GL_FALSE, 0, <data>)
[13611] (1) Begin -- glVertexAttribPointer(0, GL_FLOAT, GL_FALSE, 0, <data>)
[13613] (0) End -- glVertexAttribPointer()
[13613] (1) End -- glVertexAttribPointer()
[13614] (0) Begin -- glDrawArrays(GL_TRIANGLES, 0, 6)
[13614] (1) Begin -- glDrawArrays(GL_TRIANGLES, 0, 6)
[13665] (0) End -- glDrawArrays()
[13667] (0) Begin -- glBindBuffer(GL_ARRAY_BUFFER, 0)
[13669] (0) End -- glBindBuffer()
[13670] (0) Begin -- glBindTexture(GL_TEXTURE_2D, 0)
[13672] (0) End -- glBindTexture()
[13674] (0) Begin -- glDisableVertexAttribArray(0)
[13675] (0) End -- glDisableVertexAttribArray()
[13677] (0) Begin -- glUseProgram(0)
[13695] (0) End -- glUseProgram()
[13697] (0) Begin -- glFinish()
[14026] (0) End -- glFinish()
[14219] (0) Begin -- glReadPixels(0, 0, 400, 400, 6408, 5121, <data>)
[14604] (1) End -- glDrawArrays()
[14606] (1) Begin -- glBindBuffer(GL_ARRAY_BUFFER, 0)
[14608] (1) End -- glBindBuffer()
[14610] (1) Begin -- glBindTexture(GL_TEXTURE_2D, 0)
[14620] (1) End -- glBindTexture()
[14622] (1) Begin -- glDisableVertexAttribArray(0)
[14624] (1) End -- glDisableVertexAttribArray()
[14625] (1) Begin -- glUseProgram(0)
[14638] (1) End -- glUseProgram()
[14640] (1) Begin -- glFinish()
[14916] (1) End -- glFinish()
[15102] (1) Begin -- glReadPixels(0, 0, 400, 400, 6408, 5121, <data>)
[18283] (0) End -- glReadPixels()
[18761] (0) Begin -- glFinish()
[18766] (0) End -- glFinish()
[22079] (1) End -- glReadPixels()
[22441] (1) Begin -- glFinish()
[22444] (1) End -- glFinish()
[22450] (1) Begin -- eglMakeCurrent(0x1fb2230, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)
[22453] (0) Begin -- CompareData
[22454] (1) End -- eglMakeCurrent()
[22458] (1) Begin -- eglDestroyContext(0x1fb2230, 0x7f280003a770)
[22718] (1) End -- eglDestroyContext()
[22721] (1) Begin -- eglDestroySurface(0x1fb2230,  0x7f2800038700)
[22749] (1) End -- eglDestroySurface()
[32001] (0) CompareData passed
[32003] (0) End -- CompareData
[32007] (0) Begin -- glDeleteTextures(1, { 2 })
[32012] (0) End -- glDeleteTextures()
[32013] (0) Begin -- glFinish()
[32016] (0) End -- glFinish()
[32018] (0) Begin -- eglDestroyImageKHR(0x1fb2230, 0x7f27f8041920)
[32060] (0) End -- eglDestroyImageKHR()
[32061] (0) Begin -- glFinish()
[32062] (0) End -- glFinish()
[32065] (0) Begin -- glDeleteShader(1)
[32069] (0) End -- glDeleteShader()
[32069] (0) Begin -- glFinish()
[32070] (0) End -- glFinish()
[32072] (0) Begin -- glDeleteShader(2)
[32075] (0) End -- glDeleteShader()
[32075] (0) Begin -- glFinish()
[32076] (0) End -- glFinish()
[32078] (0) Begin -- glDeleteProgram(3)
[32117] (0) tcu::Exception 'deleteProgram(program): glGetError() returned GL_INVALID_VALUE at teglGLES2SharingThreadedTests.cpp:1532'
Comment 1 Tapani Pälli 2016-12-15 09:54:22 UTC
Updating status .. I did a script to run dEQP test 'x' times (and abort if failed) to investigate spurious failures.

It seems tests with 'texture_source' ("Image management tests with texture source") fail sometimes and to be precise only the ones with 'config.render' set, others (1256 remaining tests) pass fine even with hundreds of iterations.

Failure happens always at shader program deletion, I will attempt to isolate further from here.
Comment 2 Chad Versace 2016-12-27 22:10:24 UTC
Created attachment 128670 [details]
Backtrace of crash in dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.create_texture_render

Attached is a backtrace of the crash in dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.create_texture_render.

Repo versions:
    mesa: master@d6545f2                                                      
    deqp: nougat-cts-dev@4acf725 with local patches
    deqp-target: x11_egl

Crashing line is src/mesa/main/shaderobj.c:253:

    248│ void
    249│ _mesa_reference_shader_program_(struct gl_context *ctx,
    250│                                 struct gl_shader_program **ptr,
    251│                                 struct gl_shader_program *shProg)
    252│ {
  **253│    assert(ptr);
    254│    if (*ptr == shProg) {
    255│       /* no-op */
    256│       return;
    257│    }

See attachment for full backtrace.
Comment 3 Chad Versace 2016-12-27 22:16:08 UTC
(In reply to Chad Versace from comment #2)
> Created attachment 128670 [details]
> Backtrace of crash in
> dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.
> create_texture_render
> 
> Attached is a backtrace of the crash in
> dEQP-EGL.functional.sharing.gles2.multithread.simple.images.texture_source.
> create_texture_render.
> 
> Repo versions:
>     mesa: master@d6545f2                                                    
> 
>     deqp: nougat-cts-dev@4acf725 with local patches
>     deqp-target: x11_egl
> 
> Crashing line is src/mesa/main/shaderobj.c:253:
> 
>     248│ void
>     249│ _mesa_reference_shader_program_(struct gl_context *ctx,
>     250│                                 struct gl_shader_program **ptr,
>     251│                                 struct gl_shader_program *shProg)
>     252│ {
>   **253│    assert(ptr);
>     254│    if (*ptr == shProg) {
>     255│       /* no-op */
>     256│       return;
>     257│    }

And sometimes I see the crash on a different line in the same function:

  248│ void
  249│ _mesa_reference_shader_program_(struct gl_context *ctx,
  250│                                 struct gl_shader_program **ptr,
  251│                                 struct gl_shader_program *shProg)
  252│ {
  253│    assert(ptr);
  254│    if (*ptr == shProg) {
  255│       /* no-op */
  256│       return;
  257│    }
  258│    if (*ptr) {
  259│       /* Unreference the old shader program */
  260│       GLboolean deleteFlag = GL_FALSE;
  261│       struct gl_shader_program *old = *ptr;
  262│
**263├>      assert(old->RefCount > 0);
Comment 4 Chad Versace 2016-12-27 22:47:47 UTC
Fix submitted to mesa-dev.

https://lists.freedesktop.org/archives/mesa-dev/2016-December/139021.html
https://patchwork.freedesktop.org/patch/129481/

From: Chad Versace <chadversary@chromium.org>
To: mesa-dev@lists.freedesktop.org
Subject: [PATCH] mesa/shaderobj: Fix races on refcounts
Date: Tue, 27 Dec 2016 14:45:53 -0800
Message-Id: <20161227224553.56135-1-chadversary@chromium.org>
Comment 5 Tapani Pälli 2016-12-28 07:04:02 UTC
(In reply to Chad Versace from comment #4)
> Fix submitted to mesa-dev.
> 
> https://lists.freedesktop.org/archives/mesa-dev/2016-December/139021.html
> https://patchwork.freedesktop.org/patch/129481/
> 
> From: Chad Versace <chadversary@chromium.org>
> To: mesa-dev@lists.freedesktop.org
> Subject: [PATCH] mesa/shaderobj: Fix races on refcounts
> Date: Tue, 27 Dec 2016 14:45:53 -0800
> Message-Id: <20161227224553.56135-1-chadversary@chromium.org>

Superb! I was trying to tackle this by adding more locking but did not get it pass.
Comment 6 Chad Versace 2016-12-28 19:15:15 UTC
Patch is pushed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.