Bug 61093 - [llvmpipe] lp_surface.c:68:lp_resource_copy: Assertion `src_box->depth == 1' failed.
Summary: [llvmpipe] lp_surface.c:68:lp_resource_copy: Assertion `src_box->depth == 1' ...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Roland Scheidegger
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-02-19 02:23 UTC by Vinson Lee
Modified: 2013-02-20 18:41 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2013-02-19 02:23:48 UTC
mesa: 07cdfdb708ac28aa487a738db30b128cb0df1dc3 (master)

Run piglit test texsubimage on llvmpipe.

$ ./bin/texsubimage -auto
Using test set: Core formats
src/gallium/drivers/llvmpipe/lp_surface.c:68:lp_resource_copy: Assertion `src_box->depth == 1' failed.
Trace/breakpoint trap (core dumped)

(gdb) bt
#0  0x00007f45cd5c145f in _debug_assert_fail (expr=0x7f45cdef06aa "src_box->depth == 1", 
    file=0x7f45cdef0680 "src/gallium/drivers/llvmpipe/lp_surface.c", line=68, 
    function=0x7f45cdef0850 <__FUNCTION__.11411> "lp_resource_copy") at src/gallium/auxiliary/util/u_debug.c:278
#1  0x00007f45cd284d9c in lp_resource_copy (pipe=0x23fd280, dst=0x98eeeb0, dst_level=0, dstx=0, dsty=0, dstz=0, 
    src=0x977c930, src_level=0, src_box=0x7fff1362c374) at src/gallium/drivers/llvmpipe/lp_surface.c:68
#2  0x00007f45cd5dfcd9 in util_try_blit_via_copy_region (ctx=0x23fd280, blit=0x7fff1362c340)
    at src/gallium/auxiliary/util/u_surface.c:630
#3  0x00007f45cd285220 in lp_blit (pipe=0x23fd280, blit_info=0x7fff1362c4f0)
    at src/gallium/drivers/llvmpipe/lp_surface.c:189
#4  0x00007f45cd3c31d6 in st_TexSubImage (ctx=0x246bcf0, dims=3, texImage=0x9b33bf0, xoffset=0, yoffset=0, zoffset=0, 
    width=128, height=64, depth=8, format=6408, type=5121, pixels=0x9bb0c30, unpack=0x2472688)
    at src/mesa/state_tracker/st_cb_texture.c:776
#5  0x00007f45cd3c33b2 in st_TexImage (ctx=0x246bcf0, dims=3, texImage=0x9b33bf0, format=6408, type=5121, 
    pixels=0x9bb0c30, unpack=0x2472688) at src/mesa/state_tracker/st_cb_texture.c:806
#6  0x00007f45cd37d7f7 in teximage (ctx=0x246bcf0, compressed=0 '\000', dims=3, target=32879, level=0, internalFormat=3, 
    width=128, height=64, depth=8, border=0, format=6408, type=5121, imageSize=0, pixels=0x9bb0c30)
    at src/mesa/main/teximage.c:3091
#7  0x00007f45cd37da7d in _mesa_TexImage3D (target=32879, level=0, internalFormat=3, width=128, height=64, depth=8, 
    border=0, format=6408, type=5121, pixels=0x9bb0c30) at src/mesa/main/teximage.c:3146
#8  0x00007f45cfb59f11 in stub_glTexImage3D (target=32879, level=0, internalformat=3, width=128, height=64, depth=8, 
    border=0, format=6408, type=5121, pixels=0x9bb0c30)
    at piglit/tests/util/generated_dispatch.c:27319
#9  0x00000000004023d1 in test_format (target=32879, intFormat=3)
    at piglit/tests/texturing/texsubimage.c:262
#10 0x000000000040293b in test_formats (target=32879) at piglit/tests/texturing/texsubimage.c:369
#11 0x0000000000402999 in piglit_display () at piglit/tests/texturing/texsubimage.c:393
#12 0x00007f45cfb21680 in display ()
    at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:60
#13 0x00007f45cf4ccfc4 in ?? () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#14 0x00007f45cf4d0719 in fgEnumWindows () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#15 0x00007f45cf4cd45c in glutMainLoopEvent () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#16 0x00007f45cf4cdd81 in glutMainLoop () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#17 0x00007f45cfb21852 in run_test (gl_fw=0x7f45cfdf3c00 <glut_fw>, argc=1, argv=0x7fff1362cd68)
    at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:127
#18 0x00007f45cfb1f971 in piglit_gl_test_run (argc=1, argv=0x7fff1362cd68, config=0x7fff1362cc50)
    at piglit/tests/util/piglit-framework-gl.c:127
#19 0x0000000000401d8e in main (argc=2, argv=0x7fff1362cd68)
    at piglit/tests/texturing/texsubimage.c:46
(gdb) frame 1
#1  0x00007f45cd284d9c in lp_resource_copy (pipe=0x23fd280, dst=0x98eeeb0, dst_level=0, dstx=0, dsty=0, dstz=0, 
    src=0x977c930, src_level=0, src_box=0x7fff1362c374) at src/gallium/drivers/llvmpipe/lp_surface.c:68
68	   assert(src_box->depth == 1);
(gdb) print src_box->depth
$1 = 8

0a1479c829ed34a65e60c6619a8164e1b079aaee is the first bad commit
commit 0a1479c829ed34a65e60c6619a8164e1b079aaee
Author: Marek Olšák <maraeo@gmail.com>
Date:   Thu Feb 14 01:03:55 2013 +0100

    st/mesa: implement blit-based TexImage and TexSubImage
    
    A temporary texture is created such that it matches the format and type
    combination and pixels are copied to it using memcpy. Then the blit is used to
    copy the temporary texture to the texture image being modified by TexImage or
    TexSubImage. The blit takes care of the format and type conversion and
    swizzling. The result is a very fast texture upload involving as little CPU
    as possible.
    
    This improves performance in apps which upload textures during rendering.
    An example is the Wine OpenGL backend for DirectDraw, which I used to test
    the game StarCraft. Profiling had shown that TexSubImage was taking 50% of
    CPU time without this patch, which was the main motivation for this work, and
    now TexSubImage only takes 14% of CPU time. I had to underclock my CPU to see
    any difference in the game and this patch does make the game a lot faster
    if the CPU is slow (or using the powersave cpufreq profile).
    
    Reviewed-by: Brian Paul <brianp@vmware.com>

:040000 040000 15f59d627914f821f5c58d91645e765c16dee900 9556e542ef992b9d4d1aca566b96e31e715d3999 M	src
bisect run success
Comment 1 Marek Olšák 2013-02-19 12:04:46 UTC
The assertion in lp_resource_copy can be fixed easily, but I can't reproduce it. llvmpipe is failing a different assertion here:

texsubimage: /home/marek/dev/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:539: const llvm::SDValue &llvm::SDNode::getOperand(unsigned int) const: Assertion `Num < NumOperands && "Invalid child # of SDNode!"' failed.

The way I see it, my work only uncovered this bug.
Comment 2 Jose Fonseca 2013-02-19 14:28:05 UTC
(In reply to comment #1)
> The assertion in lp_resource_copy can be fixed easily, but I can't reproduce
> it. 

Roland already has fix for review on mesa3d-dev.

> llvmpipe is failing a different assertion here:
> 
> texsubimage:
> /home/marek/dev/llvm/include/llvm/CodeGen/SelectionDAGNodes.h:539: const
> llvm::SDValue &llvm::SDNode::getOperand(unsigned int) const: Assertion `Num
> < NumOperands && "Invalid child # of SDNode!"' failed.

This must be something different.

> The way I see it, my work only uncovered this bug.

Yes, I agree.
Comment 3 Roland Scheidegger 2013-02-20 18:41:57 UTC
Fixed by 95181ed2fdf1c3accb4b34daaea89c2dd509f87d.


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.