We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4834

Summary: building altivec support on ppc64e results in color corruption in end products
Product: SDL Reporter: robert
Component: *don't know*Assignee: Ozkan Sezer <sezeroz>
Status: WAITING --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus, sezeroz
Version: 2.0.10   
Hardware: PowerPC   
OS: Linux   

Description robert 2019-10-20 12:36:38 UTC
Observed running Wesnoth on Gentoo ppc64le, if libsdl2 is built with altivec enabled there is color corruption in the game. Simply rebuilding without the altivec support the problem goes away.

It appears there is an endianness assumption in the altivec code.
Comment 1 Ozkan Sezer 2019-10-20 14:10:36 UTC
How does 2.0.11 (current hg) behave?  A fix was merged
for altivec with ppc64le about a month or so ago:
https://hg.libsdl.org/SDL/rev/9aa7aea27dec
Comment 2 robert 2019-10-23 08:51:53 UTC
I built 2.0.10 with the patch linked applied, and the patch on it's own doesn't seem to fix the issue.

I will investigate building from hg.
Comment 3 robert 2019-12-01 23:59:13 UTC
I have built libsdl2 from hg and it is still exhibiting the color corruption if built with altivec support enabled.
Comment 4 Ozkan Sezer 2019-12-02 00:17:34 UTC
(In reply to robert from comment #3)
> I have built libsdl2 from hg and it is still exhibiting the color
> corruption if built with altivec support enabled.

Do you have a patch?
Comment 5 robert 2019-12-02 00:41:34 UTC
I haven't actually looked at the source code at this point. I am building from mercurial using a live ebuild in Gentoo.
Comment 6 Sam Lantinga 2019-12-04 06:13:58 UTC
We don't have a test environment to reproduce this. Can you investigate the code and provide a tested patch that fixes the issue for you?

Thanks!
Comment 7 Ryan C. Gordon 2019-12-04 18:53:20 UTC
(In reply to Sam Lantinga from comment #6)
> We don't have a test environment to reproduce this. Can you investigate the
> code and provide a tested patch that fixes the issue for you?

Out of curiosity, where does one get a machine that supports this? Can it just be installed on an old G5 Mac and the OS will flip the CPU into littleendian mode at startup?

--ryan.
Comment 8 robert 2019-12-04 22:53:30 UTC
I have a Talos 2 from Raptor Computing Systems which uses POWER9 CPUs, and is bi-endian so can be run as either ppc64 or ppc64le. I opted to run ppc64le as it has less issues with endianness assumptions. Their website is https://www.raptorcs.com/ .

AIUI the PowerPC 970 CPU used in the Apple G5 systems was big endian only, as were most if not all IBM chips before the POWER7.