Hans de Goede (hansdegoede) wrote,
Hans de Goede

Time for some mesa hacking

As explained in my reaction to Alexey Kuznetsov's Fedora Game must have posts maniadrive currently is packaged for Fedora, but unfortunately not usable when using opensource graphics drivers due to several regressions in mesa.

The regression (from working to crash) for intel graphics has already been fixed by upstream after I spend a day tracking  down the commit causing it, see this bug.

However on r300 / r400 based cards it still doesn't work, even when using upstream git. This was beginning to annoy me so I 've spend the last 2 days tracking down the 2 distinct regressions in recent mesa:
  1. Wrong rendering with current git (and with Fedora's packages because those  have the r300 part updated to a recent git snapshot for rs480 support).
  2. Maniadrive being slow with mesa >= 7.0 (official release, clean build).
And I managed to fix both :)
  1. The wrong rendering is caused by the second chunk of this commit. If one reverts the second chunk of this commit, then everything gets properly rendered.
  2. The slowness problem is caused by tnl/t_vp_build.c generating vertex programs which use 14 temp variables, and the r300 has exactly 14 temp registers (according to the current driver). This becomes a problem because:
    1. Certain ARB vertex instructions are emulated on the r300, and the emulation code needs a temp register too.
    2. Even those vertex programs which do not use the troublesome ARB vertex instructions will not work because there is an of by one bug in the check if there are enough registers.
I have a patch which fixes the t_vp_build.c code to not require more temp registers then it actually needs, by allocating them only when needed and freeing them asap. It takes 2 of the number of temp registers needed by the
generated code in the case of maniadrive, making maniadrive work even with the off by one bug still present in the r300 code.

Of course I've also written a patch for the off by one error. Both issues have been report in both Fedora's bugzilla and upstream.

During the investigation of this I've found out that maniadrive most likely also is broken on r200 cards, but no worry my patches should fix it there too :)

I've also done a scratch build of mesa, with all 3 patches (1 for intel, 2 for radeons) incorporated for your downloading pleasure. For good measure I've also thrown in this commit from upstream, which fixes 3D on Radeon x700 SE cards, and a patch to make mesa work on Intel E7221 equipped boards. Changelog:

  • Fri Dec 28 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 7.0.1-7.fc8.1
  • "Experimental" version by Hans de Goede <j.w.r.degoede@hhs.nl> to test some bugfixes, not an official Fedora mesa package
  • Fix maniadrive from crashing on intel graphics (bug 423701)  
  • Fix maniadrive slowness and wrong rendering on r300 and r200 cards (bug 304551)
  • Fix 3D on ATI x700 SE cards
  • Support intel e7221 (bz 425790)

Please grab and test this improved mesa version (click on the build for your arch then scroll down to get download links). Notice that this will only be available for about a week as koji deletes scratchbuilds after that. Feedback much appreciated, I hope that the Fedora mesa maintainers will pick up this bunch of patches and do an F-8 update with them included, I'm sure it will help if I can tell them quite a few people already tested this with positive results.
Tags: fedora, mesa
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened