Bug 44749

Summary: [bisected i965] oglc pxtrans-cidraw(basic.allCases) regressed
Product: Mesa Reporter: fangxun <xunx.fang>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: chadversary
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 42993, 43327    

Description fangxun 2012-01-13 01:13:54 UTC
System Environment:
--------------------------
Arch:           i386
platform:     huronriver
Libdrm:         (master)2.4.30-1-g66518ab5653cfdc840cd69e7b653ec05df060584
Mesa:           (master)90d654b09d98fc597ca273c65c2b1b00a9c35f09
Xf86_video_intel: (master)2.17.0-385-g7290ced5791f9860b00901fa9a4545ab5a067fae
Xserver:        (master)xorg-server-1.11.99.901
Kernel:    (drm-intel-next) d8e70a254d8f2da141006e496a51502b79115e80

Bug detailed description:
------------------------- 
It regressed from pass to fail on Sandybridge and Ironlake. 
Bisect shows 1c177452005a0366db01629d875da553f7949ddd is the first bad commit.
commit 1c177452005a0366db01629d875da553f7949ddd
Author:     Ian Romanick <ian.d.romanick@intel.com>
AuthorDate: Fri Jan 6 16:26:49 2012 -0800
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Wed Jan 11 12:51:24 2012 -0800

    i965: Don't use _mesa_ir_link_shader to do our dirty work

    Instead, do the uniform setting and input / output mapping directly in
    brw_link_shader.  Hurray for not generating Mesa IR!  However, once
    the i965 driver stops calling _mesa_ir_link_shader, UsesClipDistance
    and UsesKill are no longer set.

    Ideally gen6_upload_vs_push_constants should use the
    gl_shader_program, but I don't see a way to propagate the information
    there.  The other alternative, since this is the only usage, is to
    move gl_vertex_program::UsesClipDistance to brw_vertex_program.

    The compile (and precompile) stages use UsesKill to determine the
    cache key for the shader.  This is then used to determine whether or
    not to compile the shader.  Calculating this data during compilation
    is too late.

    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Acked-by: Kenneth Graunke <kenneth@whitecape.org>
    Acked-by: Eric Anholt <eric@anholt.net>


Below cases also failed due to the same bisect commit.

Cases failed on sandybridge:
zbfunc(basic.glAlways.bitmap)
zbfunc(basic.glLess.bitmap) 
zbfunc(basic.glLequal.bitmap) 
zbfunc(basic.glNotEqual.bitmap) 
pxtrans-draw(advanced.extendedTransfers) 
pxtrans-draw(advanced.iterateTypeFormats.scaleBias) 
pxtrans-draw(advanced.iterateTypeFormats.pixelMaps)

Cases failed on Ironlake:
mustpass(basic.pixelTransfer)
drawpix(basic.colorIndex) 
dlist(basic.allCases) 
api-texcoord(basic.allCases
bitmap-draw(basic.allCases) 
bitmap-transfer(basic.allCases) 
pxtrans-cidraw(basic.allCases) 
pxtrans-draw(basic.scaleBias) 
pxtrans-draw(basic.pixelMaps
pxtrans-draw(advanced.extendedTransfers)
pxtrans-draw(advanced.dlists) 
pxtrans-draw(advanced.iterateTypeFormats.scaleBias
pxtrans-draw(advanced.iterateTypeFormats.pixelMaps)
pxtrans-draw(advanced.logicOP)
pxtrans-draw(advanced.depthTest)
pxtrans-draw(advanced.stencilTest)
pxtrans-draw(misc.lights)
texenv(basic.allCases) 
texgen(basic.allCases) 
colorsum(basic.allCases) 
api-mtexcoord(basic.allCases)
api-fogcoord(basic.allCases)
api-seccolor(basic.allCases)
draw-buffers2(misc.blending.frontAndBack)
draw-buffers2(misc.mask.frontAndBack)
pxtrans-copy(basic.scaleBias.noFbo)
pxtrans-copy(basic.scaleBias.separatareFbo) 
pxtrans-copy(basic.scaleBias.fbo)
pxtrans-copy(basic.pixelMaps.noFbo) 
pxtrans-copy(basic.pixelMaps.separatareFbo 
pxtrans-copy(basic.pixelMaps.fbo)
pxtrans-copy(advanced.extendedTransfers.noFbo)
pxtrans-copy(advanced.extendedTransfers.separatareFbo)
pxtrans-copy(advanced.extendedTransfers.fbo)
pxtrans-copy(advanced.dlists)
pxtrans-copy(advanced.iterateTypeFormats.scaleBias.noFbo)
pxtrans-copy(advanced.iterateTypeFormats.scaleBias.separatareFbo) 
pxtrans-copy(advanced.iterateTypeFormats.scaleBias.fbo)
pxtrans-copy(advanced.iterateTypeFormats.pixelMaps.noFbo) 
pxtrans-copy(advanced.iterateTypeFormats.pixelMaps.separatareFbo) 
pxtrans-copy(advanced.iterateTypeFormats.pixelMaps.fbo)
pxtrans-copy(advanced.logicOP.noFbo) 
pxtrans-copy(advanced.logicOP.separatareFbo 
pxtrans-copy(advanced.logicOP.fbo) 
pxtrans-copy(advanced.depthTest.noFbo) 
pxtrans-copy(advanced.depthTest.separatareFbo) 
pxtrans-copy(advanced.depthTest.fbo)
pxtrans-copy(advanced.stencilTest.noFbo) 
pxtrans-copy(advanced.stencilTest.separatareFbo) 
pxtrans-copy(advanced.stencilTest.fbo)
pxtrans-copy(misc.lights.noFbo) 
pxtrans-copy(misc.lights.separatareFbo)
pxtrans-copy(misc.lights.fbo) 


Reproduce steps:
----------------
1. start X
2. ./oglconform -z -s -suite all -v 2 -test pxtrans-cidraw basic.allCases
Comment 1 fangxun 2012-01-18 00:59:00 UTC
It also happens on mesa 8.0 branch.
Comment 2 Ian Romanick 2012-01-19 17:04:30 UTC
The failure occurs when there is a shader generated for fixed-function and glDrawPixels has to use _swrast_DrawPixels.  Eventually the call to _swrast_DrawPixels will get into _mesa_execute_program.  However, since _mesa_ir_link_shader is never called, there is no Mesa IR to execute.
Comment 3 Ian Romanick 2012-01-24 15:24:41 UTC
Fixed on Mesa master by:

commit 9be3be3c6654da18466626c2d45ff4d06b5fb953
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Jan 19 17:29:37 2012 -0800

    swrast: Use fixed-function processing instead _TexEnvProgram for DrawPixels
    
    This is a hack to work around drivers such as i965 that:
    
        - Set _MaintainTexEnvProgram to generate GLSL IR for
          fixed-function fragment processing.
        - Don't call _mesa_ir_link_shader to generate Mesa IR from the
          GLSL IR.
        - May use swrast to handle glDrawPixels.
    
    Since _mesa_ir_link_shader is never called, there is no Mesa IR to
    execute.  Instead do regular fixed-function processing.
    
    Even on platforms that don't need this, the software fixed-function
    code is much faster than the software shader code.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44749
Comment 4 Chad Versace 2012-01-25 11:04:22 UTC
Cherry-picking this commit to 8.0 (specifically, atop 19f88670b528827f201bba2a996405d230cedc1b) does not fix zbfunc(basic.glAlways.bitmap) on Sandybridge. Ian, any idea why?
Comment 5 Chad Versace 2012-01-25 11:25:01 UTC
(In reply to comment #4)
> Cherry-picking this commit to 8.0 (specifically, atop
> 19f88670b528827f201bba2a996405d230cedc1b) does not fix
> zbfunc(basic.glAlways.bitmap) on Sandybridge. Ian, any idea why?

The reason is that use_fragment_program is incorrectly set to true because
   ctx->FragmentProgram._Current = a valid pointer
   ctx->FragmentProgram._TexEnvProgram = null
Comment 6 Chad Versace 2012-01-25 11:34:18 UTC
When cherry picking this patch (9be3be3), patch 34db7a8 must also be cherry picked.
Comment 7 Ian Romanick 2012-01-28 12:18:33 UTC
Fix on 8.0 by:

commit d51ec2bc2487f5284dd555255dd213742d4bf5f1
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Jan 19 17:29:37 2012 -0800

    swrast: Use fixed-function processing instead _TexEnvProgram for DrawPixels
    
    This is a hack to work around drivers such as i965 that:
    
        - Set _MaintainTexEnvProgram to generate GLSL IR for
          fixed-function fragment processing.
        - Don't call _mesa_ir_link_shader to generate Mesa IR from the
          GLSL IR.
        - May use swrast to handle glDrawPixels.
    
    Since _mesa_ir_link_shader is never called, there is no Mesa IR to
    execute.  Instead do regular fixed-function processing.
    
    Even on platforms that don't need this, the software fixed-function
    code is much faster than the software shader code.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44749
    (cherry picked from commit 9be3be3c6654da18466626c2d45ff4d06b5fb953)

commit a0d4675b312241ec797014921c9b2468cbff56d6
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Jan 19 17:23:51 2012 -0800

    mesa: Make sure _TexEnvProgram points at the current ff fragment program
    
    At least one place, the _mesa_need_secondary_color function in
    state.h, uses this to make decisions.  The next patch in this series
    will add another dependency.  Ideally, this field would go away and be
    replace by a flag or something.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    (cherry picked from commit 34db7a8c1e775aaefad7952133e087f1c1a569f6)
Comment 8 Ouping Zhang 2012-01-30 22:13:54 UTC
System Environment:
--------------------------
Libdrm:         (master)2.4.30-18-gb643b0713aefdc0611e47654e88263b53b0de6f5
Mesa:           (master)f9f8ce3ead04b5334bb323c37ec1f905ca5f58b2
Xserver:                (master)xorg-server-1.11.99.902
Xf86_video_intel:               (master)2.17.0-599-gca252e5b51d7b2f5a7b2c2e0d8fdb024b08096db

with the latest mesa, this issue has been fixed.

(In reply to comment #7)
> Fix on 8.0 by:
> commit d51ec2bc2487f5284dd555255dd213742d4bf5f1
> Author: Ian Romanick <ian.d.romanick@intel.com>
> Date:   Thu Jan 19 17:29:37 2012 -0800
>     swrast: Use fixed-function processing instead _TexEnvProgram for DrawPixels
>     This is a hack to work around drivers such as i965 that:
>         - Set _MaintainTexEnvProgram to generate GLSL IR for
>           fixed-function fragment processing.
>         - Don't call _mesa_ir_link_shader to generate Mesa IR from the
>           GLSL IR.
>         - May use swrast to handle glDrawPixels.
>     Since _mesa_ir_link_shader is never called, there is no Mesa IR to
>     execute.  Instead do regular fixed-function processing.
>     Even on platforms that don't need this, the software fixed-function
>     code is much faster than the software shader code.
>     NOTE: This is a candidate for the 8.0 branch.
>     Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
>     Reviewed-by: Brian Paul <brianp@vmware.com>
>     Reviewed-by: Eric Anholt <eric@anholt.net>
>     Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44749
>     (cherry picked from commit 9be3be3c6654da18466626c2d45ff4d06b5fb953)
> commit a0d4675b312241ec797014921c9b2468cbff56d6
> Author: Ian Romanick <ian.d.romanick@intel.com>
> Date:   Thu Jan 19 17:23:51 2012 -0800
>     mesa: Make sure _TexEnvProgram points at the current ff fragment program
>     At least one place, the _mesa_need_secondary_color function in
>     state.h, uses this to make decisions.  The next patch in this series
>     will add another dependency.  Ideally, this field would go away and be
>     replace by a flag or something.
>     NOTE: This is a candidate for the 8.0 branch.
>     Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
>     Reviewed-by: Brian Paul <brianp@vmware.com>
>     Reviewed-by: Eric Anholt <eric@anholt.net>
>     (cherry picked from commit 34db7a8c1e775aaefad7952133e087f1c1a569f6)
Comment 9 Ouping Zhang 2012-01-30 22:51:38 UTC
System Environment:
--------------------------
Libdrm:         (master)2.4.30-18-gb643b0713aefdc0611e47654e88263b53b0de6f5
Mesa:           (8.0)caebd7929dca802ece8ef36b0f85094d66133b57
Xserver:                (server-1.11-branch)xorg-server-1.11.3
Xf86_video_intel:               (master)2.17.0-599-gca252e5b51d7b2f5a7b2c2e0d8fdb024b08096db

verify with mesa 8.0 branch, this case also can pass. so it has been 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.