diff --git a/Android.mk b/Android.mk index d53bf403b1..7262845c98 100644 --- a/Android.mk +++ b/Android.mk @@ -1,5 +1,45 @@ LOCAL_PATH := $(call my-dir) +SDL_PRIVATE_CFLAGS := \ + -DGL_GLEXT_PROTOTYPES \ + -Wall -Wextra \ + -Wmissing-prototypes \ + -Wunreachable-code-break \ + -Wunneeded-internal-declaration \ + -Wmissing-variable-declarations \ + -Wfloat-conversion \ + -Wshorten-64-to-32 \ + -Wunreachable-code-return \ + -Wshift-sign-overflow \ + -Wstrict-prototypes \ + -Wkeyword-macro \ + + +ifeq ($(TARGET_ARCH_ABI),arm64-v8a) + +########################### +# +# SVE2 simd code (arm64-v8a only) +# +########################### + +include $(CLEAR_VARS) + +LOCAL_MODULE := SDL3_sve2 + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/include/build_config $(LOCAL_PATH)/src + +LOCAL_SRC_FILES := \ + $(wildcard $(LOCAL_PATH)/src/video/arm/*.c) + +LOCAL_CFLAGS += \ + $(SDL_PRIVATE_CFLAGS) \ + -march=armv8-a+sve2 \ + +include $(BUILD_STATIC_LIBRARY) + +endif + ########################### # # SDL shared library @@ -84,22 +124,10 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/tray/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/android/*.c) \ - $(wildcard $(LOCAL_PATH)/src/video/arm/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c)) -LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES LOCAL_CFLAGS += \ - -Wall -Wextra \ - -Wmissing-prototypes \ - -Wunreachable-code-break \ - -Wunneeded-internal-declaration \ - -Wmissing-variable-declarations \ - -Wfloat-conversion \ - -Wshorten-64-to-32 \ - -Wunreachable-code-return \ - -Wshift-sign-overflow \ - -Wstrict-prototypes \ - -Wkeyword-macro \ + $(SDL_PRIVATE_CFLAGS) \ # Warnings we haven't fixed (yet) LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare @@ -114,6 +142,10 @@ ifeq ($(NDK_DEBUG),1) cmd-strip := endif +ifeq ($(TARGET_ARCH_ABI),arm64-v8a) +LOCAL_STATIC_LIBRARIES += SDL3_sve2 +endif + include $(BUILD_SHARED_LIBRARY) diff --git a/src/video/arm/SDL_sve2_extension.h b/src/video/arm/SDL_sve2_extension.h index c18dace028..f0a995fe20 100644 --- a/src/video/arm/SDL_sve2_extension.h +++ b/src/video/arm/SDL_sve2_extension.h @@ -22,30 +22,14 @@ /* * IMPORTANT: Please do NOT include this header file directly or indirectly * outside the src/video/arm folder. - * + * */ -#if !defined(SDL_SVE2_EXTENSION_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2) +#ifndef SDL_SVE2_EXTENSION_H #define SDL_SVE2_EXTENSION_H #include "SDL_sve2_util.h" -/* - * NOTE: Some Android builds didn't attach '-march=armv8-a+sve2' to - * SDL_sve2_*.c and hence the macro __ARM_FEATURE_SVE is not - * defined by the compiler. This might not be a problem as the - * SDL_TARGETING("arch=armv8-a+sve2") enables the feature for - * individual functions, until some version of compilers - * provides arm_sve.h raising errors then __ARM_FEATURE_SVE - * is not defined. Although it should be avoided, as a - * workaround, we have to define the __ARM_FEATURE_SVE here as - * an ugly hack. - */ -#ifdef SDL_PLATFORM_ANDROID -#ifndef __ARM_FEATURE_SVE -#define __ARM_FEATURE_SVE 1 -#endif -#endif #include #include @@ -1197,4 +1181,4 @@ static inline svuint16_t sdl_sve_chn_blend_with_3masks_and_opacity( return svlsr_n_u16_m(svptrue_b16(), vTarget, 8); // vTarget >> 8; } -#endif /* SDL_SVE2_EXTENSION_H */ \ No newline at end of file +#endif /* SDL_SVE2_EXTENSION_H */ diff --git a/src/video/arm/SDL_sve2_swizzle.h b/src/video/arm/SDL_sve2_swizzle.h index 032e9d6796..3cda4b667e 100644 --- a/src/video/arm/SDL_sve2_swizzle.h +++ b/src/video/arm/SDL_sve2_swizzle.h @@ -22,10 +22,10 @@ /* * IMPORTANT: Please do NOT include this header file directly or indirectly * outside the src/video/arm folder. - * + * */ -#if !defined(SD_SVE2_SWIZZLE_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2) +#ifndef SD_SVE2_SWIZZLE_H #define SD_SVE2_SWIZZLE_H #include "SDL_sve2_extension.h" @@ -2378,4 +2378,4 @@ static inline void sdl_sve_rgb32_to_rgb565_swizzle_dispatcher(SDL_BlitInfo *info } } -#endif /* SD_SVE2_SWIZZLE_H */ \ No newline at end of file +#endif /* SD_SVE2_SWIZZLE_H */