Bug 49668 - [Bisected i965]Piglit fbo/fbo-depth-array regressed
Summary: [Bisected i965]Piglit fbo/fbo-depth-array regressed
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: All Linux (All)
: low minor
Assignee: marius predut
QA Contact: Intel 3D Bugs Mailing List
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords:
: 53522 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-08 22:38 UTC by lu hua
Modified: 2015-05-08 01:30 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description lu hua 2012-05-08 22:38:05 UTC
System Environment:
--------------------------
Arch:            i386
Platform:        Sandybridge
Libdrm:		(master)2.4.33-20-gd72a44c7c4f5eea9c1e5bb0c36cb9e0224b9ca22
Mesa:		(master)d6aa7cd7f82a3695243e1ecb1c73cdb796b12523
Xf86_video_intel:(master)2.19.0-25-g4ba366ead3a133136554579fe9a604da1fc1da68
Libva:		(vaapi-ext)f12f80371fb534e6bbf248586b3c17c298a31f4e
Libva_intel_driver:(vaapi-ext)82fa52510a37ab645daaa3bb7091ff5096a20d0b
Kernel:	    (drm-intel-next-queued) b615b57a124a4af7b68196bc2fb8acc236041fa2

Bug detailed description:
-----------------------------
It fails on sandybridge, ivybridge and ironlake with mesa master branch.It doesn't happen on mesa 8.0 branch.
Following cases also fail with the same commit:
spec_ARB_depth_buffer_float_fbo-clear-formats
spec_ARB_depth_texture_fbo-clear-formats
spec_EXT_packed_depth_stencil_fbo-clear-formats

Bisect shows a683012a80a3408b3b71f22b2a97d9eaaac11a46 is the first bad commit
commit a683012a80a3408b3b71f22b2a97d9eaaac11a46
Author:     Paul Berry <stereotype441@gmail.com>
AuthorDate: Thu Apr 26 06:35:56 2012 -0700
Commit:     Paul Berry <stereotype441@gmail.com>
CommitDate: Mon May 7 10:50:04 2012 -0700

    i965/Gen6: Work around GPU hangs due to misaligned depth coordinate offsets.

    In i965 Gen6, Mesa has for a long time used the "depth coordinate
    offset X/Y" settings (in 3DSTATE_DEPTH_BUFFER) to cause the GPU to
    render to miplevels other than 0.  Unfortunately, this doesn't work,
    because these offsets must be aligned to multiples of 8, and miplevels
    in the depth buffer are only guaranteed to be aligned to multiples of
    4.  When the offsets aren't aligned to a multiple of 8, the GPU
    sometimes hangs.

    As a temporary measure, to avoid GPU hangs, this patch smashes the 3
    LSB's of "depth coordinate offset X/Y" to 0.  This results in
    incorrect rendering to mipmapped depth textures, but that seems like a
    reasonable stopgap while we figure out a better solution.

    (Note that we have only ever observed this GPU hang on Gen6 when HiZ
    is enabled, so another possible stopgap would be to disable HiZ).

    Avoids GPU hangs in piglit test "depthstencil-render-miplevels" at
    texture sizes that are not powers of 2.

    Reviewed-by: Chad Verace <chad.versace@linux.intel.com>


Reproduce steps:
----------------------------
1. start X
2. ./bin/fbo-depth-array -auto
Comment 1 Paul Berry 2012-05-22 12:22:11 UTC
This was an expected regression.  As the commit message indicates, the patch intentionally causes incorrect rendering in order to avoid a GPU hangs (which would be much worse).  The test is failing because of the intentional incorrect rendering.

The incorrect rendering only happens in a rare use case (mipmapped depth and stencil textures), and it only happens when the texture alignment is poor (which should only happen for non-power-of-two surfaces, and for the tiniest miplevels of a power-of-two surface), so the incorrect rendering is very unlikely to cause actual problems for users.  A lot of work would be required to get correct rendering and avoid GPU hangs, so we've decided not to address this bug further unless it causes a problem in a real-world application.

Accordingly, I'm adjusting the importance of this bug to low/minor.  If we find a real-world application that doesn't render correctly because of this bug, we can escalate.
Comment 2 Gordon Jin 2012-08-16 07:40:47 UTC
*** Bug 53522 has been marked as a duplicate of this bug. ***
Comment 3 Gordon Jin 2012-08-16 07:42:14 UTC
this is caused by https://bugs.freedesktop.org/show_bug.cgi?id=50271
Comment 4 Eric Anholt 2012-12-23 00:21:44 UTC
fbo-depth-array now passes on my IVB system.
Comment 5 lu hua 2012-12-24 02:49:34 UTC
Fixed on ivybridge with mesa master branch.

It still happens on mesa 9.0 branch.

fbo/fbo-depth-array still fails on sandybridge, Ironlake with master branch..
output:
[root@x-pk2 bin]# ./fbo-depth-array -auto
WARNING: Depth/stencil buffer needs alignment to 8-pixel boundaries.
Truncating offset, bad rendering may occur.
Probe at (34,27)
  Expected: 0.200000 0.200000 0.200000
  Observed: 0.000000 0.000000 0.000000
Probe at (67,29)
  Expected: 0.400000 0.400000 0.400000
  Observed: 0.000000 0.000000 0.000000
Probe at (100,31)
  Expected: 0.600000 0.600000 0.600000
  Observed: 0.000000 0.000000 0.000000
Probe at (166,27)
  Expected: 1.000000 1.000000 1.000000
  Observed: 0.000000 0.000000 0.000000
PIGLIT: {'result': 'fail' }

Following cases fixed on sandybridge, ivybridge and ironlake with mesa master branch:
spec_ARB_depth_buffer_float_fbo-clear-formats
spec_ARB_depth_texture_fbo-clear-formats
spec_EXT_packed_depth_stencil_fbo-clear-formats
Comment 6 Ian Romanick 2012-12-24 02:57:24 UTC
Do we have any idea which commit(s) on master fixed the problem? Are these candidates to pick to 9.0?
Comment 7 lu hua 2012-12-24 06:59:50 UTC
Fixed on master branch by commit 7139ab80ca9b1b3572ef6da98765ca783e8e5e3b(except fbo/fbo-depth-array).
commit 7139ab80ca9b1b3572ef6da98765ca783e8e5e3b
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Aug 8 09:03:26 2012 -0700

    i965: Fix rendering to small mipmaps of depth/stencil buffers using a temp mt.

    Fixes 51 piglit tests (fbo-clear-formats, and most of the remaining failures
    in depthstencil).


fbo/fbo-depth-array fixed on Ivybridge by commit 9f0f2f9512c3c9dcf875efa490b587f010b260c1.
commit 9f0f2f9512c3c9dcf875efa490b587f010b260c1
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jul 2 17:10:09 2012 +0200

    mesa: use FLUSH_CURRENT and not FLUSH_VERTICES in _mesa_validate_*

    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH_WITH_RETVAL calls FLUSH_VERTICES, which
    is not what we want.

    This fixes a breakage in classic drivers, introduced in:

      62b971673950148eb949ba23d7fdc47debea16f0
      vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way around

    It should fix:
      https://bugs.freedesktop.org/show_bug.cgi?id=51629
      https://bugs.freedesktop.org/show_bug.cgi?id=51642

fbo/fbo-depth-array still fails on sandybridge and ironlake.
Comment 8 Eric Anholt 2013-02-06 21:44:49 UTC
No, they're way too invasive.
Comment 9 lu hua 2013-02-27 01:39:25 UTC
Still fails on sandybridge and ironlake.
output:
WARNING: Depth/stencil buffer needs alignment to 8-pixel boundaries.
Truncating offset, bad rendering may occur.
Probe at (34,1)
  Expected: 0.200000 0.200000 0.200000
  Observed: 0.298039 0.298039 0.298039
Probe at (100,1)
  Expected: 0.600000 0.600000 0.600000
  Observed: 0.098039 0.098039 0.098039
Probe at (166,1)
  Expected: 1.000000 1.000000 1.000000
  Observed: 0.501961 0.501961 0.501961
PIGLIT: {'result': 'fail' }
Comment 10 marius predut 2015-05-06 18:54:14 UTC
I can't reproduce it with latest mesa upstream (commit commit 0c0ca557117edd3a57443f4f454c3a8da1d4e0b5)
Comment 11 Matt Turner 2015-05-06 20:50:00 UTC
Make sure to keep intel-3d-bugs@ in the email list.
Comment 12 lu hua 2015-05-08 01:29:56 UTC
Test on the latest Mesa master branch, it works well.
output:
Testing 32x32x6
PIGLIT: {"result": "pass" }
Comment 13 lu hua 2015-05-08 01:30:12 UTC
Verified.Fixed.


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.