Bug 26043 - Graphics corruption in Sauerbraten
Summary: Graphics corruption in Sauerbraten
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/R600 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL: http://jon.severinsson.net/mesa/scree...
Keywords: patch, regression
Depends on:
Reported: 2010-01-14 08:06 UTC by Jon Severinsson
Modified: 2011-11-13 09:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Uggly patch that fixes the problem for me (17.50 KB, patch)
2010-01-14 08:06 UTC, Jon Severinsson
Details | Splinter Review
Somewhat less ugly patch for Mesa 7.8 (12.90 KB, patch)
2010-03-29 03:58 UTC, Jon Severinsson
Details | Splinter Review

Description Jon Severinsson 2010-01-14 08:06:42 UTC
Created attachment 32638 [details] [review]
Uggly patch that fixes the problem for me

After upgrading from Mesa 7.6.1 to Mesa 7.7 Sauerbraten would display severe graphics corruptions on screen making the game unplayable (see URL for a screenshot).

I recently had some time to spare and decided to try to hunt down the regression as an exercise in learning git, and managed to create the attached patch that solves the problem for me.

Please note that the patch isn't really a fix, more of a workaround, as it replaces 96 lines of new code with 206 lines of old code from the git history, rather than fixing the new code, but it works for me, and perhaps it can serve as a starting point for someone more knowledgeable to fix it for real.

The patch was originally created by going through git history between mesa_7_6_1 and mesa_7_7 looking for commits that broke something, and merging everything but those commits to a new tree. The commits I skipped was eea30906 614e8f22 fc38a3cf 45eb9d2f 5f7d5d3e 57864f6e 731810f8 and 66d6f9e8. I also had to do some manual conflict resolution when merging other commits. I then took the difference between mesa_7_7 and the new tree to create a patch that fixed Sauerbraten. Finally I cleaned up the patch and removed anything that wasn't necessary to get Sauerbraten working, giving me the attached patch.

`lspci -v` output for my card:
01:00.0 VGA compatible controller: ATI Technologies Inc RV630 [Radeon HD 2600 Series] (prog-if 00 [VGA controller])
        Subsystem: ASUSTeK Computer Inc. Device 01bc
        Flags: bus master, fast devsel, latency 0, IRQ 18
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        Memory at fdfe0000 (64-bit, non-prefetchable) [size=64K]
        I/O ports at ee00 [size=256]
        [virtual] Expansion ROM at fdf00000 [disabled] [size=128K]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information <?>
        Kernel driver in use: radeon
Comment 1 Jon Severinsson 2010-01-14 09:02:37 UTC
taiu told me at IRC that typing /floatvtx 1 in the Sauerbraten console also worked around the issue in mesa 7.7. It does work for Sauerbraten, but I've just verified that a few Wine games that didn't work for me with either mesa 7.6.1 nor 7.7 works after I apply my patch to 7.7, so the problem goes beyond just Sauerbraten.
Comment 2 Jon Severinsson 2010-03-29 03:58:26 UTC
Created attachment 34530 [details] [review]
Somewhat less ugly patch for Mesa 7.8

When upgrading to mesa 7.8 I had to update my patch to get it to apply. I took the opportunity to see if I could clean up the patch while I was at it.

Essentially I tried to find what current code was the equivalent to the old code my patch re-introduced, and modify that instead.

The new patch is still no beauty, but much better than the old one and now weights at a somewhat more modest 372 lines (removing 97 lines and adding 77 lines)

Trying to analyse the changes I find three major ones, as well as some minor ones following from those, but as I'm no expert on Mesa I don't fully understand what impact they have, other than what I see on screen (Sauerbraten starting to work).
1) With the patch applied r700TryDrawPrims is called as a first stage of r600_pipeline instead of being called through the vbo_context(ctx)->draw_prims callback from the other stages.
2) In several places the patch replaces use of context->stream_desc with use of context->radeon.tcl.aos.
3) After doing the other changes, r700RunRenderPrimitiveImmediate have to use data from vb->Elts when calling R600_OUT_BATCH() or the graphic cards borks and requires a restart to output anything.

I hope this work will help someone more knowledgeable to figure out how to fix the problem properly.
Comment 3 almos 2011-11-13 09:05:37 UTC
I think this can be closed, since r600c is now deprecated. Also, sauerbraten renders correctly on my barts gpu with r600g of mesa 7.11. Feel free to reopen.

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.