Bug 78872

Summary: [ILK Bisected]Piglit spec_ARB_depth_buffer_float_fbo-depthstencil-GL_DEPTH32F_STENCIL8-blit Aborted
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i965Assignee: Topi Pohjolainen <topi.pohjolainen>
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:
Attachments: Fix

Description lu hua 2014-05-19 02:57:50 UTC
System Environment:
--------------------------
Platform: Ironlake
Libdrm:	(master)libdrm-2.4.54-8-g305478ce02ebd908a75c9830ecea15f6e2469b42
Mesa:	(master)5646319f25c7880b3706bb7590e24c84fd8de0fc
Xserver:(master)xorg-server-1.15.99.902-91-g01e18af17f8dc91451fbd0902049045afd1cea7e
Xf86_video_intel:(master)2.99.911-173-gdf297e9fafe1a7de1036f3151f93de67661c2a4e
Libva:	(staging)968ade9411de9c5ae2eead0a7e8755747a32a3a2
Libva_intel_driver:		(staging)1c4d3468229797e787f4b99b0729baf90a115a1d
Kernel:	(drm-intel-nightly)f79ba79cf037eea9ee757ad37730b00f43d5ef80

Bug detailed description:
-----------------------------
It fails on Ironlake with Mesa master branch and 10.2 branch.
Following cases also fails with same bisect commit:
spec_ARB_depth_buffer_float_fbo-depthstencil-GL_DEPTH32F_STENCIL8-blit
spec_ARB_depth_buffer_float_fbo-stencil-GL_DEPTH32F_STENCIL8-blit
spec_ARB_framebuffer_object_framebuffer-blit-levels_draw_stencil
spec_ARB_framebuffer_object_framebuffer-blit-levels_read_stencil
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX1-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX16-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX4-blit
spec_EXT_framebuffer_object_fbo-stencil-GL_STENCIL_INDEX8-blit
spec_EXT_packed_depth_stencil_fbo-blit-d24s8
spec_EXT_packed_depth_stencil_fbo-depthstencil-GL_DEPTH24_STENCIL8-blit
spec_EXT_packed_depth_stencil_fbo-stencil-GL_DEPTH24_STENCIL8-blit
spec_OpenGL_1.1_depthstencil-default_fb-blit

Bisect shows:b18f6b9b86531581da567eaa400923e35e22006d is the first bad commit
commit b18f6b9b86531581da567eaa400923e35e22006d
Author:     Topi Pohjolainen <topi.pohjolainen@intel.com>
AuthorDate: Sat Apr 19 17:11:10 2014 +0300
Commit:     Topi Pohjolainen <topi.pohjolainen@intel.com>
CommitDate: Thu May 15 21:39:33 2014 +0300

    i965/fb: Use meta path for stencil blits

    This is effective only on gen8 for now as previous generations still
    go through blorp.

    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

output:
Testing GL_DEPTH32F_STENCIL8.
Testing glBlitFramebuffer(depthstencil).
Mesa 10.3.0-devel implementation error: meta program compile failed:
0:1(10): error: GLSL 1.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

source:
#version 130
in vec2 position;
out vec2 tex_coords;
void main()
{
   tex_coords = (position + 1.0) / 2.0;
   gl_Position = vec4(position, 0.0, 1.0);
}


Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa
Mesa 10.3.0-devel implementation error: meta program compile failed:
0:1(10): error: GLSL 1.30 is not supported. Supported versions are: 1.10, 1.20, and 1.00 ES

source:
#version 130
uniform usampler2D texSampler;
uniform float src_x_scale;
uniform float src_y_scale;
uniform float src_x_off;
uniform float src_y_off;
uniform float dst_x_off;
uniform float dst_y_off;
uniform float draw_rect_w;
uniform float draw_rect_h;
uniform int dst_x0;
uniform int dst_x1;
uniform int dst_y0;
uniform int dst_y1;
uniform int dst_num_samples;
in vec2 tex_coords;
ivec2 txl_coords;
int sample_index;
out uvec4 out_color;

void get_unorm_target_coords()
{
   txl_coords.x = int(tex_coords.x * draw_rect_w + dst_x_off);
   txl_coords.y = int(tex_coords.y * draw_rect_h + dst_y_off);
}

void translate_dst_to_src()
{
   txl_coords.x = int(float(txl_coords.x) * src_x_scale + src_x_off);
   txl_coords.y = int(float(txl_coords.y) * src_y_scale + src_y_off);
}

void translate_y_to_w_tiling()
{
   int X = txl_coords.x;
   int Y = txl_coords.y;
   txl_coords.x = (X & int(0xfff4)) >> 1;
   txl_coords.x |= ((Y & int(0x1)) << 2);
   txl_coords.x |= (X & int(0x1));
   txl_coords.y = (Y & int(0xfffe)) << 1;
   txl_coords.y |= ((X & int(0x8)) >> 2);
   txl_coords.y |= ((X & int(0x2)) >> 1);
}

void decode_msaa()
{
   int X = txl_coords.x;
   int Y = txl_coords.y;
   switch (dst_num_samples) {
   case 0:
      sample_index = 0;
      break;
   case 2:
      txl_coords.x = ((X & int(0xfffc)) >> 1) | (X & int(0x1));
      sample_index = (X & 0x2) >> 1;
      break;
   case 4:
      txl_coords.x = ((X & int(0xfffc)) >> 1) | (X & int(0x1));
      txl_coords.y = ((Y & int(0xfffc)) >> 1) | (Y & int(0x1));
      sample_index = (Y & 0x2) | ((X & 0x2) >> 1);
      break;
   case 8:
      txl_coords.x = ((X & int(0xfff8)) >> 2) | (X & int(0x1));
      txl_coords.y = ((Y & int(0xfffc)) >> 1) | (Y & int(0x1));
      sample_index = (X & 0x4) | (Y & 0x2) | ((X & 0x2) >> 1);
   }
}

void discard_outside_bounding_rect()
{
   int X = txl_coords.x;
   int Y = txl_coords.y;
   if (X >= dst_x1 || X < dst_x0 || Y >= dst_y1 || Y < dst_y0)
      discard;
}

void main()
{
   get_unorm_target_coords();
   translate_y_to_w_tiling();
   decode_msaa();   discard_outside_bounding_rect();
   translate_dst_to_src();
      out_color = texelFetch(texSampler, txl_coords, 0);
}


Please report at https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa
Stencil at 0,0   Expected: 0x33   Observed: 0xfe
Stencil at 1,0   Expected: 0x33   Observed: 0xfe
Stencil at 2,0   Expected: 0x33   Observed: 0xfe
Stencil at 3,0   Expected: 0x33   Observed: 0xfe
Stencil at 4,0   Expected: 0x33   Observed: 0xfe
Stencil at 5,0   Expected: 0x33   Observed: 0xfe
Stencil at 6,0   Expected: 0x33   Observed: 0xfe
Stencil at 7,0   Expected: 0x33   Observed: 0xfe
Stencil at 8,0   Expected: 0x33   Observed: 0xfe
Stencil at 9,0   Expected: 0x33   Observed: 0xfe
Stencil at 10,0   Expected: 0x33   Observed: 0xfe
Stencil at 11,0   Expected: 0x33   Observed: 0xfe
Stencil at 12,0   Expected: 0x33   Observed: 0xfe
Stencil at 13,0   Expected: 0x33   Observed: 0xfe
Stencil at 14,0   Expected: 0x33   Observed: 0xfe
Stencil at 15,0   Expected: 0x33   Observed: 0xfe
Stencil at 16,0   Expected: 0x33   Observed: 0xfe
Stencil at 17,0   Expected: 0x33   Observed: 0xfe
Stencil at 18,0   Expected: 0x33   Observed: 0xfe
...
Total failures: 3721
fbo-depthstencil: /GFX/Test/Piglit/piglit/tests/fbo/fbo-depthstencil.c:483: piglit_display: Assertion `piglit_dispatch_glGetError() == 0' failed.
Aborted (core dumped)

Reproduce steps:
---------------------------- 
1. xinit
2. bin/fbo-depthstencil blit GL_DEPTH32F_STENCIL8 -fbo -auto
Comment 1 Topi Pohjolainen 2014-05-19 07:26:44 UTC
Created attachment 99302 [details]
Fix

I don't have an ILK that I could try but the fix itself is also quite trivial.
Comment 2 Kenneth Graunke 2014-05-19 18:20:02 UTC
Fixed by:

commit 21dddb22c12614c1d4a4f3d1664a3f38678cfbb1
Author: Topi Pohjolainen <topi.pohjolainen@intel.com>
Date:   Mon May 19 10:10:33 2014 +0300

    i965/fbo: Only try stencil meta blits on gen >= 8
    
    I don't have an ILK at hand but the fix should be trivial.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78872
    Cc: "10.2" <mesa-stable@lists.freedesktop.org>
    Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
Comment 3 lu hua 2014-05-23 03:42:15 UTC
Verified. Fixed on master branch.

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.