19.1 db410c crash fix
On db410c with the 19.1 branch we see the following crash booting to the home screen in AOSP (on wallpaper loading, I believe):
signal 11 (Segmentation fault) signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc23072b2 in tid 4355 (RenderThread), pid 4332 (ndroid.settings) Revision: '0' pid: 4332, tid: 4355, name: RenderThread >>> com.android.settings <<< signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xc23072b2 r0 00000000 r1 86d1760d r2 00000000 r3 00000007 r4 c1a51ad8 r5 c1a8cf58 r6 c23072b2 r7 00000004 r8 00000000 r9 00000000 ip e87acd20 sp c1ebdc80 lr e872a075 pc c26c4d24 Stack Trace: RELADDR FUNCTION FILE:LINE 00404d24 ir3_context_error+92 external/mesa3d/src/freedreno/ir3/ir3_context.c:? v------> emit_tex external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:1736 0040134b emit_instr+7542 external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2075 003ff57d emit_block+116 external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2143 003ff44d emit_cf_list+28 external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2190 v------> emit_function external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2329 v------> emit_instructions external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2718 003fe6c5 ir3_compile_shader_nir+1680 external/mesa3d/src/freedreno/ir3/ir3_compiler_nir.c:2822 003fd7d5 create_variant+76 external/mesa3d/src/freedreno/ir3/ir3_shader.c:198 v------> shader_variant external/mesa3d/src/freedreno/ir3/ir3_shader.c:230 003fd747 ir3_shader_get_variant+78 external/mesa3d/src/freedreno/ir3/ir3_shader.c:245 00136535 ir3_shader_variant+112 external/mesa3d/src/gallium/drivers/freedreno/ir3/ir3_gallium.c:91 v------> fd3_emit_get_fp external/mesa3d/src/gallium/drivers/freedreno/a3xx/fd3_emit.h:81 00114777 fd3_program_emit+154 external/mesa3d/src/gallium/drivers/freedreno/a3xx/fd3_program.c:150 00112f97 fd3_emit_tile_mem2gmem+1414 external/mesa3d/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c:670 v------> render_tiles external/mesa3d/src/gallium/drivers/freedreno/freedreno_gmem.c:363 000fe8b3 fd_gmem_render_tiles+426 external/mesa3d/src/gallium/drivers/freedreno/freedreno_gmem.c:464 000fbcf5 batch_flush_func+4 external/mesa3d/src/gallium/drivers/freedreno/freedreno_batch.c:298 003f5265 util_queue_thread_func+164 external/mesa3d/src/util/u_queue.c:289 000a291b __pthread_start(void*)+20 bionic/libc/bionic/pthread_create.cpp:338 0005e293 __start_thread+30 bionic/libc/bionic/clone.cpp:53
With the error message: "Unhandled NIR tex src type: 11"
Interestingly this isn't seen on db845c with the same code.
For whatever reason, the src_type is being set to nir_tex_src_texture_deref and nir_tex_src_sampler_deref on the db410c, and that's crashing out as unhandled.
(NOTE: This crash does not occur with 19.0 or master)
Big credit to @anholt , who suggested this change from upstream, and it indeed seems to solve the issue!
Edited by Rob Clark