Skip to content

Commit

Permalink
Merge branch 'master' into hotfix_pico53_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lvonasek committed Feb 3, 2023
2 parents 6dc264e + 13b3a54 commit f8b16a3
Show file tree
Hide file tree
Showing 372 changed files with 21,854 additions and 7,537 deletions.
19 changes: 16 additions & 3 deletions .gitlab-ci.yml
Expand Up @@ -38,7 +38,11 @@ include:

# MacOS 64-bit
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-x64.yml'
file: '/osx-cmake-x86.yml'

# MacOS arm64
- project: 'libretro-infrastructure/ci-templates'
file: '/osx-cmake-arm64.yml'

################################## CELLULAR ################################
# Android
Expand Down Expand Up @@ -92,9 +96,18 @@ libretro-build-osx-x64:
tags:
- macosx-packaging
extends:
- .libretro-osx-x64-make-default
- .libretro-osx-cmake-x86_64
- .core-defs
- .make-defs
- .cmake-defs

# MacOS 64-bit
libretro-build-osx-arm64:
tags:
- macosx-packaging
extends:
- .libretro-osx-cmake-arm64
- .core-defs
- .cmake-defs

################################### CELLULAR #################################
# Android ARMv7a
Expand Down
5 changes: 4 additions & 1 deletion .gitmodules
Expand Up @@ -12,7 +12,7 @@
url = https://github.com/Kingcom/armips.git
[submodule "ext/glslang"]
path = ext/glslang
url = https://github.com/hrydgard/glslang.git
url = https://github.com/KhronosGroup/glslang.git
[submodule "ext/SPIRV-Cross"]
path = ext/SPIRV-Cross
url = https://github.com/KhronosGroup/SPIRV-Cross.git
Expand All @@ -38,3 +38,6 @@
path = assets/debugger
url = https://github.com/unknownbrackets/ppsspp-debugger.git
branch = bundled
[submodule "cpu_features"]
path = ext/cpu_features
url = https://github.com/google/cpu_features.git
45 changes: 33 additions & 12 deletions CMakeLists.txt
Expand Up @@ -256,6 +256,7 @@ include(FindThreads)

if(APPLE)
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
find_library(QUARTZ_CORE_LIBRARY QuartzCore)
endif()

Expand Down Expand Up @@ -380,7 +381,11 @@ if(NOT MSVC)
if(IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
elseif(APPLE AND NOT CMAKE_CROSSCOMPILING)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
if(LIBRETRO AND ARM64)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -U__STRICT_ANSI__")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
elseif(NOT ANDROID)
Expand Down Expand Up @@ -472,6 +477,7 @@ set(CommonARM64
Common/Arm64Emitter.cpp
Common/ArmEmitter.h
Common/ArmEmitter.cpp
Core/Util/DisArm64.h
Core/Util/DisArm64.cpp
)
source_group(ARM64 FILES ${CommonARM64})
Expand Down Expand Up @@ -734,6 +740,10 @@ add_library(Common STATIC
Common/UI/View.h
Common/UI/ViewGroup.cpp
Common/UI/ViewGroup.h
Common/UI/ScrollView.cpp
Common/UI/ScrollView.h
Common/UI/PopupScreens.cpp
Common/UI/PopupScreens.h
Common/BitScan.h
Common/BitSet.h
Common/Buffer.h
Expand Down Expand Up @@ -770,12 +780,13 @@ add_library(Common STATIC
Common/SysError.cpp
Common/TimeUtil.cpp
Common/TimeUtil.h
Common/Battery/Battery.h
)

include_directories(Common)
setup_target_project(Common Common)

target_link_libraries(Common Ext::Snappy)
target_link_libraries(Common Ext::Snappy cpu_features)

if(USING_GLES2 OR (USING_EGL AND NOT USING_FBDEV))
find_package(X11)
Expand Down Expand Up @@ -1138,13 +1149,15 @@ elseif(IOS)
ios/PPSSPPUIApplication.mm
ios/SmartKeyboardMap.cpp
ios/SmartKeyboardMap.hpp
ios/SubtleVolume.h
ios/SubtleVolume.mm
ios/iCade/iCadeReaderView.h
ios/iCade/iCadeReaderView.m
ios/iCade/iCadeState.h
UI/DarwinFileSystemServices.mm
UI/DarwinFileSystemServices.h
Common/Battery/AppleBatteryClient.m
)
set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework MediaPlayer -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework UIKit -framework GLKit -framework OpenAL -framework AVFoundation -framework CoreLocation -framework CoreVideo -framework CoreMedia" )

set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework MediaPlayer -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework UIKit -framework GLKit -framework OpenAL -framework AVFoundation -framework CoreLocation -framework CoreVideo -framework CoreMedia -framework CoreServices" )
if(EXISTS "${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks/GameController.framework")
set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController")
endif()
Expand All @@ -1161,7 +1174,8 @@ elseif(IOS)
set_source_files_properties(ios/main.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/CameraHelper.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/LocationHelper.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)

set_source_files_properties(UI/DarwinFileSystemServices.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(Common/Battery/AppleBatteryClient.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set(TargetBin PPSSPP)
elseif(USING_QT_UI)
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -1219,8 +1233,10 @@ elseif(TARGET SDL2::SDL2)
endif()
set(nativeExtraLibs ${nativeExtraLibs} SDL2::SDL2)
if(APPLE)
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm SDL/SDLCocoaMetalLayer.h SDL/SDLCocoaMetalLayer.mm)
set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY})
set(nativeExtra ${nativeExtra} SDL/SDLMain.h SDL/SDLMain.mm SDL/SDLCocoaMetalLayer.h SDL/SDLCocoaMetalLayer.mm UI/DarwinFileSystemServices.mm UI/DarwinFileSystemServices.h Common/Battery/AppleBatteryClient.m)
set_source_files_properties(UI/DarwinFileSystemServices.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(Common/Battery/AppleBatteryClient.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set(nativeExtraLibs ${nativeExtraLibs} ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${IOKIT_LIBRARY})
elseif(USING_EGL)
set(nativeExtraLibs ${nativeExtraLibs} pthread)
endif()
Expand Down Expand Up @@ -1269,14 +1285,14 @@ list(APPEND NativeAppSource
UI/GPUDriverTestScreen.cpp
UI/TiltAnalogSettingsScreen.h
UI/TiltAnalogSettingsScreen.cpp
UI/TiltEventProcessor.h
UI/TiltEventProcessor.cpp
UI/TouchControlLayoutScreen.h
UI/TouchControlLayoutScreen.cpp
UI/TouchControlVisibilityScreen.h
UI/TouchControlVisibilityScreen.cpp
UI/GamepadEmu.h
UI/GamepadEmu.cpp
UI/JoystickHistoryView.h
UI/JoystickHistoryView.cpp
UI/OnScreenDisplay.h
UI/OnScreenDisplay.cpp
UI/ControlMappingScreen.h
Expand Down Expand Up @@ -1690,6 +1706,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/KeyMapDefaults.cpp
Core/KeyMapDefaults.h
Core/ThreadEventQueue.h
Core/TiltEventProcessor.h
Core/TiltEventProcessor.cpp
Core/WebServer.cpp
Core/WebServer.h
Core/Debugger/Breakpoints.cpp
Expand Down Expand Up @@ -2032,6 +2050,9 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Util/PPGeDraw.h
${GPU_SOURCES}
ext/disarm.cpp
ext/disarm.h
ext/riscv-disas.cpp
ext/riscv-disas.h
${CMAKE_CURRENT_BINARY_DIR}/git-version.cpp
)

Expand Down Expand Up @@ -2366,7 +2387,7 @@ if(HEADLESS)
)
endif()
add_executable(PPSSPPHeadless ${HeadlessSource})
target_link_libraries(PPSSPPHeadless ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${LinkCommon})
target_link_libraries(PPSSPPHeadless ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${IOKIT_LIBRARY} ${LinkCommon})
setup_target_project(PPSSPPHeadless headless)
endif()

Expand All @@ -2386,7 +2407,7 @@ if(UNITTEST)
Core/MIPS/ARM/ArmRegCache.cpp
Core/MIPS/ARM/ArmRegCacheFPU.cpp
)
target_link_libraries(PPSSPPUnitTest ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${LinkCommon} Common)
target_link_libraries(PPSSPPUnitTest ${COCOA_LIBRARY} ${QUARTZ_CORE_LIBRARY} ${IOKIT_LIBRARY} ${LinkCommon} Common)
setup_target_project(PPSSPPUnitTest unittest)
add_test(arm64_emitter PPSSPPUnitTest Arm64Emitter)
add_test(arm_emitter PPSSPPUnitTest ArmEmitter)
Expand Down
96 changes: 80 additions & 16 deletions Common/ArmCPUDetect.cpp
Expand Up @@ -26,6 +26,20 @@

#if PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)

#if PPSSPP_ARCH(ARM)
#include "ext/cpu_features/include/cpuinfo_arm.h"

#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)
#define USE_CPU_FEATURES 1
#endif
#elif PPSSPP_ARCH(ARM64) && defined(__aarch64__)
#include "ext/cpu_features/include/cpuinfo_aarch64.h"

#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)
#define USE_CPU_FEATURES 1
#endif
#endif

#include <ctype.h>

#include "Common/CommonTypes.h"
Expand Down Expand Up @@ -337,31 +351,81 @@ void CPUInfo::Detect()
bNEON = true;
bASIMD = true;
#endif

#if PPSSPP_ARCH(ARM) && defined(USE_CPU_FEATURES)
cpu_features::ArmInfo info = cpu_features::GetArmInfo();
bSwp = info.features.swp;
bHalf = info.features.half;
bThumb = info.features.thumb;
bFastMult = info.features.fastmult;
bEDSP = info.features.edsp;
bThumbEE = info.features.thumbee;
bNEON = info.features.neon;
bTLS = info.features.tls;
bVFP = info.features.vfp;
bVFPv3 = info.features.vfpv3;
bVFPv4 = info.features.vfpv4;
bIDIVa = info.features.idiva;
bIDIVt = info.features.idivt;
#endif
#if PPSSPP_ARCH(ARM64) && defined(USE_CPU_FEATURES)
cpu_features::Aarch64Info info = cpu_features::GetAarch64Info();
bFP = info.features.fp;
bASIMD = info.features.asimd;
bSVE = info.features.sve;
bSVE2 = info.features.sve2;
bFRINT = info.features.frint;
#endif
}

std::vector<std::string> CPUInfo::Features() {
std::vector<std::string> features;

struct Flag {
bool &flag;
const char *str;
};
const Flag list[] = {
{ bSwp, "SWP" },
{ bHalf, "Half" },
{ bThumb, "Thumb" },
{ bFastMult, "FastMult" },
{ bEDSP, "EDSP" },
{ bThumbEE, "ThumbEE" },
{ bTLS, "TLS" },
{ bVFP, "VFP" },
{ bVFPv3, "VFPv3" },
{ bVFPv4, "VFPv4" },
{ bNEON, "NEON" },
{ bIDIVa, "IDIVa" },
{ bIDIVt, "IDIVt" },
{ bFRINT, "FRINT" },
{ bSVE, "SVE" },
{ bSVE2, "SVE2" },
{ CPU64bit, "64-bit" },
};

for (auto &item : list) {
if (item.flag) {
features.push_back(item.str);
}
}

return features;
}

// Turn the cpu info into a string we can show
std::string CPUInfo::Summarize()
{
std::string CPUInfo::Summarize() {
std::string sum;
if (num_cores == 1)
sum = StringFromFormat("%s, %d core", cpu_string, num_cores);
else
sum = StringFromFormat("%s, %d cores", cpu_string, num_cores);
if (bSwp) sum += ", SWP";
if (bHalf) sum += ", Half";
if (bThumb) sum += ", Thumb";
if (bFastMult) sum += ", FastMult";
if (bEDSP) sum += ", EDSP";
if (bThumbEE) sum += ", ThumbEE";
if (bTLS) sum += ", TLS";
if (bVFP) sum += ", VFP";
if (bVFPv3) sum += ", VFPv3";
if (bVFPv4) sum += ", VFPv4";
if (bNEON) sum += ", NEON";
if (bIDIVa) sum += ", IDIVa";
if (bIDIVt) sum += ", IDIVt";
if (CPU64bit) sum += ", 64-bit";

auto features = Features();
for (std::string &feature : features) {
sum += ", " + feature;
}
return sum;
}

Expand Down

0 comments on commit f8b16a3

Please sign in to comment.