Bug 27142

Summary: piglit "glean/pbo -o -v" test dumps core
Product: Mesa Reporter: Chris Rankin <rankincj>
Component: Drivers/DRI/R600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Chris Rankin 2010-03-17 15:34:48 UTC
This test passes NULL as a destination address to memcpy():

Core was generated by `bin/glean -r foo -t pbo -o -v'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000003963882fe1 in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install expat-2.0.1-8.fc12.x86_64 glibc-2.11.1-1.x86_64 libICE-1.0.6-1.fc12.x86_64 libSM-1.1.0-7.fc12.x86_64 libX11-1.3-1.fc12.x86_64 libXau-1.0.5-1.fc12.x86_64 libXdamage-1.1.2-1.fc12.x86_64 libXext-1.1-2.fc12.x86_64 libXfixes-4.0.4-1.fc12.x86_64 libXi-1.3-2.fc12.x86_64 libXmu-1.0.5-1.fc12.x86_64 libXt-1.0.7-1.fc12.x86_64 libXxf86vm-1.1.0-1.fc12.x86_64 libdrm-2.4.18-0.1.fc12.x86_64 libgcc-4.4.3-4.fc12.x86_64 libjpeg-6b-46.fc12.x86_64 libstdc++-4.4.3-4.fc12.x86_64 libtiff-3.9.2-3.fc12.x86_64 libuuid-2.16.2-7.fc12.x86_64 libxcb-1.5-1.fc12.x86_64 zlib-1.2.3-23.fc12.x86_64
(gdb) where
#0  0x0000003963882fe1 in memcpy () from /lib64/libc.so.6
#1  0x00007ff6de05baba in copy_rows (dst=0x0, dststride=<value optimized out>, 
    src=0x7ff6dd917000, srcstride=<value optimized out>, numrows=100, 
    rowsize=<value optimized out>) at radeon_texture.c:68
#2  0x00007ff6de04c359 in do_blit_readpixels (ctx=<value optimized out>, 
    x=<value optimized out>, y=<value optimized out>, width=100, height=100, 
    format=32993, type=5121, pack=0x1c6b7d0, pixels=0x0)
    at radeon_pixel_read.c:165
#3  radeonReadPixels (ctx=<value optimized out>, x=<value optimized out>, 
    y=<value optimized out>, width=100, height=100, format=32993, type=5121, 
    pack=0x1c6b7d0, pixels=0x0) at radeon_pixel_read.c:182
#4  0x00007ff6de0bae78 in _mesa_ReadPixels (x=<value optimized out>, 
    y=<value optimized out>, width=100, height=100, format=32993, type=5121, 
    pixels=0x0) at main/readpix.c:200
#5  0x00000000004d5d88 in GLEAN::PBOTest::testDrawPixels (this=0x79ec20)
    at /home/chris/Programs/piglit/tests/glean/tpbo.cpp:299
#6  0x00000000004d865b in GLEAN::PBOTest::testFunctionality (this=0x79ec20, r=
    ...) at /home/chris/Programs/piglit/tests/glean/tpbo.cpp:1110
#7  0x00000000004d8c70 in GLEAN::PBOTest::runSubTests (this=0x79ec20, r=...)
    at /home/chris/Programs/piglit/tests/glean/tpbo.cpp:1247
#8  0x00000000004d8d00 in GLEAN::PBOTest::runOne (this=0x79ec20, r=..., w=...)
    at /home/chris/Programs/piglit/tests/glean/tpbo.cpp:1264
#9  0x0000000000498af2 in GLEAN::BaseTest<GLEAN::MultiTestResult>::run (
    this=0x79ec20, environment=...)
    at /home/chris/Programs/piglit/tests/glean/tbase.h:320
#10 0x00000000004906ec in main (argc=7, argv=0x7fff82f7f1a8)
    at /home/chris/Programs/piglit/tests/glean/main.cpp:141
Comment 1 Chris Rankin 2010-03-18 13:38:56 UTC
This test is failing in these following statements from glean/tpbo.cpp:

            glGenBuffersARB_func(1, pb_pack);
            glBindBufferARB_func(GL_PIXEL_PACK_BUFFER_ARB, pb_pack[0]);
            glBufferDataARB_func(GL_PIXEL_PACK_BUFFER_ARB,
                         windowSize * windowSize * 4 *
                         sizeof(GL_UNSIGNED_BYTE), NULL, GL_STREAM_DRAW);
            glReadPixels(0, 0, windowSize, windowSize, GL_BGRA,
                         GL_UNSIGNED_BYTE, NULL);

I am assuming that glReadPixels() is expected to write into a named buffer object rather than a user-supplied buffer, because its final "data" parameter is NULL. However, r600_dri.so tries to write into the "data" parameter anyway. Hence "BANG".
Comment 2 Andreas Boll 2012-09-11 11:45:49 UTC
Note: classic r600 driver has been abandoned.

works without any segfault with r600g (gallium driver) on my rv770
tested with mesa git master e81ee67b51651e99e7e8e52c1ccafc66835d57cd
and mesa 8.0.4

test result:
9 tests passed, 1 tests failed.
Comment 3 Andreas Boll 2012-09-11 11:57:28 UTC
(In reply to comment #2)
> Note: classic r600 driver has been abandoned.
> 
> works without any segfault with r600g (gallium driver) on my rv770
> tested with mesa git master e81ee67b51651e99e7e8e52c1ccafc66835d57cd
> and mesa 8.0.4
> 
> test result:
> 9 tests passed, 1 tests failed.

the failing test is tracked in Bug 28049

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.