Bug 78691

Summary: [G45 - Tesseract] Mesa 10.1.2 implementation error: Unsupported opcode 169872468 in FS
Product: Mesa Reporter: Francesco Frassinelli <fraph24>
Component: Drivers/DRI/i965Assignee: Kenneth Graunke <kenneth>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: 10.1   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Level loaded with MESA_GLSL=dump and INTEL_DEBUG=fs

Description Francesco Frassinelli 2014-05-14 10:13:38 UTC
Application: Tesseract First Edition (May 11, 2014) - http://tesseract.gg
GPU: Intel GMA X4500 (i915)
OS: Debian Sid/Experimental, Linux 3.14-1-amd64

I get a "Mesa [...] implementation error: Unsupported opcode [...] in FS" message when Tesseract has just almost finished to load the level (it's showing "Generating environment maps").

Same problem on Mesa 9.1.7.
Opcode might vary. Some examples:
- 169872468
- 175232132
- 176859492
- 187507668
- 187715684
- 190536388
- 240634644


(gdb) run
Starting program: /home/frafra/Scaricati/tesseract/src/tess_client -u/home/frafra/.tesseract
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Using home directory: /home/frafra/.tesseract/
init: sdl
[New Thread 0x7fffecdbf700 (LWP 5372)]
[New Thread 0x7fffe6fad700 (LWP 5373)]
[Thread 0x7fffe6fad700 (LWP 5373) exited]
init: net
init: game
init: video
init: gl
Renderer: Mesa DRI Intel(R) G45/G43  (Intel Open Source Technology Center)
Driver: 2.1 Mesa 10.1.2
GLSL: 1.20
Rendering using the OpenGL GLSL shader path.
init: console
init: world
init: sound
[New Thread 0x7fffe6fad700 (LWP 5374)]
init: cfg
init: render
init: mainloop
read map media/map/complex.ogz (0.1 seconds)
Mesa 10.1.2 implementation error: Unsupported opcode 190536388 in FS
Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa

Program received signal SIGABRT, Aborted.
0x00007ffff61133a9 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) backtrace
#0  0x00007ffff61133a9 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff61164c8 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007fffebf4ddef in fs_generator::generate_code (
    this=this@entry=0x7ffffffd5e20, instructions=<optimized out>, 
    dump_file=dump_file@entry=0x0)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_fs_generator.cpp:1804
#3  0x00007fffebf4f08a in fs_generator::generate_assembly (
    this=0x7ffffffd5e20, simd8_instructions=<optimized out>, 
    simd16_instructions=0x0, assembly_size=0x7fffffff6c9c, dump_file=0x0)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_fs_generator.cpp:1857
#4  0x00007fffebf3fe78 in brw_wm_fs_emit (brw=brw@entry=0xafd5e8, 
    c=c@entry=0xbb7c3e8, fp=fp@entry=0xb223a70, prog=prog@entry=0xb1c6a18, 
    final_assembly_size=final_assembly_size@entry=0x7fffffff6c9c)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_fs.cpp:3522
#5  0x00007fffebfa6bfe in do_wm_prog (brw=brw@entry=0xafd5e8, prog=0xb1c6a18, 
    fp=fp@entry=0xb223a70, key=key@entry=0x7fffffff6ce0)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_wm.c:190
#6  0x00007fffebfa7753 in brw_upload_wm_prog (brw=0xafd5e8)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_wm.c:568
#7  0x00007fffebf7795a in brw_upload_state (brw=0xafd5e8)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_state_upload.c:645
#8  0x00007fffebf27fd7 in brw_try_draw_prims (indirect=<optimized out>, 
    max_index=<optimized out>, min_index=<optimized out>, ib=<optimized out>, 
    nr_prims=<optimized out>, prims=<optimized out>, arrays=<optimized out>, 
    ctx=0xafd5e8)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_draw.c:487
#9  brw_draw_prims (ctx=0xafd5e8, prims=<optimized out>, 
    nr_prims=<optimized out>, ib=<optimized out>, 
    index_bounds_valid=<optimized out>, min_index=0, max_index=3, 
    unused_tfb_object=0x0, indirect=0x0)
    at ../../../../../../../src/mesa/drivers/dri/i965/brw_draw.c:581
#10 0x00007fffebd8572d in vbo_draw_arrays (ctx=0xafd5e8, mode=5, start=0, 
    count=4, numInstances=1, baseInstance=0)
    at ../../../../src/mesa/vbo/vbo_exec_array.c:661
#11 0x0000000000437eab in gle::end () at shared/glemu.cpp:299
#12 0x000000000052160a in rhquad (x1=0, x1@entry=0,241379321, 
    y1=1,43145777e-38, y1@entry=-0,310344875, x2=0, x2@entry=0,931034505, 
    y2=0, y2@entry=0,379310369, tx1=0, tx1@entry=-127,851761, 
    ty1=7,31477798e-43, ty1@entry=-127,851883, tx2=0, tx2@entry=1150,66675, 
    ty2=0, ty2@entry=1150,66663, tz=tz@entry=1086,74084)
    at engine/renderlights.cpp:3388
#13 0x000000000053b235 in radiancehints::renderslices (this=0x9bdec0 <rh>)
    at engine/renderlights.cpp:3661
#14 0x000000000053dd5f in renderradiancehints ()
    at engine/renderlights.cpp:3751
#15 0x000000000051c8ea in drawcubemap (size=size@entry=256, o=..., 
    yaw=yaw@entry=90, pitch=pitch@entry=0, side=..., 
    onlysky=onlysky@entry=false) at engine/rendergl.cpp:2265
#16 0x00000000005ecf7a in genenvmap (o=..., envmapsize=<optimized out>, 
    blur=0, onlysky=<optimized out>) at engine/texture.cpp:2603
#17 0x00000000005edb73 in genenvmaps () at engine/texture.cpp:2688
#18 0x00000000004ded45 in allchanged (load=load@entry=true)
    at engine/octarender.cpp:1740
#19 0x0000000000633844 in load_world (
    mname=mname@entry=0x9e3b80 <game::parsemessages(int, gameent*, databuf<unsigned char>&)::text> "complex", cname=cname@entry=0x0) at engine/worldio.cpp:871
#20 0x00000000006437ca in game::changemapserv (
    name=name@entry=0x9e3b80 <game::parsemessages(int, gameent*, databuf<unsigned char>&)::text> "complex", mode=<optimized out>) at game/client.cpp:573
#21 0x0000000000649566 in game::parsemessages (cn=cn@entry=-1, d=d@entry=0x0, 
    p=...) at game/client.cpp:1337
#22 0x000000000064b86f in game::parsepacketclient (chan=<optimized out>, p=...)
    at game/client.cpp:1945
#23 0x000000000045f426 in localservertoclient (chan=<optimized out>, 
    packet=<optimized out>) at engine/client.cpp:206
#24 0x00000000006616c3 in server::sendwelcome (ci=0x4409bc0)
    at game/server.cpp:1688
#25 0x0000000000668bcc in server::connected (ci=ci@entry=0x4409bc0)
    at game/server.cpp:2710
#26 0x000000000066f661 in server::parsepacket (sender=sender@entry=0, chan=1, 
    p=...) at game/server.cpp:2756
#27 0x00000000005be3b3 in process (packet=<optimized out>, sender=0, 
    chan=<optimized out>) at engine/server.cpp:345
#28 0x0000000000646399 in game::sendintro () at game/client.cpp:1076
#29 0x00000000006496c7 in game::parsemessages (cn=cn@entry=-1, d=d@entry=0x0, 
    p=...) at game/client.cpp:1261
#30 0x000000000064b86f in game::parsepacketclient (chan=<optimized out>, p=...)
    at game/client.cpp:1945
#31 0x000000000045f426 in localservertoclient (chan=<optimized out>, 
    packet=<optimized out>) at engine/client.cpp:206
#32 0x00000000005bc547 in sendf (cn=0, chan=chan@entry=1, format=0x6a4508 "", 
    format@entry=0x6a4503 "ri5ss") at engine/server.cpp:261
#33 0x0000000000663027 in sendservinfo (ci=0x4409bc0) at game/server.cpp:2397
#34 server::localconnect (n=<optimized out>) at game/server.cpp:2415
#35 0x0000000000471daf in runcode (code=0x440994c, result=...)
    at engine/command.cpp:2599
#36 0x0000000000470f4a in runcode (code=0x4411504, result=...)
    at engine/command.cpp:2292
#37 0x0000000000471def in runcode (code=0x4411510, code@entry=0x4411494, 
    result=...) at engine/command.cpp:2599
#38 0x0000000000474b05 in executeret (code=code@entry=0x4411494, result=...)
    at engine/command.cpp:2805
#39 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x44038f0, contents=contents@entry=0x4411494)
    at engine/ui.cpp:494
#40 0x00000000005ff6e2 in UI::_icmd_uitarget<3146>::run (minw=0x7fffffffaa80, 
    minh=0x7fffffffaa90, children=0x4411494) at engine/ui.cpp:3145
#41 0x0000000000471eea in runcode (code=0x44115a4, code@entry=0x4411484, 
    result=...) at engine/command.cpp:2599
#42 0x000000000046f173 in runcode (code=0x26f1b4c, code@entry=0x26f1a54, 
    result=...) at engine/command.cpp:2719
#43 0x000000000047626d in execute (code=code@entry=0x26f1a54)
    at engine/command.cpp:2903
#44 0x00000000004764fc in looplist (id=0x269dc20, list=<optimized out>, 
    body=0x26f1a54) at engine/command.cpp:3574
#45 0x0000000000471eea in runcode (code=0x26f1b54, code@entry=0x26f19d4, 
    result=...) at engine/command.cpp:2599
#46 0x0000000000470067 in runcode (code=0x26f19d4, code@entry=0x26f17f8, 
    result=...) at engine/command.cpp:2258
#47 0x0000000000474b05 in executeret (code=code@entry=0x26f17f8, result=...)
    at engine/command.cpp:2805
#48 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x4403730, contents=contents@entry=0x26f17f8)
    at engine/ui.cpp:494
#49 0x0000000000604d5f in UI::_icmd_uivlist<3111>::run (space=0x7fffffffc0f0, 
    children=0x26f17f8) at engine/ui.cpp:3110
#50 0x000000000047444c in runcode (code=0x26f1b74, code@entry=0x26f17d4, 
    result=...) at engine/command.cpp:2599
#51 0x0000000000474b05 in executeret (code=code@entry=0x26f17d4, result=...)
    at engine/command.cpp:2805
#52 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x4403210, contents=contents@entry=0x26f17d4)
    at engine/ui.cpp:494
#53 0x00000000005fe8fe in UI::_icmd_uiscroll<3152>::run (clipw=0x7fffffffc6a0, 
    cliph=0x7fffffffc6b0, children=0x26f17d4) at engine/ui.cpp:3151
#54 0x0000000000471eea in runcode (code=0x26f1b7c, code@entry=0x26f1130, 
    result=...) at engine/command.cpp:2599
#55 0x0000000000474b05 in executeret (code=code@entry=0x26f1130, result=...)
    at engine/command.cpp:2805
#56 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x3e6d0e0, contents=contents@entry=0x26f1130)
    at engine/ui.cpp:494
#57 0x0000000000604c0f in UI::_icmd_uihlist<3108>::run (space=0x7fffffffcc50, 
    children=0x26f1130) at engine/ui.cpp:3107
#58 0x000000000047444c in runcode (code=0x26f1ba4, code@entry=0x26f110c, 
    result=...) at engine/command.cpp:2599
#59 0x0000000000474b05 in executeret (code=code@entry=0x26f110c, result=...)
    at engine/command.cpp:2805
#60 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x3e6d040, contents=contents@entry=0x26f110c)
    at engine/ui.cpp:494
#61 0x00000000005ff292 in UI::_icmd_uispace<3137>::run (spacew=0x7fffffffd200, 
    spaceh=0x7fffffffd210, children=0x26f110c) at engine/ui.cpp:3136
#62 0x0000000000471eea in runcode (code=0x26f1bac, code@entry=0x26f10e8, 
    result=...) at engine/command.cpp:2599
#63 0x0000000000474b05 in executeret (code=code@entry=0x26f10e8, result=...)
    at engine/command.cpp:2805
#64 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x3e6cff0, contents=contents@entry=0x26f10e8)
    at engine/ui.cpp:494
#65 0x0000000000600cf2 in UI::_icmd_uicolor<3197>::run (c=0x7fffffffd7c0, 
    minw=0x7fffffffd7d0, minh=0x7fffffffd7e0, children=0x26f10e8)
    at engine/ui.cpp:3196
#66 0x0000000000471f5e in runcode (code=0x26f1bb4, code@entry=0x26f0e70, 
    result=...) at engine/command.cpp:2599
#67 0x0000000000474b05 in executeret (code=code@entry=0x26f0e70, result=...)
    at engine/command.cpp:2805
#68 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x4411bd0, contents=contents@entry=0x26f0e70)
    at engine/ui.cpp:494
#69 0x0000000000604d5f in UI::_icmd_uivlist<3111>::run (space=0x7fffffffdd70, 
    children=0x26f0e70) at engine/ui.cpp:3110
#70 0x000000000047444c in runcode (code=0x26f1bbc, result=...)
    at engine/command.cpp:2599
#71 0x0000000000474b05 in executeret (code=<optimized out>, result=...)
    at engine/command.cpp:2805
#72 0x0000000000613db2 in UI::Object::buildchildren (
    this=this@entry=0x269f710, contents=<optimized out>) at engine/ui.cpp:494
#73 0x00000000005fe1e4 in build (this=0x269f710) at engine/ui.cpp:784
#74 build (this=0x267b980) at engine/ui.cpp:701
#75 UI::update () at engine/ui.cpp:3474
#76 0x000000000040d875 in main (argc=<optimized out>, argv=<optimized out>)
    at engine/main.cpp:1212
Comment 1 Ian Romanick 2014-05-14 21:39:20 UTC
It looks like the opcode field is either uninitialized or is getting overwritten with garbage somehow.

Can you run with the environment variables 'MESA_GLSL=dump' and 'INTEL_DEBUG=fs' set, and attach the output?
Comment 2 Francesco Frassinelli 2014-05-15 06:45:02 UTC
Created attachment 99060 [details]
Level loaded with MESA_GLSL=dump and INTEL_DEBUG=fs
Comment 3 Kenneth Graunke 2014-05-27 18:05:38 UTC
I haven't reproduced this specific "Unsupported opcode" failure, but attempting to compile those shaders has turned up all kinds of bugs in the texture rectangle coordinate scaling code, including writes past the end of an array.

I've fixed that, but apparently we were papering over some other bugs as well, so now I'm having to fix those... :)

Thanks for the report!
Comment 4 Francesco Frassinelli 2014-05-27 18:10:25 UTC
(In reply to comment #3)
> Thanks for the report!

Thanks for fixing those bugs :)
Comment 5 Kenneth Graunke 2014-05-28 01:15:58 UTC
I decided to try an alternate approach, which should be easier to backport to the stable branches.

The patch is on the mailing list:
http://lists.freedesktop.org/archives/mesa-dev/2014-May/060136.html

I don't know if this is sufficient to fix Tesseract, but I can compile all of the shaders in the attachment now.  So it seems likely.
Comment 6 Kenneth Graunke 2014-05-28 20:13:27 UTC
Okay, that is upstream as:

commit bb9623a1a8b1884817422752c8dced9f084d4547
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Tue May 27 18:16:01 2014 -0700

    i965: Fix repeated usage of rectangle texture coordinate scaling.
    
    Previously, we set up new entries in the params[] array on every access
    of a rectangle texture.  Unfortunately, we only reserve space for
    (2 * MaxTextureImageUnits) extra entries, so programs which accessed
    rectangle textures more times than that would write off the end of the
    array and likely crash.
    
    We don't really have a decent mapping between the index returned by
    _mesa_add_state_reference and our index into the params array, so we
    have to manually search for it.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78691
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Cc: mesa-stable@lists.freedesktop.org

Would it be possible for you to try Mesa master?
Comment 7 Francesco Frassinelli 2014-05-29 07:24:08 UTC
Sure! I've tested it and there's only a graphical glitch on some types of surfaces and I don't know if it could be related with this bug.

For example, my gun has the correct texture, but it could be totally green or orange or brown depending on the environment colours, and it could became of another colour just moving it by a couple of pixel. Similar problem for glasses: most of the time they are not transparent, but just flat coloured. Some lights reflections could disappear from a surface in the same way. Maybe it's some kind of illumination glitch, but I don't know if it's related or not with this bug.

By the way, no crashes and no Mesa unsupported opcode errors :)

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.