Bug 77702

Summary: [i965 Bisected]Piglit spec/NV_conditional_render_blitframebuffer fails
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i965Assignee: Anuj Phogat <anuj.phogat>
Status: VERIFIED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: major    
Priority: high CC: idr
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description lu hua 2014-04-21 01:44:04 UTC
System Environment:
--------------------------
Platform: Ironlake
Libdrm:		(master)libdrm-2.4.53-6-gd4083dc762a2974c35ecd16be995272bbb6d57b4
Mesa:		(master)ba6dcb3c2b8f516b120f591144bf6c3751f0e3f9
Xserver:	(master)xorg-server-1.15.99.902-20-gc7011249d2abe6cc7af82ee4b79d8f6873444707
Xf86_video_intel:(master)2.99.911-89-g08e71e1820d6fcb6829b4ebd360beadc1f250295
Libva:		(staging)5e10a246287fa2dd3fae2bf756a5b33087cc097c
Libva_intel_driver:(staging)782b8afdda14f000874d8acf51c3e8c490d55773
Kernel:	(drm-intel-nightly)1e771b84e47085ef9b6efea1321e7cb5a8b2c06

Bug detailed description:
-----------------------------
It fails on i965 platforms with mesa master branch, and works well on 10.1 branch.
Bisect shows:1d350b9e228462390b1883abace24c15d4741932 is the first bad commit.
commit 1d350b9e228462390b1883abace24c15d4741932
Author:     Anuj Phogat <anuj.phogat@gmail.com>
AuthorDate: Fri Apr 4 16:49:19 2014 -0700
Commit:     Anuj Phogat <anuj.phogat@gmail.com>
CommitDate: Thu Apr 17 10:26:39 2014 -0700

    i965: Add glBlitFramebuffer to commands affected by conditional rendering

    Fixes failures in Khronos OpenGL CTS test conditional_render_test9

    Cc: <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

output:
Probe color at (0,16)
  Expected: 0.000000 1.000000 0.000000 0.000000
  Observed: 1.000000 0.000000 0.000000 0.000000
PIGLIT: {'result': 'fail' }

Reproduce steps:
---------------------------- 
1. xinit
2. ./bin/nv_conditional_render-blitframebuffer -auto
Comment 1 Ian Romanick 2014-04-21 16:00:11 UTC
I think the test is incorrect.  

Section 10.10 (Conditional Rendering) of the OpenGL 4.4 spec says:

    "If the result (SAMPLES_PASSED) of the query is zero, or if the
    result (ANY_SAMPLES_PASSED or ANY_SAMPLES_PASSED_CONSERVATIVE)
    is false, all rendering commands described in section 2.4 are
    discarded and have no effect when issued between
    BeginConditionalRender and the corresponding EndConditionalRender."

Section 2.4 (Rendering Commands) says:

    "Such commands are called rendering commands, and include the
    drawing commands *Draw* (see section 10.5), as well as these
    additional commands:

        • BlitFramebuffer (see section 18.3.1)
        • Clear (see section 17.4.3)
        • ClearBuffer* (see section 17.4.3.1)
        • DispatchCompute* (see section 19)"

It would have been much better to have these spec references in the commit message and the in-code comments than the reference that is there.  Oh well.

Out of curiosity... Does this test pass as-is on NVIDIA or AMD?
Comment 2 Samuel Iglesias Gonsálvez 2014-04-22 08:44:50 UTC
I have tested it in my laptop (with Optimus and the proprietary driver) and it failed:

$ optirun ./bin/nv_conditional_render-blitframebuffer -auto
Probe color at (0,16)
  Expected: 0.000000 1.000000 0.000000 0.000000
  Observed: 1.000000 0.000000 0.000000 0.000000
PIGLIT: {'result': 'fail' }

Info about my system:

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVS 4200M/PCIe/SSE2
OpenGL core profile version string: 4.3.0 NVIDIA 331.49
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
Comment 3 David Heidelberg (okias) 2014-05-19 00:48:13 UTC
Probe color at (0,0)
  Expected: 0.000000 1.000000 0.000000 0.000000
  Observed: 1.000000 0.000000 0.000000 0.000000
PIGLIT: {'result': 'fail' }

Also on r600g it fails (mesa-git, kernel 3.15-git, HD 6550)
Comment 4 Anuj Phogat 2014-05-21 17:15:53 UTC
Fixed the piglit test case with this commit. Now, test passes on mesa master with i965 drivers:

commit 0364f161c9b41b7b1fe94f7b761241ccfdca4981
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Fri Apr 25 16:35:34 2014 -0700

    Fix expected behavior of glBlitFramebuffer() with conditional rendering
    
    It is clarified on page 679 of OpenGL 4.4 core profile spec:
       "Added BlitFramebuffer to commands affected by conditional
        rendering in section 10.10 (Bug 9562)."
    
    This addition is also made to OpenGL 4.4 compatibility profile spec.
    
    Tests the bug fix made in mesa commits 1d350b9 and 8ed42dd:
    "i965: Add glBlitFramebuffer to commands affected by conditional
    rendering"
    
    Previous to this patch, this test fail on NVIDIA 4200M (driver
    version 331.49), as reported by Samuel Iglesias.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77702
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Tested-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Comment 5 lu hua 2014-05-23 01:59:01 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.