Bug 44971

Summary: [bisected i965]piglit glean/bufferObject regressed
Product: Mesa Reporter: fangxun <xunx.fang>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: eric
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 42993    

Description fangxun 2012-01-19 23:18:43 UTC
System Environment:
--------------------------
Arch:           x86_64
Platform:       Sugarbay
Libdrm:         (master)2.4.30-1-g66518ab5653cfdc840cd69e7b653ec05df060584
Mesa:           (8.0)c85402aba91755808729fadf57a9f92285f4e61a
Xserver:                (server-1.11-branch)xorg-server-1.11.3
Xf86_video_intel:(master)2.17.0-478-g35f81005f91d294e61bb4ced7cbddd1a76ccb324
Kernel:         (drm-intel-fixes) 8109021313c7a3d8947677391ce6ab9cd0bb1d28

Bug detailed description:
------------------------- 
It segfaults on Sandybridge and ironlake.
(gdb) bt
#0  intel_emit_linear_blit (intel=0x9abb60, dst_bo=0x981250, dst_offset=1139, src_bo=0x9ab8c0, src_offset=547, size=1) at intel_blit.c:495
#1  0x00007ffff611cc5f in intel_bufferobj_copy_subdata (ctx=0x9abb60, src=0x9810f0, dst=<optimized out>, read_offset=547, write_offset=1139, size=1)
    at intel_buffer_objects.c:693
#2  0x00000000004ac112 in GLEAN::BufferObjectTest::testCopyBuffer (this=0x7a5ac0) at /GFX/Test/Piglit/piglit/tests/glean/tbufferobject.cpp:153
#3  0x00000000004ac6bd in GLEAN::BufferObjectTest::runOne (this=0x7a5ac0, r=..., w=...) at /GFX/Test/Piglit/piglit/tests/glean/tbufferobject.cpp:271
#4  0x00000000004ad608 in GLEAN::BaseTest<GLEAN::BufferObjectResult>::run (this=0x7a5ac0, environment=...) at /GFX/Test/Piglit/piglit/tests/glean/tbase.h:325
#5  0x0000000000490d3c in main (argc=9, argv=0x7fffffffe1e8) at /GFX/Test/Piglit/piglit/tests/glean/main.cpp:141


Reproduce steps:
----------------
1. start X
2. glean -r /tmp/piglit_temp/results/glean/bufferObject -o -v -v -v -t +bufferObject
Comment 1 fangxun 2012-01-20 00:13:31 UTC
Bisect shows 8aa7fa770c4ae7660b37ea9d8f496bd6e62d3df8 is the first bad commit.
commit 8aa7fa770c4ae7660b37ea9d8f496bd6e62d3df8
Author:     Eric Anholt <eric@anholt.net>
AuthorDate: Tue Dec 27 17:22:30 2011 -0800
Commit:     Eric Anholt <eric@anholt.net>
CommitDate: Wed Jan 4 09:51:17 2012 -0800

    intel: Fix pitch handling for linear blits.

    The new assert in intelEmitCopyBlit() gets angry if we don't align to
    dwords.  Rather than make the assert have a special case for height ==
    1 on the assumption that the hardware doesn't use it in that case,
    just supply a correct pitch.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43214
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Comment 2 Ian Romanick 2012-01-23 10:25:52 UTC
My guess is that this only occurs when *not* run in quick mode.
Comment 3 Eric Anholt 2012-01-25 15:16:43 UTC
Yeah, random number generator eventually picks a number that fails.  I'll build a decent test instead and fix this.
Comment 4 Ian Romanick 2012-02-02 15:58:28 UTC
Patch posted to mesa-dev mailing list:

http://lists.freedesktop.org/archives/mesa-dev/2012-February/018628.html
Comment 5 Ian Romanick 2012-02-07 17:13:34 UTC
Fixed on 8.0 branch by:

commit cf4a7c41f6f2594ce4e8841ae1b268568f4ad1a7
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Feb 2 16:32:45 2012 -0700

    intel: Avoid divide by zero for very small linear blits
    
    If size is small (such as 1),
    
       pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 1), 4);
    
    makes pitch = 0.  Then
    
       height = size / pitch;
    
    causes a division-by-zero exception.  If pitch is zero, set height to
    1 and avoid the division.
    
    This fixes piglit's bin/getteximage-formats test and glean's
    bufferObject test.
    
    NOTE: This is a candidate for the 8.0 release branch.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44971
    (cherry picked from commit d59466279e45a1e9c3f9081f72fedbdf961afbe1)
Comment 6 fangxun 2012-02-09 22:26:17 UTC
Verified with Mesa 8.0 branch(e86d90eb20) and master branch(26de5273acf1ebe).

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.