[SDL] [PATCH] Altivec blitters...
bob at redivi.com
Sat Feb 19 07:02:54 PST 2005
On Feb 19, 2005, at 7:39 AM, Ryan C. Gordon wrote:
>> - I made sure the configure.in checks to see that the syntax
>> extension you're using compiles.
> Apparently Apple's GCC uses -faltivec, but the FSF GCC uses -maltivec
> and specify vector constants differently; can someone on linux/ppc
> please test this patch?
>> - It no longer tries to execute the code (in the case you're
>> compiling altivec support on a G3 for some reason)
> You need to put it in a seperate, non-inline function if you use
> vector intrinsics: GCC inserts an Altivec opcode at the top of the
> function if it sees a vector thing...so it'll still crash on a G3
> as-is; the "if (0)" isn't enough to prevent it.
Ah, right. D'oh! I've never actually even used a G3, so I have no way
of testing this.
>> - It checks for altivec on darwin (I assume you were testing from
> I tested from the command line, but not on a real Darwin system, just
Then how did the configure.in possibly turn on Altivec? Did you patch
the makefile or configure script directly?
>> - Checks a sysctl to see if it should use prefetch or not (if L3
>> cache present, or not OS X, it uses prefetch -- optimal for G4)
> I got a huge boost on my powerbook (L2, but not L3 cache) with the
> prefetch. On a G5, the prefetch instructions cause pipeline stalls
> (which seems a really silly design decision from where I'm sitting,
> but whatever), so those should always avoid the prefetch. The G5,
> however, starts automatically prefetching when you touch a few
> cachelines linearly, which we do in this function, so it should get
> the same result as long as you don't try to force it with vec_dst().
> I'm not sure how to check for this reliably; there's a way to ask
> MacOS "am I on a G5?" but I'm not sure what that does when you are one
> day on a G6...there might be a sysctl or Gestalt to query if there's
> an automatic prefetch, though.
> The existance of G5-style prefetching is the only time we should avoid
> vec_dst*, though.
My 1ghz titanium powerbook G4 has 1mb of l3 cache:
% sysctl hw.l3cachesize
I think it's safe enough to use the version w/o prefetch on anything
that looks like a G5.. when/if another processor comes out, then we can
worry about fixing the test (if it also does not have L3).
>> - prefetch and no-prefetch 32-32 blits are separate functions (could
>> be the same function with userdata I guess).
> There were three conditionals regardless of dataset; I'm not really
> sure it's worth splitting it into a seperate function.
It was easiest this way because I didn't feel like reading more of the
SDL headers to see what the userdata member of that struct was :)
More information about the SDL