Bug 53946 - [i965] guardband clipping issue on Sandybridge
Summary: [i965] guardband clipping issue on Sandybridge
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Kenneth Graunke
QA Contact:
URL:
Whiteboard:
Keywords:
: 55523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-22 17:32 UTC by nkalkhof
Modified: 2017-02-11 07:56 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
screenshot (448.99 KB, image/png)
2012-08-22 17:32 UTC, nkalkhof
Details

Description nkalkhof 2012-08-22 17:32:46 UTC
Created attachment 65969 [details]
screenshot

Hi,

it seems that guardband clipping on i965(SNB) causes some polygons with normal vector (0,-1,0) to be clipped. this can be observed with an OpenGL version of the old DOOM engine. Ceiling planes are being clipped spontaneously while moving through the scene (see attached screenshot). I've tracked down the bad commit (85cd30406ff8414bc6ac6de1064d059a4c564160). When I switch off culling the problem goes away however this comes with the performance panelty.

configure opts:
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --disable-dependency-tracking --enable-dri --enable-glx --disable-debug --disable-egl --disable-gbm --disable-gles1 --disable-gles2 --enable-glx-tls --enable-asm --enable-shared-glapi --disable-xa --with-dri-drivers=i965 --with-gallium-drivers= --with-egl-platforms= --disable-gallium-egl --disable-d3d1x --disable-gallium-g3dvl --disable-gallium-llvm --disable-openvg --disable-r600-llvm-compiler --disable-vdpau --disable-xvmc

Could someone please confirm the issue?

Thx and Regards
Nic
Comment 1 Kenneth Graunke 2012-10-05 23:43:06 UTC
I believe this is due to a hardware bug which we're failing to work around.  

Could you please try:
sudo intel_reg_write 0x2090 0xffff0020

and see if it fixes the problem?  (I'm guessing your value for that register is 0, not 0x20.)

If by "an OpenGL version of the old DOOM engine" you mean Dante, I've verified that it does fix that.

Thanks!
Comment 2 Kenneth Graunke 2012-10-06 00:46:39 UTC
*** Bug 55523 has been marked as a duplicate of this bug. ***
Comment 3 Kenneth Graunke 2012-10-06 00:50:54 UTC
Alternatively, I've sent out two patches to fix this:

1. Kernel bug fix:
http://lists.freedesktop.org/archives/intel-gfx/2012-October/021043.html

Applying that patch should apply the workaround correctly, thus fixing the problem.

2. Make Mesa check for the workaround:
http://lists.freedesktop.org/archives/mesa-dev/2012-October/028345.html

Applying this one will disable guardband clipping unless the workaround is correctly set.  This allows Mesa to work regardless of the kernel version.
Comment 4 Oliver McFadden 2012-10-06 12:32:45 UTC
(In reply to comment #1)
> If by "an OpenGL version of the old DOOM engine" you mean Dante, I've
> verified that it does fix that.

Probably the reporter means the original Doom (i.e. Doom 1) rather than Dante.
Comment 5 nkalkhof 2012-10-20 07:14:11 UTC
hello,

sorry for the late reply I kinda lost track of this bug.

@Kenneth: sudo intel_reg_write 0x2090 0xffff0020 in deed fixes the issue however applying the workarounds:

http://lists.freedesktop.org/archives/intel-gfx/2012-October/021043.html
http://lists.freedesktop.org/archives/mesa-dev/2012-October/028345.html

does not. I have to remove the GEN6_CLIP_GB_TEST flag from gen6_clip_state.c to fix it actually.

@Oliver: You're right. I didn't mean Dante(DOOM3) but the old DOOM1/2 game engine. I'm using my own OpenGL Renderer for this game which makes use of indexed VBOs (See screenshot). The code is not made public yet but you can try prboom-plus which produces the same clipping issue however much less of it ;-).

Regards
Nic
Comment 6 Eric Anholt 2012-11-13 21:26:24 UTC
So, after applying the kernel fix, does intel_reg_read report 0x0 or 0x20 for the reg?
Comment 7 Eric Anholt 2012-11-27 01:53:00 UTC
Also, if you're not getting the expected value from intel_reg_read, then bracketing the kernel setup of the workaround with printks of the register would be interesting.
Comment 8 Annie 2017-02-10 22:38:32 UTC
Dear Reporter,

This Mesa bug has been in the "NEEDINFO" status for over 60 days. I am closing this bug based on lack of response but feel free to reopen if resolution is still needed. Please ensure you're supplying the correct information as requested.

Thank you.
Comment 9 Kenneth Graunke 2017-02-11 07:56:04 UTC
Oops.  We just forgot to close this.  It was fixed in Kernel 3.10.


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.