Bug 99339 - Blender line rendering broken after removing XY clipping of lines
Summary: Blender line rendering broken after removing XY clipping of lines
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 13.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Kenneth Graunke
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks: 99517
  Show dependency treegraph
 
Reported: 2017-01-10 04:03 UTC by Matti Hämäläinen
Modified: 2017-02-10 22:42 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Matti Hämäläinen 2017-01-10 04:03:43 UTC
Some wonky rendering occurs with Mesa 13.0.2 (not bisected, so unsure where this issue has started) when using Intel HW OpenGL. The problem does not occur with full software rendering (llvm softpipe) e.g. running with LIBGL_ALWAYS_SOFTWARE=1

As I am not sure what the exact issue is (might be incorrect clipping or vector calculation etc.) the best thing is to demonstrate, two screenshots and a OGV format video available at: http://tnsp.org/~ccr/intel-gfx/blender/

In the video pay attention to the "floor grid" lines, which go about weirdly. The other minor glitches are artifacts of the screen capture and not actually visible.

I'll try latest GIT and bisecting during next weekend as I'll have more time then.

-- Linux distribution: Debian GNU/Linux testing (stretch)
-- System architecture: amd64
   Foreign architectures: i386
-- Machine: Asus H97M-PLUS, Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
-- Kernel version: 4.8.15-grsec
-- Chipset: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
-- Display connector(s): HDMI (2560x1440)
-- Window manager: WindowMaker 0.95.7-6+b1
-- xf86-video-intel: GIT 
-- X server: Xorg 2:1.19.0-3
-- Mesa: 13.0.2-3
-- libpixman: 0.34.0-1
-- libdrm version: 2.4.74-1
Comment 1 Matti Hämäläinen 2017-01-11 16:13:17 UTC
Was bored, so I did the bisecting already. The culprit seems to be this commit in Mesa GIT: 88d28aa4d9edec33ef7bcf1f56b77fbb756a24f8 "i965: Stop XY clipping point and line primitives."
Comment 2 Kenneth Graunke 2017-01-12 05:22:28 UTC
Thanks for the bisect!  I can confirm the bug on Haswell.  As another data point, Skylake seems to be working OK...
Comment 3 Kenneth Graunke 2017-01-12 08:22:27 UTC
This patch seems to fix it:
https://lists.freedesktop.org/archives/mesa-dev/2017-January/140521.html
Comment 4 Matti Hämäläinen 2017-01-12 15:23:15 UTC
Tested the patch (without any changes suggested by Chris, tho), and it is working on my Haswell.
Comment 5 Kenneth Graunke 2017-02-10 22:42:48 UTC
Should be fixed by:

commit ece0e535a44c228dd994861592deb155c14740d8
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Wed Jan 11 21:38:52 2017 -0800

    i965: Always scissor on Gen6-7.5 instead of disabling guardband.
    
    Previously we disabled the guardband when the viewport was smaller than
    the framebuffer on Gen6-7.5, to prevent portions of primitives from
    being draw outside of the viewport.  On Gen8+, we relied on the viewport
    extents test to effectively scissor this away for us.
    
    We can simply always enable scissoring instead.  We already include the
    viewport in the scissor rectangle, so this will effectively do the
    viewport extents test for us.  (The only difference is that the scissor
    rectangle doesn't support sub-pixel values.  I think that's okay.)
    
    Given that the viewport extents test is essentially a second scissor,
    and is enabled for basically all 3D drawing on Gen8+, it stands to
    reason that scissoring is cheap.  Enabling the guardband reduces the
    cost of clipping, which is expensive.
    
    The Windows driver appears to never disable guardband clipping, and
    appears to use scissoring in this case.  I don't know if they leave
    it on universally though.
    
    This fixes misrendering in Blender, where the "floor plane" grid lines
    started rendering at wrong angles after I disabled XY clipping of line
    primitives.  Enabling the guardband seems to solve the issue.
    
    Cc: "17.0" <mesa-stable@lists.freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99339
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

or at least the series including that.  This will be in Mesa 17.0.


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.