Bug 31800 - [r300g] src/mesa/state_tracker/st_mesa_to_tgsi.c:228:src_register: Assertion `index >= 0' failed.
Summary: [r300g] src/mesa/state_tracker/st_mesa_to_tgsi.c:228:src_register: Assertion ...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium critical
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-20 18:31 UTC by Vinson Lee
Modified: 2013-10-04 20:25 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
check register indexes during linking (2.69 KB, patch)
2010-11-23 16:37 UTC, Brian Paul
Details | Splinter Review

Description Vinson Lee 2010-11-20 18:31:41 UTC
mesa: bb045d339b53f7ddd42bfca363e3d589b0ddcf20 (master)

chipset: RV530 71C5 (ATI Radeon X1600)
system architecture: i686
libdrm-dev: 2.4.21-1ubuntu2.1
kernel version: 2.6.35-22-generic
Linux distribution: Ubuntu 10.10 i386
Machine model: iMac4,1

Run piglit gls-fs-uniform-array-6 test.

$ ./bin/shader_runner tests/shaders/glsl-fs-uniform-array-6.shader_test
radeon: Successfully grabbed chipset info from kernel!
radeon: DRM version: 2.5.0 ID: 0x71c5 GB: 1 Z: 2
radeon: GART size: 509 MB VRAM size: 128 MB
radeon: HyperZ: NO
src/mesa/state_tracker/st_mesa_to_tgsi.c:228:src_register: Assertion `index >= 0' failed.


(gdb) bt
#0  0x01075fcb in _debug_assert_fail (expr=0x199b34d "index >= 0", file=0x199b290 "src/mesa/state_tracker/st_mesa_to_tgsi.c", line=228, function=0x199b8f8 "src_register")
    at src/gallium/auxiliary/util/u_debug.c:233
#1  0x01875ec5 in src_register (t=0xbff75548, file=PROGRAM_UNIFORM, index=-1024) at src/mesa/state_tracker/st_mesa_to_tgsi.c:228
#2  0x01876386 in translate_src (t=0xbff75548, SrcReg=0x9d619f4) at src/mesa/state_tracker/st_mesa_to_tgsi.c:316
#3  0x0187748c in compile_instruction (t=0xbff75548, inst=0x9d619e8) at src/mesa/state_tracker/st_mesa_to_tgsi.c:664
#4  0x0187901e in st_translate_mesa_program (ctx=0x98cd438, procType=0, ureg=0x9d26788, program=0x9d12428, numInputs=0, inputMapping=0xbff7688c, inputSemanticName=0xbff769bc "\002", 
    inputSemanticIndex=0xbff7699c "\353Ս\001\060j", <incomplete sequence \367\277>, interpMode=0xbff7680c, numOutputs=1, outputMapping=0xbff76904, outputSemanticName=0xbff7697c "\001_\211\tt\205\244\t", 
    outputSemanticIndex=0xbff7695c "", passthrough_edgeflags=0 '\000') at src/mesa/state_tracker/st_mesa_to_tgsi.c:1142
#5  0x0187a15b in st_translate_fragment_program (st=0x9909d48, stfp=0x9d12428) at src/mesa/state_tracker/st_program.c:444
#6  0x0185d623 in translate_fp (st=0x9909d48, stfp=0x9d12428) at src/mesa/state_tracker/st_atom_shader.c:64
#7  0x0185d832 in update_fp (st=0x9909d48) at src/mesa/state_tracker/st_atom_shader.c:175
#8  0x01859578 in st_validate_state (st=0x9909d48) at src/mesa/state_tracker/st_atom.c:172
#9  0x017c6978 in st_draw_vbo (ctx=0x98cd438, arrays=0x990c928, prims=0xbff76fac, nr_prims=1, ib=0x0, index_bounds_valid=1 '\001', min_index=0, max_index=3) at src/mesa/state_tracker/st_draw.c:649
#10 0x01849725 in vbo_draw_arrays (ctx=0x98cd438, mode=7, start=0, count=4, numInstances=1) at src/mesa/vbo/vbo_exec_array.c:588
#11 0x0184988c in vbo_exec_DrawArrays (mode=7, start=0, count=4) at src/mesa/vbo/vbo_exec_array.c:619
#12 0x0804dddc in piglit_draw_rect (x=-1, y=-1, w=2, h=2) at piglit/tests/util/piglit-util.c:734
#13 0x0804c003 in piglit_display () at piglit/tests/shaders/shader_runner.c:673
#14 0x0804e93f in display () at piglit/tests/util/piglit-framework.c:52
#15 0x005f9820 in fghRedrawWindow (window=0x988f050, enumerator=0xbff772a8) at freeglut_main.c:210
#16 fghcbDisplayWindow (window=0x988f050, enumerator=0xbff772a8) at freeglut_main.c:227
#17 0x005fd660 in fgEnumWindows (enumCallback=0x5f9790 <fghcbDisplayWindow>, enumerator=0xbff772a8) at freeglut_structure.c:394
#18 0x005f9cdb in fghDisplayAll () at freeglut_main.c:249
#19 glutMainLoopEvent () at freeglut_main.c:1450
#20 0x005fa605 in glutMainLoop () at freeglut_main.c:1498
#21 0x0804eae8 in main (argc=2, argv=0xbff77534) at piglit/tests/util/piglit-framework.c:118
(gdb) frame 1
#1  0x01875ec5 in src_register (t=0xbff75548, file=PROGRAM_UNIFORM, index=-1024) at src/mesa/state_tracker/st_mesa_to_tgsi.c:228
228	      assert(index >= 0);
(gdb) print index
$1 = -1024
Comment 1 Marek Olšák 2010-11-21 13:38:20 UTC
glsl-fs-uniform-array-6 surpasses hardware limits of r300 (it uses 1024 vec4s, while only 256 are supported).

To "fix" this for r300, the test should check for GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB and skip accordingly (there's a patch in ML which sets MaxUniformComponents in st/mesa).

I am reassigning this bug to Mesa core, because the assertion failure is outside the driver.
Comment 2 Brian Paul 2010-11-23 16:37:48 UTC
Created attachment 40524 [details] [review]
check register indexes during linking

Can you try this patch?  It adds checking to the linker to see if any hardware/driver limits are exceeded.

This isn't ideal, however.  Since register allocation is the driver's job now, the number of Mesa temp registers used may exceed the gl_program_constants::MaxTemps value but be reduced to a smaller set of temps in the driver.  The linker should call into the driver during linking to give the driver a chance to check/report resource-exceeded errors.
Comment 3 Vinson Lee 2010-11-23 20:14:40 UTC
I tested check-registers.patch (id=40524).

glsl-fs-uniform-array-6 now checks for GL_MAX_FRAGMENT_UNIFORM_COMPONENTS. I removed that check when testing the patch.


The test no longer crashes and now gracefully fails.

$ ./bin/shader_runner tests/shaders/glsl-fs-uniform-array-6.shader_test -auto
radeon: Successfully grabbed chipset info from kernel!
radeon: DRM version: 2.5.0 ID: 0x71c5 GB: 1 Z: 2
radeon: GART size: 509 MB VRAM size: 128 MB
radeon: HyperZ: NO
Failed to link:
Register CONST[1026] exceeds implementation limits.

PIGLIT: {'result': 'fail' }
Comment 4 David Heidelberg (okias) 2013-10-04 20:25:43 UTC
3 years old bug.
Tested on r300g, git 2013-10-04.
Piglit test is skipped with message:
Test requires max fragment uniform components >= 4097.  The driver supports 128.


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.