Bug 59187 - [Steam] fix user-clipping / gl_ClipVertex (for pre SandyBridge)
Summary: [Steam] fix user-clipping / gl_ClipVertex (for pre SandyBridge)
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: 9.0
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Chris Forbes
QA Contact:
URL:
Whiteboard:
Keywords:
: 60481 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-09 23:55 UTC by ruthubuntu
Modified: 2013-06-08 01:06 UTC (History)
15 users (show)

See Also:
i915 platform:
i915 features:


Attachments
glxinfo (12.63 KB, text/plain)
2013-01-09 23:55 UTC, ruthubuntu
Details
With the ppa who upgrade to Mesa 9.2 (9.47 KB, text/plain)
2013-04-07 16:33 UTC, ruthubuntu
Details
With Mesa 9.2 patched (681.70 KB, image/png)
2013-05-06 23:32 UTC, ruthubuntu
Details
glxinfo with Mesa 9.2 patched (10.39 KB, text/plain)
2013-05-06 23:34 UTC, ruthubuntu
Details

Description ruthubuntu 2013-01-09 23:55:27 UTC
Created attachment 72760 [details]
glxinfo

On Ubuntu 12.04 x86_64 with an Intel integrated Chipset HM55 / Ironlake Mobile:

 lspci -vnn | egrep "VGA|3D|Display"
00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor Integrated Graphics Controller 8086:0046 (prog-if 00 [VGA controller])

Steam give me this information:
Processor Information:
Vendor: GenuineIntel
Speed: 2266 Mhz
4 logical processors
3 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Unsupported
SSE41: Supported
SSE42: Supported

Network Information:
Network Speed:

Operating System Version:
Ubuntu 12.04.1 LTS (64 bit)
Kernel Name: Linux
Kernel Version: 3.2.0-35-generic
X Server vendor: The X.Org Foundation
X Server release: 11103000

Video Card:
Driver: Intel Open Source Technology Center Mesa DRI Intel(R) Ironlake Mobile x86/MMX/SSE2

Driver Version:  2.1 Mesa 9.0
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 59 Hz
VendorID:  0x8086
DeviceID:  0x46
Number of Monitors:  1
Number of Logical Video Cards:  1
Primary Display Resolution:  1366 x 768
Desktop Resolution: 1366 x 768
Primary Display Size: 13,54" x 7,60"  (15,51" diag)
                                        34,4cm x 19,3cm  (39,4cm diag)
Primary VRAM Not Detected

Sound card:
Audio device: Intel IbexPeak HDMI

Memory:
RAM: 3753 Mb

Miscellaneous:
UI Language: English
LANG: fr_FR.UTF-8
Microphone: Not set
Total Hard Disk Space Available: 409142 Mb
Largest Free Hard Disk Block: 86328 Mb

Installed software:

Recent Failure Reports:


When i try to launch Team Forteress2 : I have a black screen with my little with mouse only. I heard sound.
Bug for steam: https://github.com/ValveSoftware/steam-for-linux/issues/150
Comment 1 Kenneth Graunke 2013-01-10 04:46:15 UTC
Hello,

Team Fortress 2 requires some functionality from OpenGL 3.0 and GLSL 1.30, which we currently only support on Sandy Bridge and newer hardware.  Unfortunately, Ironlake and earlier currently do not.

It should be possible to implement the missing functionality on Ironlake.  The code is open source, and the hardware documentation is freely available on the web(*), so in theory, anyone could make progress toward this.

Sadly, our team is extremely busy working on newer hardware and is unlikely to have time to implement GL 3.0 support for Ironlake...at least not any time soon.  I sincerely apologize for this; we'd all love to see it happen too.

(*) https://01.org/linuxgraphics/documentation/driver-documentation-prms

In the meantime, I've reassigned the component to Drivers/DRI/i965 as it's a driver specific issue, rather than a Mesa core issue.
Comment 2 Ian Romanick 2013-02-13 15:36:26 UTC
*** Bug 60481 has been marked as a duplicate of this bug. ***
Comment 3 Lukas M 2013-02-20 15:17:56 UTC
In #60481 Ian Romanick said Source-Games would depend on GL3..
I demonstrated that the Source-Games don't need full GL3, but just depend on GLSL 1.30 [0]. I run CS:S using Mesa-9.0's softpipe driver (OpenGL 2.1 & GLSL 1.30). So there is probably just some GLSL 1.30 functionallity missing, which could be implemented as a software fallback or using the graphics hardware (if supported).

Where would we have to implement those missing GLSL 1.30 functions?

[0] https://github.com/ValveSoftware/Source-1-Games/issues/19#issuecomment-13801640
Comment 4 Paul Berry 2013-02-20 16:51:52 UTC
(In reply to comment #3)
> In #60481 Ian Romanick said Source-Games would depend on GL3..
> I demonstrated that the Source-Games don't need full GL3, but just depend on
> GLSL 1.30 [0]. I run CS:S using Mesa-9.0's softpipe driver (OpenGL 2.1 &
> GLSL 1.30). So there is probably just some GLSL 1.30 functionallity missing,
> which could be implemented as a software fallback or using the graphics
> hardware (if supported).
> 
> Where would we have to implement those missing GLSL 1.30 functions?
> 
> [0]
> https://github.com/ValveSoftware/Source-1-Games/issues/19#issuecomment-
> 13801640

I can't speak to whether Source games require GL 3.0 or not, but here's a rough list of what would need to be added to the i965 driver in order to support GLSL 1.30 on Ironlake (this is based on section 1.2.1 "Summary of Functionality differences from version 1.2" of the GLSL 1.30 spec):

- Texture size queries*
- Texture arrays*
- Texture offsetting*
- Explicit LOD and derivative controls*
- "noperspective" and "flat" interpolation qualifiers
- gl_VertexID 

*Some of these may already work on IronLake--I'm not terribly familiar with the texturing code.
Comment 5 Paul Berry 2013-02-20 16:57:46 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > In #60481 Ian Romanick said Source-Games would depend on GL3..
> > I demonstrated that the Source-Games don't need full GL3, but just depend on
> > GLSL 1.30 [0]. I run CS:S using Mesa-9.0's softpipe driver (OpenGL 2.1 &
> > GLSL 1.30). So there is probably just some GLSL 1.30 functionallity missing,
> > which could be implemented as a software fallback or using the graphics
> > hardware (if supported).
> > 
> > Where would we have to implement those missing GLSL 1.30 functions?
> > 
> > [0]
> > https://github.com/ValveSoftware/Source-1-Games/issues/19#issuecomment-
> > 13801640
> 
> I can't speak to whether Source games require GL 3.0 or not, but here's a
> rough list of what would need to be added to the i965 driver in order to
> support GLSL 1.30 on Ironlake (this is based on section 1.2.1 "Summary of
> Functionality differences from version 1.2" of the GLSL 1.30 spec):
> 
> - Texture size queries*
> - Texture arrays*
> - Texture offsetting*
> - Explicit LOD and derivative controls*
> - "noperspective" and "flat" interpolation qualifiers
> - gl_VertexID 
> 
> *Some of these may already work on IronLake--I'm not terribly familiar with
> the texturing code.

Argh, sorry.  I hit submit before I was finished.  One more item:

- gl_ClipDistance

Of all of these items, the trickiest one is gl_ClipDistance, since it requires modifying the Gen4/5-specific "clip" program (brw_clip.c) to perform clipping in a manner more like what happens in Gen6+ (using clip distances provided by the vertex shader rather than performing dot products in the clip program).  This is not a project for the faint of heart--the brw_clip.c code isn't terribly well tested, and has a lot of tricky corner cases in it.

Once those things are done, we would of course want to run the driver through a pretty thorough round of piglit testing to make sure we hadn't missed any small details.
Comment 6 seves985 2013-02-20 17:47:58 UTC
This isn't only an IronLake-issue.

This issue is related to any chipsets older then SandyBridge.
Comment 7 christopher.alderton 2013-02-22 10:47:43 UTC
Just to nudge things, is anybody working on this/know of anybody working on this? If I had the know-how, I'd have a shot, but this is outside the scope of my abilities.
Comment 8 Paul Berry 2013-02-22 13:32:43 UTC
(In reply to comment #6)
> This isn't only an IronLake-issue.
> 
> This issue is related to any chipsets older then SandyBridge.

Just a side note to anyone who decides to work on this bug;

If you would like to try to make chipsets prior to Gen5 work, please have a look at section 6.2.3 ("Negative-W Clipping Errata") of the i965/G35 manual (pp133-138), available from https://01.org/linuxgraphics/documentation/intel%C2%AE-965-express-chipset-family-and-intel%C2%AE-g35-express-chipset-graphics-controller

Briefly, certain Gen4 chipsets contain a bug which causes vertices with a negative gl_Position.w value to be clipped incorrectly.  The workaround uses some of the hardware that was intended to implement gl_ClipDistance[7] (specifically, bit "UC7", which is output by the vertex shader to help the fixed-function clipping hardware determine whether a vertex may be trivially accepted or rejected).  At present, applying the workaround is easy, since we don't support gl_ClipDistance on those chipsets, so bit UC7 is otherwise unused.  If we want to make Gen4 chipsets implement gl_ClipDistance properly, we'll need to carefully consider the interactions between the bug workaround and gl_ClipDistance[7].

You can find the workaround code in Mesa by searching for the text "has_negative_rhw_bug".
Comment 9 Chris Forbes 2013-02-25 06:12:41 UTC
I'm keen to fix this, I just need to scrounge up a working Ironlake box first.
Comment 10 Md Imam Hossain 2013-03-02 17:58:25 UTC
I would like to see this on my Intel GMA 4500, that would be great
Comment 11 Lukas M 2013-03-17 20:21:46 UTC
CS:S now runs at about 5 FPS (on Core i5 Ironlake), using the latest LLVMpipe driver, which is part of the mesa9.2-devel and provides GLSL-1.30.

Chris Forbes, can we somehow help you to get a proper box for development?
Comment 12 aa 2013-03-19 20:40:59 UTC
Is anybody working on this?
Comment 13 Md Imam Hossain 2013-03-31 11:12:46 UTC
team fortress 2 now started working after the following commit on my GMA 4500

http://cgit.freedesktop.org/mesa/mesa/commit/?id=0967c362bf378b7415c30ca6d9523d3b2a3a7f5d

but world rendering is garbled.

looks like source game does not require GLSL 1.30

any comment about CS:S since I dont own that game
Comment 14 Kenneth Graunke 2013-04-01 02:24:53 UTC
Eric mentioned that anything using user-clipping (via gl_ClipVertex) will likely be broken.  I believe we even have some failing Piglit tests for this.  At this point, it appears that we're mostly looking at bugs, not missing features.  Which bodes really well for seeing this fixed...
Comment 15 ruthubuntu 2013-04-07 16:25:44 UTC
I try with this ppa https://launchpad.net/~oibaf/+archive/graphics-drivers
who give me 
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ironlake Mobile 
OpenGL version string: 2.1 Mesa 9.2.0 (git-b8998f9 precise-oibaf-ppa)
OpenGL shading language version string: 1.20

I could launch TF2.  see: https://github.com/ValveSoftware/steam-for-linux/issues/150#issuecomment-16017762
I know that the subjet of this bug changed but, that only i could do: post to say that the progress is on the good way.
Of course this driver is on developpement and have some bugs: Some time i need to reboot because the screen of my desktop is not stable.

Thanks for your work.
Comment 16 ruthubuntu 2013-04-07 16:33:05 UTC
Created attachment 77559 [details]
With the ppa who upgrade to Mesa 9.2
Comment 17 ruthubuntu 2013-04-07 16:50:46 UTC
@ Lukas M: I am not sure that fix in tittle is a good idea. The driver is not usable and bug with some games who aren't Source's games.
Comment 18 Chris Forbes 2013-04-27 00:01:20 UTC
Finally got some Ironlake hardware!

The CSS/TF2 garbled world rendering is fixed in this patch:

  http://lists.freedesktop.org/archives/mesa-dev/2013-April/038550.html

Alternatively, there's a git tree based on master here:

  https://github.com/chrisforbes/mesa/tree/ilk-source-games-fix

The clipping stuff turned out to be a red herring for these games -- they write gl_ClipVertex, but mishandled clipping isn't what was screwing things up.
Comment 19 Md Imam Hossain 2013-04-28 09:42:09 UTC
dont know should I discuss it here, Team Fortress 2 does not get any input (mouse clicks, key press) in the main menu, I guess maybe after steam update. So I cant test the patch
Comment 20 Md Imam Hossain 2013-05-04 08:54:23 UTC
fixed for me! tried with Portal Beta on my GMA 4500 MHD with mesa master.

Now source engine games should run fine!

great work!

should this bug be closed now
Comment 21 ruthubuntu 2013-05-06 23:32:54 UTC
Created attachment 78952 [details]
With Mesa 9.2  patched

Better with your patch, Chris Forbes.
With Mesa 9.2.0 (git-b4b3041 precise-oibaf-ppa) it work well.
Thanks you and Valve for your work.
Comment 22 ruthubuntu 2013-05-06 23:34:53 UTC
Created attachment 78953 [details]
glxinfo with Mesa 9.2 patched

I close the bug, i think it resolved. I hope it will be backported to Mesa 9.1
Comment 23 Chris Forbes 2013-05-07 00:00:35 UTC
I think we might want a new bug for gl_ClipVertex itself not being supported -- it turned out it wasn't the issue here, but it's still wrong :).
Comment 24 Md Imam Hossain 2013-05-07 04:32:37 UTC
There are some depth issues while running Portal on my GMA 4500 MHD but not sure if that problem is related to this bug though. Similar problem noticeable while running Windows version of Portal with Wine. Just for information native version runs much faster and better than Windows version with wine.

I have tried both running with Mesa from master git
And Mesa 9.1.2 plus this commit which fixes this bug
Comment 25 Kenneth Graunke 2013-05-07 05:42:40 UTC
(In reply to comment #24)
> There are some depth issues while running Portal on my GMA 4500 MHD but not
> sure if that problem is related to this bug though.

Unrelated, but thanks for the info.  That's tracked as bug #64253.
Comment 26 Eric Anholt 2013-06-08 01:06:52 UTC
Fixed as of this commit on master:

commit 06a503ca7163174e9763adcf64186d38997fee83
Author: Chris Forbes <chrisf@ijw.co.nz>
Date:   Mon May 20 22:10:29 2013 +1200

    i965/vs: add support for emitting gl_ClipVertex


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.