Skip to content

Instantly share code, notes, and snippets.

@MilhouseVH
Created August 2, 2017 15:28
Show Gist options
  • Save MilhouseVH/2596212511e7e973389129e2d2c2fdd0 to your computer and use it in GitHub Desktop.
Save MilhouseVH/2596212511e7e973389129e2d2c2fdd0 to your computer and use it in GitHub Desktop.
From d18752623b952146f0afbbef4e5356b678df5584 Mon Sep 17 00:00:00 2001
From: croniccorey <cronmod.dev@gmail.com>
Date: Sat, 29 Apr 2017 10:10:12 -0400
Subject: [PATCH] [Kodi] Update NEON support
- __ARM_NEON__ is now legacy, Add __ARM_NEON defined by newer preprocessor
- Aarch64 always has neon, Change CPUInfo to report this
---
xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp | 2 +-
xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.S | 2 +-
xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.h | 2 +-
xbmc/guilib/MatrixGLES.cpp | 6 +++---
xbmc/utils/CPUInfo.cpp | 8 ++++++--
5 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
index ab0db0da7d84..fe62fd9a5d0f 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp
@@ -50,7 +50,7 @@ extern "C" {
#include "libswscale/swscale.h"
}
-#if defined(__ARM_NEON__) && !defined(__LP64__)
+#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(__LP64__)
#include "yuv2rgb.neon.h"
#include "utils/CPUInfo.h"
#endif
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.S b/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.S
index 48bbe378ae8a..f100bee76bff 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.S
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.S
@@ -7,7 +7,7 @@
//
//
//
-#if defined(__ARM_NEON__) && !defined(__LP64__)
+#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(__LP64__)
/* Initial ARM Neon implementation of core YUV2RGB functions. */
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.h b/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.h
index 6aeb368478a7..76b901226600 100644
--- a/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.h
+++ b/xbmc/cores/VideoPlayer/VideoRenderers/yuv2rgb.neon.h
@@ -22,7 +22,7 @@
extern "C" {
#endif
-#if defined(__ARM_NEON__) && !defined(__LP64__)
+#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(__LP64__)
void yuv420_2_rgb8888_neon
(
uint8_t *dst_ptr,
diff --git a/xbmc/guilib/MatrixGLES.cpp b/xbmc/guilib/MatrixGLES.cpp
index dbc8081d48de..ca5b0ebbc0ad 100644
--- a/xbmc/guilib/MatrixGLES.cpp
+++ b/xbmc/guilib/MatrixGLES.cpp
@@ -27,7 +27,7 @@
#include <cmath>
#include "MatrixGLES.h"
#include "utils/log.h"
-#if defined(__ARM_NEON__)
+#if defined(__ARM_NEON__) || defined(__ARM_NEON)
#include "utils/CPUInfo.h"
#endif
@@ -139,7 +139,7 @@ void CMatrixGL::Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
MultMatrixf(matrix);
}
-#if defined(__ARM_NEON__) && !defined(__LP64__)
+#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(__LP64__)
inline void Matrix4Mul(const float* src_mat_1, const float* src_mat_2, float* dst_mat)
{
@@ -182,7 +182,7 @@ inline void Matrix4Mul(const float* src_mat_1, const float* src_mat_2, float* ds
#endif
void CMatrixGL::MultMatrixf(const GLfloat *matrix)
{
-#if defined(__ARM_NEON__) && !defined(__LP64__)
+#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(__LP64__)
if ((g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON) == CPU_FEATURE_NEON)
{
GLfloat m[16];
diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp
index 5e2ebbd18d85..cc585785181c 100644
--- a/xbmc/utils/CPUInfo.cpp
+++ b/xbmc/utils/CPUInfo.cpp
@@ -43,7 +43,7 @@
#include <sys/resource.h>
#endif
-#if defined(TARGET_LINUX) && defined(__ARM_NEON__) && !defined(TARGET_ANDROID)
+#if defined(TARGET_LINUX) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) && !defined(TARGET_ANDROID)
#include <fcntl.h>
#include <unistd.h>
#include <elf.h>
@@ -957,7 +957,10 @@ bool CCPUInfo::HasNeon()
#elif defined(TARGET_DARWIN_IOS)
has_neon = 1;
-#elif defined(TARGET_LINUX) && defined(__ARM_NEON__)
+#elif defined(TARGET_LINUX) && (defined(__ARM_NEON__) || defined(__ARM_NEON))
+#if defined(__LP64__)
+ has_neon = 1;
+#else
if (has_neon == -1)
{
has_neon = 0;
@@ -978,6 +981,7 @@ bool CCPUInfo::HasNeon()
close(fd);
}
}
+#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment