Bug 45578

Summary: main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: medium CC: idr, xunx.fang
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: don't use _mesa_format_to_type_and_comps() to choose color type
determine best span color type at buffer mapping time
assertion error on Haiku

Description Vinson Lee 2012-02-02 23:32:53 UTC
mesa: 84a1273e7fe1216a4724ab13cd061a12b48893c2 (master)

Run piglit fbo-mipmap-copypix on swrast.

$ ./bin/fbo-mipmap-copypix -auto
Mesa: Initializing x86-64 optimizations
fbo-mipmap-copypix: main/image.c:1659: _mesa_convert_colors: Assertion `dstType == 0x1403' failed.
Aborted (core dumped)

(gdb) bt
#0  0x00007fd272be73b5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007fd272beab1b in __GI_abort () at abort.c:92
#2  0x00007fd272bdfd2d in __GI___assert_fail (assertion=0x7fd270a0bf8c "dstType == 0x1403", 
    file=<optimized out>, line=1659, function=<optimized out>) at assert.c:81
#3  0x00007fd2708a500b in _mesa_convert_colors (srcType=5126, src=0x7fd26f4f2010, dstType=33640, 
    dst=0x7fd26f4f2010, count=512, mask=<optimized out>) at main/image.c:1659
#4  0x00007fd270997f78 in convert_color_type (newType=33640, span=<optimized out>, output=<optimized out>)
    at swrast/s_span.c:959
#5  _swrast_write_rgba_span (ctx=<optimized out>, span=<optimized out>) at swrast/s_span.c:1331
#6  0x00007fd270989e25 in copy_rgba_pixels (ctx=0x23fbb30, srcx=0, srcy=<optimized out>, width=512, 
    height=512, destx=0, desty=0) at swrast/s_copypix.c:192
#7  0x00007fd27098ad06 in _swrast_CopyPixels (ctx=0x23fbb30, srcx=0, srcy=0, width=512, height=512, destx=0, 
    desty=0, type=6144) at swrast/s_copypix.c:636
#8  0x00007fd27087d2cd in _mesa_CopyPixels (srcx=0, srcy=0, width=512, height=512, type=6144)
    at main/drawpix.c:232
#9  0x000000000042a131 in test_mipmap_copypixels (srcIntFormat=32856, dstIntFormat=32857, 
    doPixelTransfer=0 '\000', useReadDrawPix=0 '\000') at piglit/tests/fbo/fbo-mipmap-copypix.c:172
#10 0x000000000042a41c in piglit_display () at piglit/tests/fbo/fbo-mipmap-copypix.c:257
#11 0x000000000042aba1 in display () at piglit/tests/util/piglit-framework.c:56
#12 0x00007fd2732a7220 in fghRedrawWindow (window=0x23d9a70) at freeglut_main.c:210
#13 fghcbDisplayWindow (window=0x23d9a70, enumerator=0x7fffed297eb0) at freeglut_main.c:227
#14 0x00007fd2732aa939 in fgEnumWindows (enumCallback=0x7fd2732a7120 <fghcbDisplayWindow>, 
    enumerator=0x7fffed297eb0) at freeglut_structure.c:394
#15 0x00007fd2732a765a in fghDisplayAll () at freeglut_main.c:249
#16 glutMainLoopEvent () at freeglut_main.c:1450
#17 0x00007fd2732a7f0e in glutMainLoop () at freeglut_main.c:1498
#18 0x000000000042b310 in main (argc=1, argv=0x7fffed298208)
    at piglit/tests/util/piglit-framework.c:304
(gdb) frame 3
#3  0x00007fd2708a500b in _mesa_convert_colors (srcType=5126, src=0x7fd26f4f2010, dstType=33640, 
    dst=0x7fd26f4f2010, count=512, mask=<optimized out>) at main/image.c:1659
1659	         ASSERT(dstType == GL_UNSIGNED_SHORT);
(gdb) print /x dstType
$1 = 0x8368

piglit/tests/util/glew.h:1218:#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
piglit/tests/util/glew.h:6080:#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
Comment 1 Brian Paul 2012-02-03 07:20:43 UTC
*** Bug 45577 has been marked as a duplicate of this bug. ***
Comment 2 Brian Paul 2012-02-03 07:21:36 UTC
Created attachment 56575 [details] [review]
don't use _mesa_format_to_type_and_comps() to choose color type

Can you give this patch a try?
Comment 3 Ian Romanick 2012-02-03 10:03:00 UTC
(In reply to comment #2)
> Created attachment 56575 [details] [review] [review]
> don't use _mesa_format_to_type_and_comps() to choose color type
> 
> Can you give this patch a try?

I haven't tried it, but that patch looks completely reasonable.  We'll also need this fix on the 8.0 branch.
Comment 4 Vinson Lee 2012-02-04 00:12:29 UTC
(In reply to comment #2)
> Created attachment 56575 [details] [review] [review]
> don't use _mesa_format_to_type_and_comps() to choose color type
> 
> Can you give this patch a try?

Tested patch 56575. fbo-mipmap-copypix passes on swrast.

Tested-by: Vinson Lee <vlee@freedesktop.org>
Comment 5 Brian Paul 2012-02-06 11:47:54 UTC
Created attachment 56685 [details] [review]
determine best span color type at buffer mapping time

This version of the patch is more efficient.  Instead of calling the format query functions per-span, just do it per renderbuffer mapping.
Comment 6 Ian Romanick 2012-02-09 11:30:22 UTC
*** Bug 45818 has been marked as a duplicate of this bug. ***
Comment 7 Alexander von Gluck 2012-02-11 12:59:25 UTC
Created attachment 56902 [details]
assertion error on Haiku

Same assertion seen on Haiku while writing new swrast driver.
Comment 8 Brian Paul 2012-02-12 10:23:14 UTC
Fixed w/ commit bd1ae51b13535bc4438c663ffe91ded49db4890a

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.