Bug 25109 - [r300] failing to schedule TEX blocks (was: Wine - Civ4 Black Terrain after upgrading to mesa 7.6)
Summary: [r300] failing to schedule TEX blocks (was: Wine - Civ4 Black Terrain after u...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/r300 (show other bugs)
Version: 7.6
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-15 19:02 UTC by Tom Stellard
Modified: 2010-07-08 21:43 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Error ouput from Civ4/Wine using Mesa 7.6 (2.00 KB, text/plain)
2009-11-15 19:02 UTC, Tom Stellard
Details
glxinfo for Mesa 7.6 (5.45 KB, text/plain)
2009-11-15 19:03 UTC, Tom Stellard
Details
Screenshot of Civ4/Wine showing black terrain. (138.11 KB, image/gif)
2009-11-15 19:03 UTC, Tom Stellard
Details
Proposed fix (2.23 KB, patch)
2010-05-31 14:23 UTC, Tom Stellard
Details | Splinter Review
Compiler output for the miscompiled shader (26.18 KB, text/plain)
2010-06-02 22:43 UTC, Tom Stellard
Details
Proposed fix (6.13 KB, patch)
2010-07-04 16:22 UTC, Tom Stellard
Details | Splinter Review

Description Tom Stellard 2009-11-15 19:02:36 UTC
Created attachment 31221 [details]
Error ouput from Civ4/Wine using Mesa 7.6

I just upgraded to Mesa-7.6 and since the upgrade, whenever I play the game Civilization 4 (running on top of Wine) all of the terrain in the game is black.  The previous version of Mesa I was using was 7.5.1, and I did not have this problem.  I should note that I also upgraded libdrm from 2.4.13 to 2.4.15 at the same time I did the Mesa upgrade.  I have attached the debug output from Civ4/Wine after recompiling Mesa with -DDEBUG, my glxinfo, and a screenshot from Civ4 showing the black terrain.  Here is the current hardware/software I have on my system:

Graphics Card: ATI Technologies Inc RC410 [Radeon Xpress 200M] (prog-if 00 [VGA controller])
Mesa: 7.6
libdrm: 2.4.15
xorg-server: X.Org X Server 1.6.3.901 (1.6.4 RC 1)
xorg radeon driver:  6.12.4
wine: 1.1.33
kernel: 2.6.31
OS: Gentoo
Comment 1 Tom Stellard 2009-11-15 19:03:13 UTC
Created attachment 31222 [details]
glxinfo for Mesa 7.6
Comment 2 Tom Stellard 2009-11-15 19:03:52 UTC
Created attachment 31223 [details]
Screenshot of Civ4/Wine showing black terrain.
Comment 3 Tom Stellard 2009-11-19 21:24:36 UTC
I tried to run git bisect to find the cause of this bug, but I couldn't find the exact commit because some of the commits caused Wine to crash.  However, I still think I have some useful information.  Here are my results:

Civilization 4 running on top of Wine works as expected until this commit:

d1a0ece9077b3de49c293a04c220b995424cef28 is first bad commit
commit d1a0ece9077b3de49c293a04c220b995424cef28
Author: Pauli Nieminen <suokkos@gmail.com>
Date:   Wed Aug 12 20:28:54 2009 +0300

    radeon: Port flush preventation code from r200 to r100.
    
    - emit prediction
    - fixes to emit_sizes for data
    - clean up of excesive use of radeonEnsureCmdBufferSpace
    
    Signed-off-by: Pauli Nieminen <suokkos@gmail.com>

:040000 040000 f5047ec4056835fd217922cabb4907bf59dd5e31 d4c7e96406e9a9529073e104b18e2af16ef9b01a M      src

Starting with this commit, Wine crashes right after starting Civilization 4.  This behavior continues until this commit:

4916a5a2e72b05c176809dd0db5066a966a45b80 is first bad commit
commit 4916a5a2e72b05c176809dd0db5066a966a45b80
Author: Maciej Cencora <m.cencora@gmail.com>
Date:   Sun Sep 20 13:54:59 2009 +0200

    radeon: update buffer map/unmap code for changes introduced in 92033a9516942d7272ce4bf36ecd422009bbaf60 and 822c7964819ca1fcc270880d4ca8b3de8a4276d0

:040000 040000 7f8f99ed6e80c9554b1d4a34030a3720beb7f174 a2673b431fd186ffe0224c0c5783abef43f76e5d M      src

Starting with this commit, I experience the problem I originally described.  Civilization 4 starts correctly, but during game play all the terrain is black. The cause of this bug is somewhere between these two commits.
Comment 4 Maciej Cencora 2009-12-19 06:55:56 UTC
Can you check if the bug is still reproducible on current master, mesa_7_7_branch and mesa_7_6_branch branches?
Comment 5 Tom Stellard 2009-12-20 18:50:04 UTC
I am now using:
xorg-server: 1.7.4 RC 1
kernel: 2.6.32 with KMS disabled.
wine: 1.1.35
and the most recent git versions of libdrm and ddx.

I can reproduce this bug on the master, mesa_7_7_branch, and mesa_7_6_branch branches.
Comment 6 Tom Stellard 2010-05-31 14:21:04 UTC
This bug was the result of a shader that was failing to compile because it had too many TEX blocks.  This was caused by the pair scheduler breaking up a large TEX block into several smaller ones.  I have attached a patch that fixes this bug.
Comment 7 Tom Stellard 2010-05-31 14:23:07 UTC
Created attachment 35975 [details] [review]
Proposed fix
Comment 8 Tom Stellard 2010-06-02 10:28:56 UTC
(In reply to comment #7)
> Created an attachment (id=35975) [details]
> Proposed fix

This patch fixes civ4, but it could potentially break other programs.
Comment 9 Tom Stellard 2010-06-02 22:43:37 UTC
Created attachment 36026 [details]
Compiler output for the miscompiled shader
Comment 10 Tom Stellard 2010-07-04 16:22:34 UTC
Created attachment 36754 [details] [review]
Proposed fix
Comment 11 Tom Stellard 2010-07-08 21:43:05 UTC
Fixed in git master commit: 3724a2e65f5b3aa6e123889342a3e9c4d05903f5


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.