From 9fef2a114ea7eb6c42dd29e94ba5dc3451eb4560 Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 3 Feb 2025 11:48:18 -0500 Subject: Fix timer support on macOS under ARM64 --- indra/llcommon/llprocessor.cpp | 57 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'indra/llcommon/llprocessor.cpp') diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index a783e18e49..a6ecad2cf7 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -628,6 +628,8 @@ private: #elif LL_DARWIN +#include +#include #include #include @@ -638,17 +640,58 @@ public: { getCPUIDInfo(); uint64_t frequency = getSysctlInt64("hw.cpufrequency"); + if(frequency == 0) // Attempt to query IO Services for pcore frequency + { + CFMutableDictionaryRef arm_io_matching = IOServiceMatching("AppleARMIODevice"); + io_iterator_t iter; + kern_return_t ret = IOServiceGetMatchingServices(kIOMasterPortDefault, arm_io_matching, &iter); + if(ret == KERN_SUCCESS) + { + io_object_t obj; + while ((obj = IOIteratorNext(iter))) + { + io_name_t obj_class; + ret = IOObjectGetClass(obj, obj_class); + if(ret == KERN_SUCCESS) + { + io_name_t obj_name; + ret = IORegistryEntryGetName(obj, obj_name); + if(ret == KERN_SUCCESS) + { + if (strncmp(obj_name, "pmgr", sizeof(obj_name)) == 0) + { + CFTypeRef cfData = IORegistryEntryCreateCFProperty(obj, CFSTR("voltage-states5-sram"), kCFAllocatorDefault, 0); // pcore frequency + if(cfData) + { + CFIndex size = CFDataGetLength((CFDataRef)cfData); + std::vector databuf(size); + CFDataGetBytes((CFDataRef)cfData, CFRangeMake(0, size), databuf.data()); + + frequency = 0x00000000FFFFFFFF & ((databuf[size-5] << 24) | (databuf[size-6] << 16) | (databuf[size-7] << 8) | (databuf[size-8])); + CFRelease(cfData); + } + break; + } + } + } + } + } + } + if (frequency == 0) // fallback to clockrate and tbfrequency + { + frequency = getSysctlClockrate() * getSysctlInt64("hw.tbfrequency"); + } setInfo(eFrequency, (F64)frequency / (F64)1000000); } - virtual ~LLProcessorInfoDarwinImpl() {} + virtual ~LLProcessorInfoDarwinImpl() = default; private: int getSysctlInt(const char* name) { int result = 0; size_t len = sizeof(int); - int error = sysctlbyname(name, (void*)&result, &len, NULL, 0); + int error = sysctlbyname(name, (void*)&result, &len, nullptr, 0); return error == -1 ? 0 : result; } @@ -656,7 +699,7 @@ private: { uint64_t value = 0; size_t size = sizeof(value); - int result = sysctlbyname(name, (void*)&value, &size, NULL, 0); + int result = sysctlbyname(name, (void*)&value, &size, nullptr, 0); if ( result == 0 ) { if ( size == sizeof( uint64_t ) ) @@ -676,6 +719,14 @@ private: return result == -1 ? 0 : value; } + uint64_t getSysctlClockrate() + { + struct clockinfo clockrate{}; + size_t size = sizeof(clockrate); + int error = sysctlbyname("kern.clockrate", &clockrate, &size, nullptr, 0); + return error == -1 ? 0 : clockrate.hz; + } + void getCPUIDInfo() { size_t len = 0; -- cgit v1.3 From 5ffcd3dc88892a651fe9a95974280efb85e18a8b Mon Sep 17 00:00:00 2001 From: Rye Date: Thu, 28 Aug 2025 14:09:03 -0400 Subject: Fixes for GHA build --- build.sh | 3 ++- indra/cmake/Audio.cmake | 2 +- indra/cmake/Boost.cmake | 2 +- indra/cmake/OPENAL.cmake | 4 ++++ indra/cmake/OpenJPEG.cmake | 3 +++ indra/llcommon/llprocessor.cpp | 37 ------------------------------------- 6 files changed, 11 insertions(+), 40 deletions(-) (limited to 'indra/llcommon/llprocessor.cpp') diff --git a/build.sh b/build.sh index 9118cb4346..36e332cf42 100755 --- a/build.sh +++ b/build.sh @@ -158,6 +158,7 @@ pre_build() if [[ "$arch" == "Darwin" ]] then + HAVOK=OFF SIGNING=("-DENABLE_SIGNING:BOOL=YES" \ "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.") fi @@ -387,7 +388,7 @@ do if `cat "$build_dir/build_ok"` then case "$variant" in - Release) + Release*) if [ -r "$build_dir/autobuild-package.xml" ] then begin_section "Autobuild metadata" diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake index 6f61b056e0..5a7a7ab0b5 100644 --- a/indra/cmake/Audio.cmake +++ b/indra/cmake/Audio.cmake @@ -33,5 +33,5 @@ find_library(VORBISFILE_LIBRARY libvorbisfile.a PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) -target_link_libraries(ll::vorbis INTERFACE ${OGG_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}) +target_link_libraries(ll::vorbis INTERFACE ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY} ) diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 518e678585..7b3882c936 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -65,8 +65,8 @@ find_library(BOOST_URL_LIBRARY PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) target_link_libraries(ll::boost INTERFACE - ${BOOST_CONTEXT_LIBRARY} ${BOOST_FIBER_LIBRARY} + ${BOOST_CONTEXT_LIBRARY} ${BOOST_FILESYSTEM_LIBRARY} ${BOOST_PROGRAMOPTIONS_LIBRARY} ${BOOST_REGEX_LIBRARY} diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 2566a08189..ab1604aa22 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -26,11 +26,15 @@ if (USE_OPENAL) NAMES OpenAL32 openal + libopenal.dylib + libopenal.so PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) find_library(ALUT_LIBRARY NAMES alut + libalut.dylib + libalut.so PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) target_link_libraries(ll::openal INTERFACE ${OPENAL_LIBRARY} ${ALUT_LIBRARY}) diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index 33e9cf4898..95e71fd78e 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -12,6 +12,9 @@ use_prebuilt_binary(openjpeg) find_library(OPENJPEG_LIBRARY NAMES openjp2 + openjp2.lib + libopenjp2.a + libopenjp2.so PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) target_link_libraries(ll::openjpeg INTERFACE ${OPENJPEG_LIBRARY}) diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index a6ecad2cf7..718f471321 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -640,43 +640,6 @@ public: { getCPUIDInfo(); uint64_t frequency = getSysctlInt64("hw.cpufrequency"); - if(frequency == 0) // Attempt to query IO Services for pcore frequency - { - CFMutableDictionaryRef arm_io_matching = IOServiceMatching("AppleARMIODevice"); - io_iterator_t iter; - kern_return_t ret = IOServiceGetMatchingServices(kIOMasterPortDefault, arm_io_matching, &iter); - if(ret == KERN_SUCCESS) - { - io_object_t obj; - while ((obj = IOIteratorNext(iter))) - { - io_name_t obj_class; - ret = IOObjectGetClass(obj, obj_class); - if(ret == KERN_SUCCESS) - { - io_name_t obj_name; - ret = IORegistryEntryGetName(obj, obj_name); - if(ret == KERN_SUCCESS) - { - if (strncmp(obj_name, "pmgr", sizeof(obj_name)) == 0) - { - CFTypeRef cfData = IORegistryEntryCreateCFProperty(obj, CFSTR("voltage-states5-sram"), kCFAllocatorDefault, 0); // pcore frequency - if(cfData) - { - CFIndex size = CFDataGetLength((CFDataRef)cfData); - std::vector databuf(size); - CFDataGetBytes((CFDataRef)cfData, CFRangeMake(0, size), databuf.data()); - - frequency = 0x00000000FFFFFFFF & ((databuf[size-5] << 24) | (databuf[size-6] << 16) | (databuf[size-7] << 8) | (databuf[size-8])); - CFRelease(cfData); - } - break; - } - } - } - } - } - } if (frequency == 0) // fallback to clockrate and tbfrequency { frequency = getSysctlClockrate() * getSysctlInt64("hw.tbfrequency"); -- cgit v1.3 From bf4cd86a80459d1a3cbab457cd6e827eac594bd2 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Mon, 10 Nov 2025 16:07:24 -0500 Subject: Remove cpuid feature bits verification in llprocessor.cpp (#4959) * Remove cpuid feature bits verification in llprocessor.cpp --- indra/llcommon/llprocessor.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'indra/llcommon/llprocessor.cpp') diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 718f471321..0778b123ea 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -739,32 +739,7 @@ private: } } - // *NOTE:Mani - I didn't find any docs that assure me that machdep.cpu.feature_bits will always be - // The feature bits I think it is. Here's a test: -#ifndef LL_RELEASE_FOR_DOWNLOAD - #if defined(__i386__) && defined(__PIC__) - /* %ebx may be the PIC register. */ - #define __cpuid(level, a, b, c, d) \ - __asm__ ("xchgl\t%%ebx, %1\n\t" \ - "cpuid\n\t" \ - "xchgl\t%%ebx, %1\n\t" \ - : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #else - #define __cpuid(level, a, b, c, d) \ - __asm__ ("cpuid\n\t" \ - : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ - : "0" (level)) - #endif - - unsigned int eax, ebx, ecx, edx; - __cpuid(0x1, eax, ebx, ecx, edx); - if(feature_infos[0] != (S32)edx) - { - LL_WARNS() << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << LL_ENDL; - } -#endif // LL_RELEASE_FOR_DOWNLOAD - + // @TODO: Audit our usage of machdep.cpu.feature_bits. uint64_t ext_feature_info = getSysctlInt64("machdep.cpu.extfeature_bits"); S32 *ext_feature_infos = (S32*)(&ext_feature_info); -- cgit v1.3