From f370e1a6458575c1d8c450e7f61ecc3043022e82 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 3 Aug 2024 11:02:29 -0700
Subject: [PATCH] Removed the SDL_ALTIVEC_BLIT_FEATURES environment variable.
This code has long since been tested, and none of the developers have an Altivec CPU.
---
src/video/SDL_blit_N.c | 43 ++++++++++++++++--------------------------
1 file changed, 16 insertions(+), 27 deletions(-)
diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c
index 6a5501d4ea8a6..b94f43f832cf4 100644
--- a/src/video/SDL_blit_N.c
+++ b/src/video/SDL_blit_N.c
@@ -36,14 +36,11 @@
/* Functions to blit from N-bit surfaces to other surfaces */
-enum blit_features
-{
- BLIT_FEATURE_NONE = 0,
- BLIT_FEATURE_HAS_MMX = 1,
- BLIT_FEATURE_HAS_ALTIVEC = 2,
- BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH = 4,
- BLIT_FEATURE_HAS_ARM_SIMD = 8
-};
+#define BLIT_FEATURE_NONE 0x00
+#define BLIT_FEATURE_HAS_MMX 0x01
+#define BLIT_FEATURE_HAS_ALTIVEC 0x02
+#define BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH 0x04
+#define BLIT_FEATURE_HAS_ARM_SIMD 0x08
#ifdef SDL_ALTIVEC_BLITTERS
#ifdef SDL_PLATFORM_MACOS
@@ -873,26 +870,18 @@ static void ConvertAltivec32to32_prefetch(SDL_BlitInfo *info)
vec_dss(DST_CHAN_DEST);
}
-static enum blit_features GetBlitFeatures(void)
+static Uint32 GetBlitFeatures(void)
{
- static enum blit_features features = -1;
- if (features == (enum blit_features) - 1) {
- /* Provide an override for testing .. */
- const char *override = SDL_getenv("SDL_ALTIVEC_BLIT_FEATURES");
- if (override) {
- unsigned int features_as_uint = 0;
- SDL_sscanf(override, "%u", &features_as_uint);
- features = (enum blit_features)features_as_uint;
- } else {
- features = (0
- /* Feature 1 is has-MMX */
- | ((SDL_HasMMX()) ? BLIT_FEATURE_HAS_MMX : 0)
- /* Feature 2 is has-AltiVec */
- | ((SDL_HasAltiVec()) ? BLIT_FEATURE_HAS_ALTIVEC : 0)
- /* Feature 4 is dont-use-prefetch */
- /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */
- | ((GetL3CacheSize() == 0) ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0));
- }
+ static Uint32 features = ~0u;
+ if (features == ~0u) {
+ features = (0
+ /* Feature 1 is has-MMX */
+ | ((SDL_HasMMX()) ? BLIT_FEATURE_HAS_MMX : 0)
+ /* Feature 2 is has-AltiVec */
+ | ((SDL_HasAltiVec()) ? BLIT_FEATURE_HAS_ALTIVEC : 0)
+ /* Feature 4 is dont-use-prefetch */
+ /* !!!! FIXME: Check for G5 or later, not the cache size! Always prefetch on a G4. */
+ | ((GetL3CacheSize() == 0) ? BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH : 0));
}
return features;
}