Bug 85529

Summary: Surfaces not drawn in Unvanquished
Product: Mesa Reporter: vcelestialragev
Component: Drivers/DRI/i965Assignee: Kenneth Graunke <kenneth>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: andrieuguillaume42, eero.t.tamminen, idr, vcelestialragev
Version: 10.3Keywords: regression
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Example of surfaces not drawn
A patch that "fixes" the issue

Description vcelestialragev 2014-10-28 00:28:36 UTC
Created attachment 108538 [details]
Example of surfaces not drawn

This is an intel only problem. The API trace run under an nvidia card does not produce these issues, however, an API trace under an intel card does.

Link to API trace: http://www.unvanquished.net/~modi/daemon.trace.xz
Comment 1 vcelestialragev 2014-10-28 05:31:27 UTC
Interestingly, copying the i965_dri.so from 10.2.8 fixes the problem, so it seems like a regression with 10.3.
Comment 2 Guillaume 2014-11-25 00:41:00 UTC
Hi, same issue here.

Video capture: https://www.youtube.com/watch?v=jACO53o1CwU

Game: unvanquished 0.33.0-1~deb from http://www.unvanquished.net/download

System:
- Debian GNU/Linux testing
- Linux sark 3.16.0-4-amd64 #1 SMP Debian 3.16.7-2 (2014-11-06) x86_64 GNU/Linux
- xserver-xorg 1.16.1.901
- xserver-xorg-video-intel 2.21.15

$ glxinfo | grep OpenGL | grep string
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.3.2
OpenGL core profile shading language version string: 3.30
OpenGL version string: 3.0 Mesa 10.3.2
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 10.3.2
OpenGL ES profile shading language version string: OpenGL ES GLSL
Comment 3 vcelestialragev 2014-12-15 01:17:33 UTC
I just bisected this between mesa-10.2 and mesa-10.3
afe5db3293d4d04d7dae342c537f18db00ad09a5 is the first bad commit
commit afe5db3293d4d04d7dae342c537f18db00ad09a5
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Aug 7 20:07:25 2014 -0700

    i965: Calculate start/base_vertex_location after preparing vertices.
    
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit c89306983c07e5a88c0d636267e5ccf263cb4213)

:040000 040000 0113d7047ea4c7b74d743ccca1bfc92efe07c74c 13c5da0511572cd784054746c05afef567b52f2c M      src



git bisect log:
git bisect start
# good: [f836ef63fdbb4abada29299e226eed735094736c] Bump version to 10.2 (final)
git bisect good f836ef63fdbb4abada29299e226eed735094736c
# bad: [1b12af300dfa77c24088780e88200703653293d3] docs: Update 10.3 release notes
git bisect bad 1b12af300dfa77c24088780e88200703653293d3
# good: [a06c9791d1b7fcedfb56ecbdc601d42fab196916] docs: Add missing release notes for ARB_separate_shader_objects
git bisect good a06c9791d1b7fcedfb56ecbdc601d42fab196916
# good: [282b783a158a495a86537a8a4858c8c1c55f71fb] st/mesa: add some missing MESA/PIPE_FORMAT_R10G10B10A2_UNORM switch cases
git bisect good 282b783a158a495a86537a8a4858c8c1c55f71fb
# good: [58007aec4193e3bdb38cafcfb2188dcbd8f18def] i965/fs: don't read from uninitialized memory while assigning registers
git bisect good 58007aec4193e3bdb38cafcfb2188dcbd8f18def
# good: [fbfcd671a1c74eebc00c56f609a8792fedb0a45d] i965/fs: Add support for non-const sampler indices in generator
git bisect good fbfcd671a1c74eebc00c56f609a8792fedb0a45d
# good: [498dc676ea7efac9bce490006a4f5b7f81e9e458] r600g: copy IA_MULTI_VGT_PARAM programming from radeonsi for Cayman
git bisect good 498dc676ea7efac9bce490006a4f5b7f81e9e458
# good: [c546523b4df5d613f4a97fc2068315d50cdb365c] r600g: fix alpha-test with HyperZ enabled, fixing L4D2 tree corruption
git bisect good c546523b4df5d613f4a97fc2068315d50cdb365c
# good: [73192345c333cb7cfcc6210bf085b6d87bdee423] mesa: Add SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
git bisect good 73192345c333cb7cfcc6210bf085b6d87bdee423
# bad: [0f4dc098076cd6ccac6a117cabf3df0194558709] glsl: Speed up constant folding for swizzles.
git bisect bad 0f4dc098076cd6ccac6a117cabf3df0194558709
# bad: [10aee701ae10f2057f8d24792b56c8f832830a99] i965: Make gl_BaseVertex available in a buffer object.
git bisect bad 10aee701ae10f2057f8d24792b56c8f832830a99
# good: [09a763bea551a880449265e558384392214ecf96] mesa: Replace string comparisons with SYSTEM_VALUE enum checks.
git bisect good 09a763bea551a880449265e558384392214ecf96
# good: [d9df31cc6edf9a01d5093d40e0fcebb591693cd8] i965: Handle SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
git bisect good d9df31cc6edf9a01d5093d40e0fcebb591693cd8
# bad: [afe5db3293d4d04d7dae342c537f18db00ad09a5] i965: Calculate start/base_vertex_location after preparing vertices.
git bisect bad afe5db3293d4d04d7dae342c537f18db00ad09a5
# first bad commit: [afe5db3293d4d04d7dae342c537f18db00ad09a5] i965: Calculate start/base_vertex_location after preparing vertices.
Comment 4 vcelestialragev 2014-12-15 03:12:13 UTC
Created attachment 110839 [details]
A patch that "fixes" the issue

The patch just partially reverts the original commit that introduced the regression. It is probably not a proper fix but my help provide clues about where the problem actually occurs.
Comment 5 Emil Velikov 2014-12-15 22:31:34 UTC
Ken I cannot see this commit nominated for stable yet it seems that Ian has explicitly picked it up. Would you have any ideas why this is happening ?

Guys to avoid chasing ghosts can you confirm if the problem exists with mesa 10.3.5 and 10.4.0 ?
Comment 6 Emil Velikov 2014-12-15 22:33:06 UTC
And by "why this is happening" I'm referring about the bug :)
Comment 7 vcelestialragev 2014-12-15 22:34:55 UTC
I can confirm it happens on both and the current master.
Comment 8 Ian Romanick 2014-12-16 23:11:07 UTC
(In reply to Emil Velikov from comment #5)
> Ken I cannot see this commit nominated for stable yet it seems that Ian has
> explicitly picked it up.

It was part of a series that was needed for OpenGL ES 3.0 conformance.
Comment 9 Kenneth Graunke 2014-12-18 12:43:54 UTC
(In reply to vcelestialragev from comment #4)
> Created attachment 110839 [details]
> A patch that "fixes" the issue
> 
> The patch just partially reverts the original commit that introduced the
> regression. It is probably not a proper fix but my help provide clues about
> where the problem actually occurs.

I'm pretty sure your patch is correct, actually.

After ~2 hours of staring at the code, and adding some assertions, I realized that if we have multiple _mesa_prims and somehow don't flag BRW_NEW_VERTICES on the second one, brw_try_draw_prims resets start/base_vertex_location to prim[i].{start,basevertex}, but we don't call brw_prepare_shader_draw_parameters, so we fail to add in brw->vb.start_vertex_bias and brw->ib.start_vertex_offset when processing subsequent primitives.

Your patch makes us no longer add brw->vb.start_vertex_bias to the value of gl_BaseVertexARB.  However, I think we aren't *supposed* to add it in the first place, so the patch actually fixes two bugs.

I'd like to revert more, restoring more of the older/simpler code.  I'll send out a patch shortly.
Comment 10 Kenneth Graunke 2015-01-01 01:10:06 UTC
Fixed by:

commit 929b48510b083919a434f01afe464e2bb7f26ac0
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Dec 18 04:45:40 2014 -0800

    i965: Fix start/base_vertex_location for >1 prims but !BRW_NEW_VERTICES.

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.