diff options
author | Wolfgang Schupp <w.schupp@a1.net> | 2018-09-26 11:26:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-26 11:26:36 +0200 |
commit | bec7cc8f6b402baceac4f8a98ad9d004624ce918 (patch) | |
tree | 8fb03c7c95346cb1608567b1e39af59eb46aab58 | |
parent | fccf13b440fe4de676558bac3080fe46b6dc4ca1 (diff) | |
parent | bf44605b23977dcc8b37b63f1f550cc4e0bc23e4 (diff) |
Merge pull request #14250 from kwizart/armv7_build_neon
Armv7 build neon
-rw-r--r-- | xbmc/rendering/MatrixGL.cpp | 44 | ||||
-rw-r--r-- | xbmc/rendering/MatrixGL.neon.cpp | 47 | ||||
-rw-r--r-- | xbmc/rendering/gl/CMakeLists.txt | 7 | ||||
-rw-r--r-- | xbmc/rendering/gles/CMakeLists.txt | 7 |
4 files changed, 63 insertions, 42 deletions
diff --git a/xbmc/rendering/MatrixGL.cpp b/xbmc/rendering/MatrixGL.cpp index 8e9d944850..fc82cb35c9 100644 --- a/xbmc/rendering/MatrixGL.cpp +++ b/xbmc/rendering/MatrixGL.cpp @@ -9,8 +9,9 @@ #include "MatrixGL.h" #include "utils/TransformMatrix.h" -#if defined(HAS_NEON) +#if defined(HAS_NEON) && !defined(__LP64__) #include "utils/CPUInfo.h" +void Matrix4Mul(float* src_mat_1, const float* src_mat_2); #endif #include <cmath> @@ -128,47 +129,6 @@ void CMatrixGL::Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) MultMatrixf(matrix); } -#if defined(HAS_NEON) && !defined(__LP64__) - -static inline void Matrix4Mul(float* src_mat_1, const float* src_mat_2) -{ - asm volatile ( - // Store A & B leaving room at top of registers for result (q0-q3) - "vldmia %0, { q4-q7 } \n\t" - "vldmia %1, { q8-q11 } \n\t" - - // result = first column of B x first row of A - "vmul.f32 q0, q8, d8[0]\n\t" - "vmul.f32 q1, q8, d10[0]\n\t" - "vmul.f32 q2, q8, d12[0]\n\t" - "vmul.f32 q3, q8, d14[0]\n\t" - - // result += second column of B x second row of A - "vmla.f32 q0, q9, d8[1]\n\t" - "vmla.f32 q1, q9, d10[1]\n\t" - "vmla.f32 q2, q9, d12[1]\n\t" - "vmla.f32 q3, q9, d14[1]\n\t" - - // result += third column of B x third row of A - "vmla.f32 q0, q10, d9[0]\n\t" - "vmla.f32 q1, q10, d11[0]\n\t" - "vmla.f32 q2, q10, d13[0]\n\t" - "vmla.f32 q3, q10, d15[0]\n\t" - - // result += last column of B x last row of A - "vmla.f32 q0, q11, d9[1]\n\t" - "vmla.f32 q1, q11, d11[1]\n\t" - "vmla.f32 q2, q11, d13[1]\n\t" - "vmla.f32 q3, q11, d15[1]\n\t" - - // output = result registers - "vstmia %1, { q0-q3 }" - : //no output - : "r" (src_mat_2), "r" (src_mat_1) // input - note *value* of pointer doesn't change - : "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11" //clobber - ); -} -#endif void CMatrixGL::MultMatrixf(const CMatrixGL &matrix) noexcept { #if defined(HAS_NEON) && !defined(__LP64__) diff --git a/xbmc/rendering/MatrixGL.neon.cpp b/xbmc/rendering/MatrixGL.neon.cpp new file mode 100644 index 0000000000..3f3f33ce36 --- /dev/null +++ b/xbmc/rendering/MatrixGL.neon.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2005-2018 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. + */ + + +void Matrix4Mul(float* src_mat_1, const float* src_mat_2) +{ + asm volatile ( + // Store A & B leaving room at top of registers for result (q0-q3) + "vldmia %0, { q4-q7 } \n\t" + "vldmia %1, { q8-q11 } \n\t" + + // result = first column of B x first row of A + "vmul.f32 q0, q8, d8[0]\n\t" + "vmul.f32 q1, q8, d10[0]\n\t" + "vmul.f32 q2, q8, d12[0]\n\t" + "vmul.f32 q3, q8, d14[0]\n\t" + + // result += second column of B x second row of A + "vmla.f32 q0, q9, d8[1]\n\t" + "vmla.f32 q1, q9, d10[1]\n\t" + "vmla.f32 q2, q9, d12[1]\n\t" + "vmla.f32 q3, q9, d14[1]\n\t" + + // result += third column of B x third row of A + "vmla.f32 q0, q10, d9[0]\n\t" + "vmla.f32 q1, q10, d11[0]\n\t" + "vmla.f32 q2, q10, d13[0]\n\t" + "vmla.f32 q3, q10, d15[0]\n\t" + + // result += last column of B x last row of A + "vmla.f32 q0, q11, d9[1]\n\t" + "vmla.f32 q1, q11, d11[1]\n\t" + "vmla.f32 q2, q11, d13[1]\n\t" + "vmla.f32 q3, q11, d15[1]\n\t" + + // output = result registers + "vstmia %1, { q0-q3 }" + : //no output + : "r" (src_mat_2), "r" (src_mat_1) // input - note *value* of pointer doesn't change + : "memory", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11" //clobber + ); +} diff --git a/xbmc/rendering/gl/CMakeLists.txt b/xbmc/rendering/gl/CMakeLists.txt index 4c4a245fbe..00fff7668f 100644 --- a/xbmc/rendering/gl/CMakeLists.txt +++ b/xbmc/rendering/gl/CMakeLists.txt @@ -8,4 +8,11 @@ set(HEADERS GUIWindowTestPatternGL.h ../MatrixGL.h GLShader.h) +if(ARCH MATCHES arm AND ENABLE_NEON) + list(APPEND SOURCES ../MatrixGL.neon.cpp) + if(NOT DEFINED NEON_FLAGS) + set_source_files_properties(../MatrixGL.neon.cpp PROPERTIES COMPILE_OPTIONS -mfpu=neon) + endif() +endif() + core_add_library(rendering_gl) diff --git a/xbmc/rendering/gles/CMakeLists.txt b/xbmc/rendering/gles/CMakeLists.txt index 4df58e3c68..fc39514128 100644 --- a/xbmc/rendering/gles/CMakeLists.txt +++ b/xbmc/rendering/gles/CMakeLists.txt @@ -7,5 +7,12 @@ if(OPENGLES_FOUND) ../MatrixGL.h GLESShader.h) + if(ARCH MATCHES arm AND ENABLE_NEON) + list(APPEND SOURCES ../MatrixGL.neon.cpp) + if(NOT DEFINED NEON_FLAGS) + set_source_files_properties(../MatrixGL.neon.cpp PROPERTIES COMPILE_OPTIONS -mfpu=neon) + endif() + endif() + core_add_library(rendering_gles) endif() |