On 2024 Aug 04 (Sun) at 21:13:07 +0200 (+0200), Jeremie Courreges-Anglas wrote:
:Still left to fix: x11/qt5/qtwebengine.  Here's a diff that drops the
:sys/auxv.h & getauxval code that breaks on arm64 (already dropped in
:upstream Skia).  Comment snagged from Landry's commit.
:
:ok?
:

OK

:
:Index: patches/patch-src_3rdparty_chromium_third_party_skia_src_core_SkCpu_cpp
:===================================================================
:RCS file: 
patches/patch-src_3rdparty_chromium_third_party_skia_src_core_SkCpu_cpp
:diff -N patches/patch-src_3rdparty_chromium_third_party_skia_src_core_SkCpu_cpp
:--- /dev/null  1 Jan 1970 00:00:00 -0000
:+++ patches/patch-src_3rdparty_chromium_third_party_skia_src_core_SkCpu_cpp    
4 Aug 2024 18:56:41 -0000
:@@ -0,0 +1,88 @@
:+drop cpu features detection, as done in upstream skia in
:+https://github.com/google/skia/commit/571b4cf2e35930f6744181b73b72939ab236f3ea
:+
:+fixes build since elf_aux_info/auxv.h addition
:+
:+Index: src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp
:+--- src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp.orig
:++++ src/3rdparty/chromium/third_party/skia/src/core/SkCpu.cpp
:+@@ -72,79 +72,6 @@
:+         return features;
:+     }
:+ 
:+-#elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
:+-    #include <sys/auxv.h>
:+-
:+-    static uint32_t read_cpu_features() {
:+-        const uint32_t kHWCAP_CRC32   = (1<< 7),
:+-                       kHWCAP_ASIMDHP = (1<<10);
:+-
:+-        uint32_t features = 0;
:+-        uint32_t hwcaps = getauxval(AT_HWCAP);
:+-        if (hwcaps & kHWCAP_CRC32  ) { features |= SkCpu::CRC32; }
:+-        if (hwcaps & kHWCAP_ASIMDHP) { features |= SkCpu::ASIMDHP; }
:+-
:+-        // The Samsung Mongoose 3 core sets the ASIMDHP bit but doesn't 
support it.
:+-        for (int core = 0; features & SkCpu::ASIMDHP; core++) {
:+-            // These /sys files contain the core's MIDR_EL1 register, the 
source of
:+-            // CPU {implementer, variant, part, revision} you'd see in 
/proc/cpuinfo.
:+-            SkString path =
:+-                
SkStringPrintf("/sys/devices/system/cpu/cpu%d/regs/identification/midr_el1", 
core);
:+-
:+-            // Can't use SkData::MakeFromFileName() here, I think because 
/sys can't be mmap()'d.
:+-            SkFILEStream midr_el1(path.c_str());
:+-            if (!midr_el1.isValid()) {
:+-                // This is our ordinary exit path.
:+-                // If we ask for MIDR_EL1 from a core that doesn't exist, 
we've checked all cores.
:+-                if (core == 0) {
:+-                    // On the other hand, if we can't read MIDR_EL1 from any 
core, assume the worst.
:+-                    features &= ~(SkCpu::ASIMDHP);
:+-                }
:+-                break;
:+-            }
:+-
:+-            const char kMongoose3[] = "0x00000000531f0020";  // 53 == 
Samsung.
:+-            char buf[SK_ARRAY_COUNT(kMongoose3) - 1];  // No need for the 
terminating \0.
:+-
:+-            if (SK_ARRAY_COUNT(buf) != midr_el1.read(buf, 
SK_ARRAY_COUNT(buf))
:+-                          || 0 == memcmp(kMongoose3, buf, 
SK_ARRAY_COUNT(buf))) {
:+-                features &= ~(SkCpu::ASIMDHP);
:+-            }
:+-        }
:+-        return features;
:+-    }
:+-
:+-#elif defined(SK_CPU_ARM32) && __has_include(<sys/auxv.h>) && \
:+-    (!defined(__ANDROID_API__) || __ANDROID_API__ >= 18)
:+-    // sys/auxv.h will always be present in the Android NDK due to unified
:+-    //headers, but getauxval is only defined for API >= 18.
:+-    #include <sys/auxv.h>
:+-
:+-    static uint32_t read_cpu_features() {
:+-        const uint32_t kHWCAP_NEON  = (1<<12);
:+-        const uint32_t kHWCAP_VFPv4 = (1<<16);
:+-
:+-        uint32_t features = 0;
:+-        uint32_t hwcaps = getauxval(AT_HWCAP);
:+-        if (hwcaps & kHWCAP_NEON ) {
:+-            features |= SkCpu::NEON;
:+-            if (hwcaps & kHWCAP_VFPv4) { features |= 
SkCpu::NEON_FMA|SkCpu::VFP_FP16; }
:+-        }
:+-        return features;
:+-    }
:+-
:+-#elif defined(SK_CPU_ARM32) && __has_include(<cpu-features.h>)
:+-    #include <cpu-features.h>
:+-
:+-    static uint32_t read_cpu_features() {
:+-        uint32_t features = 0;
:+-        uint64_t cpu_features = android_getCpuFeatures();
:+-        if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)     { features |= 
SkCpu::NEON; }
:+-        if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON_FMA) { features |= 
SkCpu::NEON_FMA; }
:+-        if (cpu_features & ANDROID_CPU_ARM_FEATURE_VFP_FP16) { features |= 
SkCpu::VFP_FP16; }
:+-        return features;
:+-    }
:+-
:+ #else
:+     static uint32_t read_cpu_features() {
:+         return 0;
:
:
:-- 
:jca

-- 
Calling J-Man Kink.  Calling J-Man Kink.  Hash missile sighted, target
Los Angeles.  Disregard personal feelings about city and intercept.

Reply via email to