Bug 49772 - [SNB]Oglc depth-stencil(basic.read.ds) regressed
Summary: [SNB]Oglc depth-stencil(basic.read.ds) regressed
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: high major
Assignee: Kenneth Graunke
QA Contact:
URL:
Whiteboard:
Keywords:
: 44963 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-10 22:33 UTC by lu hua
Modified: 2012-08-21 05:17 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description lu hua 2012-05-10 22:33:51 UTC
System Environment:
--------------------------
Arch:           i386
Platform:       Sandybridge
Libdrm:		(master)2.4.33-20-gd72a44c7c4f5eea9c1e5bb0c36cb9e0224b9ca22
Mesa:		(master)729d9148244551c6bcae00a760f39a6902c925ef
Xserver:        (master)xorg-server-1.12.0-136-ge501c34d4937d5e6f19abd29f1ec7f95faa3bb55
Xf86_video_intel:(master)2.19.0-36-ga3d37fb29f8dffb0e370ad95783994aaa7eccfaf
Libva:		(vaapi-ext)f12f80371fb534e6bbf248586b3c17c298a31f4e
Libva_intel_driver:(vaapi-ext)82fa52510a37ab645daaa3bb7091ff5096a20d0b
Kernel:	  (drm-intel-next-queued) 38e490fea7d2885d79fcd1ca37edb64e489d470d

Bug detailed description:
------------------------- 
It failed on Sandybridge with mesa master and 8.0 branch. 
This case has Bug 44963 on SNB GT2.
The last known good commit:1bd3dafeca90f1293acd9b9ab63bf617139bfacf
The last known bad commit: 729d9148244551c6bcae00a760f39a6902c925ef

Reproduce steps:
----------------
1. start X
2. ./oglconform -z -suite all -v 2 -D 116 -test depth-stencil basic.read.ds
Comment 1 Eric Anholt 2012-08-06 15:54:06 UTC
When making a bug report, please show at least an excerpt of the actual failure report.

Bisect?

I get failure on both 8.0 and master on ivb, with minor accuracy errors.
Comment 2 Gordon Jin 2012-08-07 03:40:38 UTC
Hua to bisect.
Comment 3 lu hua 2012-08-07 03:46:04 UTC
In process.
Comment 4 lu hua 2012-08-08 04:26:32 UTC
Bisect shows: a7ac9c9c7dc7401ca6143d1e7476df5e3c2758b7 is the first bad commit.
commit a7ac9c9c7dc7401ca6143d1e7476df5e3c2758b7
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Apr 23 18:11:38 2012 +0200

    vbo: move vbo_draw_method into vbo_context.h

But, revert the commit, this issue still exists. I will re-check.
Comment 5 lu hua 2012-08-09 04:25:51 UTC
Visual Report:
ID      |ACCELERA|DB      |REND_T  |SURF_T  |C_BUF_T |BUF_S   |RED_S   |
     141|       1|       1|      gl|  wipbpx|    rgba|      32|       8|

GREEN_S |BLUE_S  |ALPHA_S |DEPTH_S |STENC_S |ACCUM_S |SPL_BUF |SAMPLES |
       8|       8|       8|      24|       8|      64|       0|       0|

SRGB    |TEX_RGB |TEX_RGBA|CAVEAT  |SWAP    |M_PBUF_W|M_PBUF_H|M_PBUF_P
      -1|       0|       0|    slow|   undef|       0|       0|       0

OpenGL Report.
    Vendor - 'Intel Open Source Technology Center'
    Renderer - 'Mesa DRI Intel(R) Sandybridge Desktop x86/MMX/SSE2'
    Version - '3.0 Mesa 8.1-devel (git-7528e21)' (3.0)
    GLSL Version - '1.30'
    Context Flags - None

>> Depth Stencil test (depth-stencil)  test:
--> 1.3.1 - basic.read.ds subcase:
    File - /GFX/build/testsuite/Oglconform_31/oglconform_31/src/OGLconform/depth-stencil.c, line - 1791.
        Error wrong output color values

Subcase Id: 1.3.1
Subcase Name: basic.read.ds
Title: Verify that OGL API allows depth stencil buffers read operation using DEPTH_STENCIL_EXT
Test Purpose:
Test should verify that for depth stencil buffers it is possible to use
GL_DEPTH_STENCIL_EXT and GL_UNSIGNED_INT_24_8_EXT while read operation.


Test Method:
Define basic shape of depth and stencil buffers in form of two neighbor quads.
Try to render two additional quads larger that those two wrote to depth/stencil buffers.
Left quad is red the right one is blue. Read back rendered buffers and verify colors
Read cycles should be performed several time in a loop with different region settings


Pass Criteria:
Test passes if updated and rendered buffers match with expected with defined epsilon
.
--------------------------
--< 1.3.1 - basic.read.ds subcase failed.
<< Depth Stencil test (depth-stencil)  test failed. (1 of 1 subcases)

Intel Conformance failed.
Total Passed : 0
Total Failed : 1
Total Not run: 0
Comment 6 Kenneth Graunke 2012-08-13 00:27:02 UTC
*** Bug 44963 has been marked as a duplicate of this bug. ***
Comment 7 Kenneth Graunke 2012-08-13 08:09:24 UTC
It turns out that the super-hardware-specific bug was actually a one line mistake in Mesa's software depth span unpacking code.  The original commit mentioned in #44963 changed DrawPixels to use a different unpack path, and that path happened to be slightly broken.

Patch out for review on the mailing list:
http://lists.freedesktop.org/archives/mesa-dev/2012-August/025590.html
Comment 8 Kenneth Graunke 2012-08-14 04:36:59 UTC
commit 605f964d5cc7016fc74e0563829fa794da845c20
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Aug 13 00:35:41 2012 -0700

    mesa: Use GLdouble for depthMax in final unpack conversions.
    
    The final step of _mesa_unpack_depth_span is to take the temporary
    GLfloat depth values and convert them to the desired format.  When
    converting to GL_UNSIGNED_INTEGER with depthMax > 0xffffff, we use
    double-precision math to avoid overflow and precision problems.
    
    Or at least that's the idea.  Unfortunately
    
       GLdouble z = depthValues[i] * (GLfloat) depthMax;
    
    actually causes single-precision multiplication, since both operands are
    GLfloats.  Casting depthMax to GLdouble causes the scaling to be done
    with double-precision math.
    
    Fixes a regression in oglconform's depth-stencil basic.read.ds test
    since c60ac7b17993d28af65b04f9bbbf3ee74c35358c, where the expected and
    actual values differed slightly.  For example, 0xcfa7a6 vs. 0xcfa7a4.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49772
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Comment 9 lu hua 2012-08-17 06:35:09 UTC
It fixed on mesa master commit 1597176f7090eea73f41b3114ae2a02a50ac7a12.

Can't find "mesa: Use GLdouble for depthMax in final unpack conversions." on mesa 8.0 branch. It still fail on mesa 8.0 branch.
Comment 10 Kenneth Graunke 2012-08-17 06:55:15 UTC
Thanks.  I just cherry-picked it to 8.0.
Comment 11 lu hua 2012-08-21 05:17:14 UTC
Verified. Fixed by 57295009e895b1d39c083c3873fdeaf4dadd778b on 8.0 branch.

commit 57295009e895b1d39c083c3873fdeaf4dadd778b
Author:     Kenneth Graunke <kenneth@whitecape.org>
AuthorDate: Mon Aug 13 00:35:41 2012 -0700
Commit:     Kenneth Graunke <kenneth@whitecape.org>
CommitDate: Thu Aug 16 23:50:28 2012 -0700

    mesa: Use GLdouble for depthMax in final unpack conversions.


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.