Merge pull request #1091 from stenzek/android-armv7

CI armv7 builds
This commit is contained in:
Connor McLaughlin 2020-11-22 01:24:54 +10:00 committed by GitHub
commit 33e277e8d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 12 deletions

View File

@ -148,7 +148,7 @@ jobs:
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
- name: Compile and zip Linux x64 libretro core
shell: bash
@ -165,6 +165,21 @@ jobs:
name: "linux-libretro"
path: "build-libretro-linux-x64/duckstation_libretro_x64.so.zip"
- name: Compile and zip Linux armv7 libretro core
shell: bash
run: |
mkdir build-libretro-linux-armv7
cd build-libretro-linux-armv7
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeModules/armv7-cross-toolchain.cmake ..
cmake --build . --parallel 2
zip -j duckstation_libretro_linux_armv7.so.zip duckstation_libretro.so
- name: Upload Linux AArch64 libretro core
uses: actions/upload-artifact@v1
with:
name: "linux-libretro"
path: "build-libretro-linux-armv7/duckstation_libretro_linux_armv7.so.zip"
- name: Compile and zip Linux AArch64 libretro core
shell: bash
run: |
@ -173,13 +188,28 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON -DCMAKE_TOOLCHAIN_FILE=../CMakeModules/aarch64-cross-toolchain.cmake ..
cmake --build . --parallel 2
zip -j duckstation_libretro_linux_aarch64.so.zip duckstation_libretro.so
- name: Upload Linux AArch64 libretro core
uses: actions/upload-artifact@v1
with:
name: "linux-libretro"
path: "build-libretro-linux-aarch64/duckstation_libretro_linux_aarch64.so.zip"
- name: Compile and zip Android armv7 libretro core
shell: bash
run: |
mkdir build-libretro-android-armv7
cd build-libretro-android-armv7
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON -DANDROID_ABI=armeabi-v7a -DANDROID_ARM_NEON=ON -DCMAKE_TOOLCHAIN_FILE=${ANDROID_SDK_ROOT}/ndk-bundle/build/cmake/android.toolchain.cmake ..
cmake --build . --parallel 2
zip -j duckstation_libretro_android_armv7.so.zip duckstation_libretro_android.so
- name: Upload Android armv7 libretro core
uses: actions/upload-artifact@v1
with:
name: "linux-libretro"
path: "build-libretro-android-armv7/duckstation_libretro_android_armv7.so.zip"
- name: Compile and zip Android AArch64 libretro core
shell: bash
run: |
@ -224,14 +254,14 @@ jobs:
shell: bash
run: |
cd android
mv app/build/outputs/apk/release/app-release-unsigned-signed.apk ../duckstation-android-aarch64.apk
mv app/build/outputs/apk/release/app-release-unsigned-signed.apk ../duckstation-android.apk
- name: Upload APK
if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v1
with:
name: "android"
path: "duckstation-android-aarch64.apk"
path: "duckstation-android.apk"
macos-build:
runs-on: macos-10.15
@ -348,9 +378,11 @@ jobs:
linux-x64-appimage-qt/duckstation-qt-x64.AppImage
linux-x64-appimage-qt-zsync/duckstation-qt-x64.AppImage.zsync
linux-libretro/duckstation_libretro_x64.so.zip
linux-libretro/duckstation_libretro_linux_armv7.so.zip
linux-libretro/duckstation_libretro_linux_aarch64.so.zip
linux-libretro/duckstation_libretro_android_armv7.so.zip
linux-libretro/duckstation_libretro_android_aarch64.so.zip
android/duckstation-android-aarch64.apk
android/duckstation-android.apk
macos-x64/duckstation-mac-release.zip
macos-x64/duckstation_libretro_mac.dylib.zip

View File

@ -196,6 +196,15 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
set(CPU_ARCH "aarch64")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
set(CPU_ARCH "aarch32")
if(ANDROID)
# Force ARM mode, since apparently ANDROID_ARM_MODE isn't working..
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm")
else()
# Enable NEON.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -march=armv7-a+simd -mfpu=neon-vfpv3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -march=armv7-a+simd -mfpu=neon-vfpv3")
endif()
else()
message(FATAL_ERROR "Unknown system processor: " ${CMAKE_SYSTEM_PROCESSOR})
endif()

View File

@ -0,0 +1,14 @@
# Source: https://github.com/stenzek/duckstation/issues/626#issuecomment-660718306
# Target system
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR armv7l)
SET(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_CROSSCOMPILING TRUE)
# Cross compiler
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)
set(THREADS_PTHREAD_ARG "0" CACHE STRING "Result from TRY_RUN" FORCE)

View File

@ -30,8 +30,8 @@ android {
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
abiFilters "arm64-v8a"
arguments "-DCMAKE_BUILD_TYPE=Release -DANDROID_ARM_NEON=ON"
abiFilters "arm64-v8a", "armeabi-v7a"
}
}
}

View File

@ -83,6 +83,8 @@ u32 GetTexelSize(VkFormat format)
case VK_FORMAT_R5G5B5A1_UNORM_PACK16:
case VK_FORMAT_A1R5G5B5_UNORM_PACK16:
case VK_FORMAT_R5G6B5_UNORM_PACK16:
case VK_FORMAT_B5G6R5_UNORM_PACK16:
return 2;
case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:

View File

@ -11,6 +11,8 @@ Log_SetChannel(GPU_SW);
#if defined(CPU_X64)
#include <emmintrin.h>
#elif defined(CPU_AARCH32)
#include <arm_neon.h>
#elif defined(CPU_AARCH64)
#ifdef _MSC_VER
#include <arm64_neon.h>
@ -155,7 +157,7 @@ ALWAYS_INLINE void CopyOutRow16<HostDisplayPixelFormat::RGBA5551, u16>(const u16
_mm_storeu_si128(reinterpret_cast<__m128i*>(dst_ptr), value);
dst_ptr += 8;
}
#elif defined(CPU_AARCH64)
#elif defined(CPU_AARCH32) || defined(CPU_AARCH64)
const u32 aligned_width = Common::AlignDownPow2(width, 8);
for (; col < aligned_width; col += 8)
{
@ -195,7 +197,7 @@ ALWAYS_INLINE void CopyOutRow16<HostDisplayPixelFormat::RGB565, u16>(const u16*
_mm_storeu_si128(reinterpret_cast<__m128i*>(dst_ptr), value);
dst_ptr += 8;
}
#elif defined(CPU_AARCH64)
#elif defined(CPU_AARCH32) || defined(CPU_AARCH64)
const u32 aligned_width = Common::AlignDownPow2(width, 8);
const uint16x8_t single_mask = vdupq_n_u16(0x1F);
for (; col < aligned_width; col += 8)

View File

@ -102,8 +102,6 @@ void ALWAYS_INLINE_RELEASE GPU_SW_Backend::ShadePixel(const GPUBackendDrawComman
(cmd->draw_mode.GetTexturePageBaseY() + ZeroExtend32(texcoord_y)) % VRAM_HEIGHT);
const u16 palette_index = (palette_value >> ((texcoord_x % 4) * 4)) & 0x0Fu;
const u32 px = (cmd->palette.GetXBase() + ZeroExtend32(palette_index)) % VRAM_WIDTH;
const u32 py = cmd->palette.GetYBase();
texture_color.bits =
GetPixel((cmd->palette.GetXBase() + ZeroExtend32(palette_index)) % VRAM_WIDTH, cmd->palette.GetYBase());
}

View File

@ -248,7 +248,7 @@ bool VulkanHostDisplay::DownloadTexture(const void* texture_handle, u32 x, u32 y
}
static constexpr std::array<VkFormat, static_cast<u32>(HostDisplayPixelFormat::Count)> s_display_pixel_format_mapping =
{{VK_FORMAT_UNDEFINED, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16,
{{VK_FORMAT_UNDEFINED, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_R5G6B5_UNORM_PACK16,
VK_FORMAT_A1R5G5B5_UNORM_PACK16}};
bool VulkanHostDisplay::SupportsDisplayPixelFormat(HostDisplayPixelFormat format) const