From 2eea42f7eeb574e9b511c3ae18be26300eb63bf4 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 23 Aug 2026 12:26:09 +0200 Subject: [PATCH] remove old aarch64 CDM workarounds The workarounds were needed to use the ChromeOS library on Linux and are no longer required with the current, native Linux version. Signed-off-by: Matthias Reichl --- CMakeLists.txt | 11 -------- Helpers.cmake | 6 ---- lib/cdm_aarch64/CMakeLists.txt | 8 ------ lib/cdm_aarch64/cdm_loader.cpp | 31 --------------------- src/decrypters/widevine/CMakeLists.txt | 7 ----- src/decrypters/widevine/WVDecrypter.cpp | 37 ------------------------- src/decrypters/widevine/WVDecrypter.h | 5 ---- 7 files changed, 105 deletions(-) delete mode 100644 lib/cdm_aarch64/CMakeLists.txt delete mode 100644 lib/cdm_aarch64/cdm_loader.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f759068f6..d9e7b2097 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,6 @@ if(WIN32) list(APPEND DEPLIBS ${dlfcn-win32_LIBRARIES}) include_directories(${dlfcn-win32_INCLUDE_DIRS}) else() - list(APPEND DEPLIBS ${CMAKE_DL_LIBS}) # Required on some old linux platforms to use macro like PRIu64 add_definitions(-D__STDC_FORMAT_MACROS) # Force symbol visibility hidden by default for operative systems different than Windows, @@ -94,16 +93,6 @@ endforeach() get_property(DEPS_NAMES_LIST GLOBAL PROPERTY GlobalDepsNamesList) list(APPEND DEPLIBS ${DEPS_NAMES_LIST}) -# Add additional shared dependencies -get_property(DEPS_FOLDERS_LIST GLOBAL PROPERTY GlobalSharedDepsFoldersList) -foreach(DEP_FOLDER ${DEPS_FOLDERS_LIST}) - add_subdirectory(${DEP_FOLDER}) -endforeach() -get_property(DEPS_NAMES_LIST GLOBAL PROPERTY GlobalSharedDepsNamesList) -foreach(DEP_NAME ${DEPS_NAMES_LIST}) - list(APPEND ADP_ADDITIONAL_BINARY $) -endforeach() - build_addon(inputstream.adaptive ADP DEPLIBS) if(NOT CMAKE_CROSSCOMPILING AND BUILD_TESTING) diff --git a/Helpers.cmake b/Helpers.cmake index ee9c56631..a43a37458 100644 --- a/Helpers.cmake +++ b/Helpers.cmake @@ -76,9 +76,3 @@ function(add_dependency project_name folder) set_property(GLOBAL APPEND PROPERTY GlobalDepsNamesList "${project_name}") set_property(GLOBAL APPEND PROPERTY GlobalDepsFoldersList "${folder}") endfunction(add_dependency) - -# Function to add an additional shared dependency to global properties GlobalSharedDepsNamesList/GlobalSharedDepsFoldersList -function(add_shared_dependency project_name folder) - set_property(GLOBAL APPEND PROPERTY GlobalSharedDepsNamesList "${project_name}") - set_property(GLOBAL APPEND PROPERTY GlobalSharedDepsFoldersList "${folder}") -endfunction(add_shared_dependency) diff --git a/lib/cdm_aarch64/CMakeLists.txt b/lib/cdm_aarch64/CMakeLists.txt deleted file mode 100644 index 4b4536652..000000000 --- a/lib/cdm_aarch64/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.18...4.0) -project(cdm_aarch64_loader) - -add_library(cdm_aarch64_loader SHARED - cdm_loader.cpp -) - -set_target_properties(cdm_aarch64_loader PROPERTIES POSITION_INDEPENDENT_CODE True) diff --git a/lib/cdm_aarch64/cdm_loader.cpp b/lib/cdm_aarch64/cdm_loader.cpp deleted file mode 100644 index b4dbf6ca3..000000000 --- a/lib/cdm_aarch64/cdm_loader.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2023 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include - -extern "C" -{ -// Linux arm64 version of libwidevinecdm.so depends on two dynamic symbols. -// See https://github.com/xbmc/inputstream.adaptive/issues/1128 -#if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) - - __attribute__((target("no-outline-atomics"))) __attribute__((visibility("default"))) int32_t __aarch64_ldadd4_acq_rel(int32_t value, - int32_t* ptr) - { - return __atomic_fetch_add(ptr, value, __ATOMIC_ACQ_REL); - } - - __attribute__((target("no-outline-atomics"))) __attribute__((visibility("default"))) int32_t __aarch64_swp4_acq_rel(int32_t value, - int32_t* ptr) - { - return __atomic_exchange_n(ptr, value, __ATOMIC_ACQ_REL); - } -#endif -} diff --git a/src/decrypters/widevine/CMakeLists.txt b/src/decrypters/widevine/CMakeLists.txt index 3dc4ec540..2d4f89d9f 100644 --- a/src/decrypters/widevine/CMakeLists.txt +++ b/src/decrypters/widevine/CMakeLists.txt @@ -18,10 +18,3 @@ add_dir_sources(SOURCES HEADERS) # Native CDM library add_dependency(cdm_library lib/cdm) - -# Patch to load CDM library on aarch64 platforms -if(${CMAKE_SYSTEM_NAME} STREQUAL Linux) -if(CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^arm64") - add_shared_dependency(cdm_aarch64_loader lib/cdm_aarch64) -endif() -endif() diff --git a/src/decrypters/widevine/WVDecrypter.cpp b/src/decrypters/widevine/WVDecrypter.cpp index bb0156626..6f1ac27ff 100644 --- a/src/decrypters/widevine/WVDecrypter.cpp +++ b/src/decrypters/widevine/WVDecrypter.cpp @@ -17,49 +17,12 @@ #include "utils/StringUtils.h" #include "utils/log.h" -#if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) -#include -#endif - using namespace DRM; using namespace UTILS; CWVDecrypter::~CWVDecrypter() { m_WVCdmAdapter.reset(); - -#if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) - if (m_hdlLibLoader) - dlclose(m_hdlLibLoader); -#endif -} - -bool CWVDecrypter::Initialize() -{ -#if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) - // On linux arm64, libwidevinecdm.so depends on two dynamic symbols: - // __aarch64_ldadd4_acq_rel - // __aarch64_swp4_acq_rel - // These are defined from a separate library cdm_aarch64_loader, - // but to make them available in the main binary's PLT, we need RTLD_GLOBAL. - // Kodi kodi::tools::CDllHelper LoadDll() cannot be used because use RTLD_LOCAL, - // and we need the RTLD_GLOBAL flag. - std::string binaryPath; - if (!FILESYS::FindFilePath(FILESYS::GetAddonPath(), "libcdm_aarch64_loader.so", binaryPath)) - { - LOG::Log(LOGERROR, "Cannot find the libcdm_aarch64_loader.so file"); - return false; - } - - m_hdlLibLoader = dlopen(binaryPath.c_str(), RTLD_GLOBAL | RTLD_LAZY); - if (!m_hdlLibLoader) - { - LOG::LogF(LOGERROR, "Failed to load CDM aarch64 loader from path \"%s\", error: %s", - binaryPath.c_str(), dlerror()); - return false; - } -#endif - return true; } bool CWVDecrypter::IsKeySystemSupported(std::string_view keySystem) diff --git a/src/decrypters/widevine/WVDecrypter.h b/src/decrypters/widevine/WVDecrypter.h index f6f957ad0..afb102ce7 100644 --- a/src/decrypters/widevine/WVDecrypter.h +++ b/src/decrypters/widevine/WVDecrypter.h @@ -20,8 +20,6 @@ class ATTR_DLL_LOCAL CWVDecrypter : public DRM::IDecrypter virtual const std::string GetName() const override { return "Widevine-CDM"; } - virtual bool Initialize() override; - virtual bool IsKeySystemSupported(std::string_view keySystem) override; virtual std::shared_ptr CreateSingleSampleDecrypter( @@ -62,7 +60,4 @@ class ATTR_DLL_LOCAL CWVDecrypter : public DRM::IDecrypter std::shared_ptr m_WVCdmAdapter; std::shared_ptr m_decodingDecrypter; std::string m_libraryPath; -#if defined(__linux__) && (defined(__aarch64__) || defined(__arm64__)) - void* m_hdlLibLoader{nullptr}; // Aarch64 loader library handle -#endif };