Bug 28437

Summary: [r300g] wrong texture colors with libtxc_dxtn.so
Product: Mesa Reporter: Fabio Pedretti <pedretti.fabio>
Component: Drivers/DRI/r300Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: console output

Description Fabio Pedretti 2010-06-08 02:15:37 UTC
Created attachment 36137 [details]
console output

When running the 0ad game editor ('0ad -editor') terrain is blue rather than green, and when I press the 'Terrain' button I see lots of:
Mesa 7.9-devel implementation error: util_create_rgba_surface() failed in decompress_with_blit()
Please report at bugzilla.freedesktop.org

It works fine with r300g without libtxc_dxtn.so, as well as with swrastg with or without libtxc_dxtn.so.

I am using mesa up to 3a876e84 with:
GL_RENDERER   = Gallium 0.4 on RV530
GL_VERSION    = 2.1 Mesa 7.9-devel

Full console output is attached.
Comment 1 Roland Scheidegger 2010-06-08 07:45:57 UTC
Looks to me like that's because decompress_with_blit adds a PIPE_BIND_TRANSFER_READ bind flag (apart from the PIPE_BIND_RENDER_TARGET flag), which the r300g driver thinks it can't handle in is_format_supported.
I think this flag is actually quite inconsistently used, pretty much all other places assume transfers are possible anyway even without this flag, though I guess the driver shouldn't choke on it.
Comment 2 Marek Olšák 2010-06-08 15:34:17 UTC
I think the transfer bind flags were added to note that a Direct3D surface should be lockable (it's possible to create a non-lockable surface there, especially when comes to depth-stencil formats, and a Direct3D driver is free not to support a lockable depth-stencil buffer if it doesn't want to).

Fabio, I've committed some fixes. Could you please test the 0ad editor again?
Comment 3 Fabio Pedretti 2010-06-09 00:05:52 UTC
The 'Mesa 7.9-devel implementation error: ...' no longer appears, however the terrain is still blueish rather than green as with swrastg or r300g without libtxc_dxtn.so.
Comment 4 Fabio Pedretti 2010-07-02 09:41:49 UTC
> terrain is still blueish rather than green as with swrastg or r300g without
> libtxc_dxtn.so.

Now that bug #28169 is fixed, also the game, other than the editor, has all textures blueish.
Comment 5 Alan Swanson 2010-07-02 10:09:58 UTC
Seems to affect UT2004 too on an AGP X1650 Pro running current mesa git when S3TC textures are enabled with libtxc_dxtn.so, the blue and red colours are swapped.
Comment 6 Marek Olšák 2010-07-08 15:54:33 UTC
Fixed with commit 392a2515c0967c395be098cac6a37f325dd66b90. Closing..

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.