Bug 43216

Summary: [bisected]olgc shad-compiler(advanced.TestTexture2D_FragShader) segfaults
Product: Mesa Reporter: fangxun <xunx.fang>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: brianp
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 42993    

Description fangxun 2011-11-24 01:14:46 UTC
System Environment:
--------------------------
Arch:           i386
Platform:       huronriver
Libdrm:         (master)2.4.27-2-gca4971292cf99e0063416cd1c3467af94637bf2b
Mesa:           (master)94cd9d6be8980f28fdb6b7a8526814802a90f25d
Xserver:                (master)xorg-server-1.11.99.1
Xf86_video_intel:(master)2.17.0-10-g3b9479dc39d32fd97f80c1e5e0fac67d36ee5e40
Kernel:  (drm-intel-next)9a10f401a401ca69c6537641c8fc0d6b57b5aee8


Bug detailed description:
------------------------- 
It segfaults on all platforms. Below oglc cases also segfault due to the same causes. 
oglc shad-compiler(advanced.TestTexture2D_FragShader)
oglc shad-compiler(advanced.TestTexture2DProj_vec3_FragShader)
oglc shad-compiler(advanced.TestTexture2DProj_vec4_FragShader) 
oglc shad-compiler(advanced.TestTextureCube_FragShader) 
oglc shad-compiler(advanced.TestShadow2DProj_FragShader)

Bisect shows 68da4b50e9b6aa72a9b155f650952620063e1b94 is the first bad commit.
commit 68da4b50e9b6aa72a9b155f650952620063e1b94
Author:     Brian Paul <brianp@vmware.com>
AuthorDate: Sun Oct 23 10:44:47 2011 -0600
Commit:     Brian Paul <brianp@vmware.com>
CommitDate: Sun Oct 23 10:44:47 2011 -0600

    mesa: add swrast_texture_image::Buffer

    In the past, swrast_texture_image::Data has been overloaded.  It could
    either point to malloc'd memory storing texture data, or it could point
    to a current mapping of GPU memory.

    Now, Buffer always points to malloc'd memory (if we're not using GPU
    memory) and Data always points to mapped memory.  The next step would
    be to rename Data -> Map.

    This change also involves adding swrast functions for mapping textures
    and renderbuffers prior to rendering to setup the Data pointer.  Plus,
    corresponding functions to unmap texures and renderbuffers.  This is
    very much like similar code in the dri drivers.


(gdb) bt
#0  0xb7b75510 in extract_float_rgba (n=128, rgba=0x9f8d778, srcFormat=6408, srcType=5126, src=0xa2ba9b8, swapBytes=0 '\000') at main/pack.c:2521
#1  0xb7b7736f in _mesa_unpack_color_span_ubyte (ctx=0x9a7d838, n=128, dstFormat=6408, dest=0x9f79e00 "", srcFormat=6408, srcType=5126, source=0xa2ba9b8,
    srcPacking=0xbfffdef0, transferOps=<value optimized out>) at main/pack.c:3724
#2  0xb7ba0de8 in _mesa_make_temp_ubyte_image (ctx=0x9a7d838, dims=3, logicalBaseFormat=6408, textureBaseFormat=6408, srcWidth=128, srcHeight=128, srcDepth=1, srcFormat=6408,
    srcType=5126, srcAddr=0xa25a1e8, srcPacking=0xbfffdef0) at main/texstore.c:608
#3  0xb7ba3056 in _mesa_texstore_argb8888 (ctx=0x9a7d838, dims=3, baseInternalFormat=6408, dstFormat=MESA_FORMAT_ARGB8888, dstXoffset=0, dstYoffset=0, dstZoffset=0,
    dstRowStride=2048, dstSlices=0x9e622c8, srcWidth=128, srcHeight=128, srcDepth=1, srcFormat=6408, srcType=5126, srcAddr=0xa25a1e8, srcPacking=0xbfffdef0)
    at main/texstore.c:1528
#4  0xb7b9d725 in _mesa_texstore (ctx=0x9a7d838, dims=3, baseInternalFormat=6408, dstFormat=MESA_FORMAT_ARGB8888, dstXoffset=0, dstYoffset=0, dstZoffset=0, dstRowStride=2048,
    dstSlices=0x9e622c8, srcWidth=128, srcHeight=128, srcDepth=1, srcFormat=6408, srcType=5126, srcAddr=0xa25a1e8, srcPacking=0xbfffdef0) at main/texstore.c:4455
#5  0xb7b9e1fc in _mesa_store_teximage3d (ctx=0x9a7d838, target=3553, level=2, internalFormat=6408, width=128, height=128, depth=1, border=0, format=6408, type=5126,
    pixels=0xa25a1e8, packing=0xbfffdef0, texObj=0x9ac35e8, texImage=0x9ea94c8) at main/texstore.c:4695
#6  0xb7aac431 in intelTexImage (ctx=0x9a7d838, dims=<value optimized out>, target=3553, level=2, internalFormat=6408, width=128, height=128, depth=1, format=6408, type=5126,
    pixels=0xa25a1e8, unpack=0xbfffdef0, texObj=0x9ac35e8, texImage=0x9ea94c8, imageSize=0) at intel_tex_image.c:353
#7  0xb7b97aa5 in teximage (ctx=0xbffef428, dims=2, target=3553, level=2, internalFormat=6408, width=128, height=128, depth=1, border=0, format=6408, type=5126,
    pixels=0xa25a1e8) at main/teximage.c:2447
#8  0xb7b984ae in _mesa_TexImage2D (target=3553, level=2, internalFormat=6408, width=130, height=130, border=1, format=6408, type=5126, pixels=0xa25a1e8)
    at main/teximage.c:2501
#9  0x08385a24 in Tex2DDrawLoop(char*, float*, float*, float*, unsigned char, unsigned char) ()
#10 0x083866cb in TestTexture2D_FragShader() ()
#11 0x0838883c in ShaderCompilerExec(testParameters*) ()
#12 0x08c63ed8 in callFunctionHandleExceptionsInner(long (*)(testParameters*), testParameters*, char*) ()
#13 0x08c64027 in callFunctionHandleExceptions(long (*)(testParameters*), testParameters*) ()
#14 0x08c62b49 in DriverExec(long (*)(testParameters*), testParameters*) ()
#15 0x08c4a305 in (anonymous namespace)::MyMessagePump::idle() ()
#16 0x08c2039a in MessagePump::process_messages() ()
#17 0x08c4b162 in ExecutionManager::execute_schedules() ()
#18 0x08bdd4cb in tkShellExecute(std::vector<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::vector<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&) ()
#19 0x08be60b2 in main ()



Reproduce steps:
----------------
1. start X
2. ./oglconform -z -s -suite all -v 2 -D 115 -test shad-compiler advanced.TestTexture2D_FragShad
Comment 1 fangxun 2011-12-26 23:06:21 UTC
It is fixed by:

commit 5c818c6277247468ccf69abda00f5bc220b59644
Author: Brian Paul 
Date: Sat Dec 24 08:54:27 2011 -0700

mesa: consolidate texstore functions

The code for storing 1D, 2D and 3D tex images (whole or sub-images) was
all pretty similar. This consolidates those six paths.

v2: rework switch statement to catch unexpected targets

Reviewed-by: José Fonseca
Comment 2 fangxun 2011-12-26 23:10:34 UTC
Verified with mesa master commit 3aa3c3f75894ca0eb08087c0ec3dd114eeae4bb7.

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.