Bug 27729

Summary: [r300g, mesa] gallium compressed texture problems
Product: Mesa Reporter: Fabio Pedretti <pedretti.fabio>
Component: Drivers/DRI/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium CC: maraeo
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Command line output + backtrace
updated r300g backtrace
swrastg backtrace
patch for r300g is_format_supported()
swrastg debug output with "ST_DEBUG=mesa,tgsi"
swrastg debug output with "ST_DEBUG=mesa,tgsi"
updated r300g backtrace with ST_DEBUG=mesa,tgsi with mesa 7c5e2672
updated swrastg backtrace with ST_DEBUG=mesa,tgsi with mesa 7c5e2672

Description Fabio Pedretti 2010-04-19 01:24:04 UTC
Created attachment 35152 [details]
Command line output + backtrace

Using r300g up to 57e71b85020fff33d3e5701d0ef61e9fb84b0af4 the game 0ad crashes with:
pyrogenesis: main/mipmap.c:144: do_row: Assertion `comps >= 1' failed.

This seems a different problem than bug #27634 and could maybe be a mesa core problem. Command line output + backtrace is attached.
Comment 1 Brian Paul 2010-04-19 08:56:59 UTC
I suspect this is a problem with compressed textures.

Can you go up the stack trace into fallback_generate_mipmap() and print the value of texObj->Image[face][baseLevel]->TexFormat ?
Comment 2 Fabio Pedretti 2010-04-20 01:52:18 UTC
(In reply to comment #1)
> I suspect this is a problem with compressed textures.
> 
> Can you go up the stack trace into fallback_generate_mipmap() and print the
> value of texObj->Image[face][baseLevel]->TexFormat ?

(gdb) print texObj->Image[face][baseLevel]->TexFormat
$1 = 45
Comment 3 Fabio Pedretti 2010-04-26 02:13:56 UTC
Created attachment 35287 [details]
updated r300g backtrace

It now crashes with a different assertion (backtrace attached for both r300g and swrastg).
Comment 4 Fabio Pedretti 2010-04-26 02:14:33 UTC
Created attachment 35288 [details]
swrastg backtrace
Comment 5 Fabio Pedretti 2010-04-26 02:16:19 UTC
Note that I have libtxc_dxtn.so installed, but it crashes with different bt even without it.
Comment 6 Brian Paul 2010-04-27 07:30:15 UTC
I think I have this fixed now.  Can you re-test with mesa commit db14a8022a2a957c83b1fe33a84af3cdb1952d68 or later?
Comment 7 Fabio Pedretti 2010-04-27 08:31:26 UTC
(In reply to comment #6)
> I think I have this fixed now.  Can you re-test with mesa commit
> db14a8022a2a957c83b1fe33a84af3cdb1952d68 or later?

With 7567f05199f1ca114cc57e3a11ac101d3707f819 it's still crashing with the same backtraces of comment #3 and comment #4.
Comment 8 Brian Paul 2010-04-27 08:43:18 UTC
Created attachment 35312 [details] [review]
patch for r300g is_format_supported()

Here's a patch for r300g (totally untested) that might help.  If it doesn't, maybe you could debug further and fix the patch.

I think the softpipe bug is something else.  Could you provide the values of the vars at the failure point?
Comment 9 Fabio Pedretti 2010-04-27 09:03:57 UTC
(In reply to comment #8)
> Created an attachment (id=35312) [details]
> patch for r300g is_format_supported()
> 
> Here's a patch for r300g (totally untested) that might help.  If it doesn't,
> maybe you could debug further and fix the patch.

OK, with that patch r300g now crashes similar to swrastg.

> I think the softpipe bug is something else.  Could you provide the values of
> the vars at the failure point?

(gdb) p index
$2 = 1
(gdb) p t->psizoutindex
$3 = -1
(gdb) p t->prevInstWrotePsiz
$4 = 0 '\000'
(gdb) p t->outputMapping[index]
$5 = 19828484

Other vars?
Comment 10 Fabio Pedretti 2010-04-27 09:13:58 UTC
> (gdb) p index
> $2 = 1
> (gdb) p t->psizoutindex
> $3 = -1
> (gdb) p t->prevInstWrotePsiz
> $4 = 0 '\000'
> (gdb) p t->outputMapping[index]
> $5 = 19828484
> 
> Other vars?

That was with r300g. With swrastg:
(gdb) p t->outputMapping[index]
$1 = 19617796
Comment 11 Brian Paul 2010-04-27 15:16:15 UTC
Can you do "export ST_DEBUG=mesa,tgsi" and re-run?  That should print the GPU instructions to stderr.  Please attach that output to the bug report.  Thanks.
Comment 12 Fabio Pedretti 2010-04-28 01:16:27 UTC
Created attachment 35316 [details]
swrastg debug output with "ST_DEBUG=mesa,tgsi"

(In reply to comment #11)
> Can you do "export ST_DEBUG=mesa,tgsi" and re-run?  That should print the GPU
> instructions to stderr.  Please attach that output to the bug report.  Thanks.

Output with swrastg and mesa up to 37e98e5cd217075d58456753ed8450dc116fe32c is attached.
Comment 13 Brian Paul 2010-04-28 09:27:29 UTC
I've moved some of the debug code to get more useful info from "ST_DEBUG=mesa,tgsi".

Can you repeat the test with the latest Mesa code (commit ce0844b44cb3924323ed1fd2b75cda4dbd0013c7) or later?  Thanks.
Comment 14 Fabio Pedretti 2010-04-29 01:03:47 UTC
Created attachment 35327 [details]
swrastg debug output with "ST_DEBUG=mesa,tgsi"

Anyway you may also want to try the game yourself from http://trac.wildfiregames.com/wiki/LatestRelease since it appears it will be a common open source game when finished.
Comment 15 Fabio Pedretti 2010-04-29 01:11:49 UTC
In the meantime 95bfc8f32571751c5c9ec6d8e84f5e3c28d1b20e has been committed from Marek Olšák which is a subset of attached "patch for r300g is_format_supported()", but which appears to also fix the r300g problem.
Comment 16 Marek Olšák 2010-04-29 05:11:00 UTC
(In reply to comment #15)
> In the meantime 95bfc8f32571751c5c9ec6d8e84f5e3c28d1b20e has been committed
> from Marek Olšák which is a subset of attached "patch for r300g
> is_format_supported()", but which appears to also fix the r300g problem.

Yes but the S3TC code appears to be bloody slow, e.g. the TA3D game seems to load a new texture everytime a new GUI element shows up and during that the game basically locks up for 5 seconds with 100% CPU load. This is unbearable.
Comment 17 Marek Olšák 2010-05-08 07:52:40 UTC
Is this still an issue with current Mesa git?
Comment 18 Fabio Pedretti 2010-05-10 00:43:49 UTC
Created attachment 35535 [details]
updated r300g backtrace with ST_DEBUG=mesa,tgsi with mesa 7c5e2672

(In reply to comment #17)
> Is this still an issue with current Mesa git?

With mesa up to 7c5e2672f050644bcab6902b11d0ff4036603bb3 both r300g and swrast are still crashing, but now in a different way. Game log + backtrace are attached.
Comment 19 Fabio Pedretti 2010-05-10 00:44:24 UTC
Created attachment 35536 [details]
updated swrastg backtrace with ST_DEBUG=mesa,tgsi with mesa 7c5e2672
Comment 20 Fabio Pedretti 2010-05-19 00:40:21 UTC
This appears to be fixed, the game is however still crashing later, see bug #28169.

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.