summaryrefslogtreecommitdiff
path: root/multimedia/kodi/patches
diff options
context:
space:
mode:
authorjmcneill <jmcneill@pkgsrc.org>2015-11-18 23:27:23 +0000
committerjmcneill <jmcneill@pkgsrc.org>2015-11-18 23:27:23 +0000
commit349cdb9d9a8d3c9f4f9cfb3be65e00435e19c08d (patch)
tree9c89311b2e7b25b12fd75b00a87d2983947a0161 /multimedia/kodi/patches
parent6ad5d896abfdc38550afb4a93aa37dfa96fa3f7f (diff)
downloadpkgsrc-349cdb9d9a8d3c9f4f9cfb3be65e00435e19c08d.tar.gz
Improve CPU / memory / system information on NetBSD.
Diffstat (limited to 'multimedia/kodi/patches')
-rw-r--r--multimedia/kodi/patches/patch-xbmc_linux_XMemUtils.cpp40
-rw-r--r--multimedia/kodi/patches/patch-xbmc_utils_CPUInfo.cpp72
-rw-r--r--multimedia/kodi/patches/patch-xbmc_utils_SystemInfo.cpp19
-rw-r--r--multimedia/kodi/patches/patch-xbmc_windows_GUIWindowSystemInfo.cpp13
4 files changed, 107 insertions, 37 deletions
diff --git a/multimedia/kodi/patches/patch-xbmc_linux_XMemUtils.cpp b/multimedia/kodi/patches/patch-xbmc_linux_XMemUtils.cpp
index acc7d9e18f5..199f16b6e47 100644
--- a/multimedia/kodi/patches/patch-xbmc_linux_XMemUtils.cpp
+++ b/multimedia/kodi/patches/patch-xbmc_linux_XMemUtils.cpp
@@ -1,4 +1,4 @@
-$NetBSD: patch-xbmc_linux_XMemUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+$NetBSD: patch-xbmc_linux_XMemUtils.cpp,v 1.2 2015/11/18 23:27:23 jmcneill Exp $
--- xbmc/linux/XMemUtils.cpp.orig 2015-10-19 06:31:15.000000000 +0000
+++ xbmc/linux/XMemUtils.cpp
@@ -22,35 +22,33 @@ $NetBSD: patch-xbmc_linux_XMemUtils.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
static FILE* procMeminfoFP = NULL;
#endif
-@@ -139,6 +143,31 @@ void GlobalMemoryStatusEx(LPMEMORYSTATUS
+@@ -139,6 +143,29 @@ void GlobalMemoryStatusEx(LPMEMORYSTATUS
if (sysctlbyname("vm.stats.vm.v_swappgsout", &swap_free, &len, NULL, 0) == 0)
lpBuffer->ullAvailPageFile = swap_free * pagesize;
+#elif defined(TARGET_NETBSD)
+ struct uvmexp_sysctl uvmexp;
-+ int64_t physmem = 0, mem_inactive = 0, mem_cache = 0, mem_free = 0;
-+ int pagesize;
++ int64_t filemin = 0;
++ int filemin_pct;
+ size_t len;
+
-+ /* sysctl hw.physmem64 */
-+ len = sizeof(physmem);
-+ if (sysctlbyname("hw.physmem64", &physmem, &len, NULL, 0) == 0) {
-+ lpBuffer->ullTotalPhys = physmem;
-+ lpBuffer->ullTotalVirtual = physmem;
++ /* sysctl vm.filemin */
++ len = sizeof(filemin_pct);
++ if (sysctlbyname("vm.filemin", &filemin_pct, &len, NULL, 0) == 0)
++ {
++ /* sysctl vm.uvmexp2 */
++ len = sizeof(uvmexp);
++ if (sysctlbyname("vm.uvmexp2", &uvmexp, &len, NULL, 0) == 0)
++ {
++ lpBuffer->ullTotalPhys = (uvmexp.active + uvmexp.inactive + uvmexp.free) * uvmexp.pagesize;
++ lpBuffer->ullTotalVirtual = (uvmexp.active + uvmexp.inactive + uvmexp.free) * uvmexp.pagesize;
++ filemin = MIN(uvmexp.filepages, ((uvmexp.active + uvmexp.inactive + uvmexp.free) * filemin_pct) / 100);
++ lpBuffer->ullAvailPhys = (uvmexp.free + uvmexp.filepages - filemin) * uvmexp.pagesize;
++ lpBuffer->ullAvailVirtual = (uvmexp.free + uvmexp.filepages - filemin) * uvmexp.pagesize;
++ lpBuffer->ullAvailPageFile = (uvmexp.swpages - uvmexp.swpginuse) * uvmexp.pagesize;
++ }
+ }
+
-+ /* sysctl vm.uvmexp2 */
-+ len = sizeof(uvmexp);
-+ if (sysctlbyname("vm.uvmexp2", &uvmexp, &len, NULL, 0) == 0) {
-+ pagesize = getpagesize();
-+ mem_inactive = uvmexp.inactive * pagesize;
-+ mem_cache = uvmexp.filepages * pagesize;
-+ mem_free = uvmexp.free * pagesize;
-+ lpBuffer->ullAvailPhys = mem_inactive + mem_cache + mem_free;
-+ lpBuffer->ullAvailVirtual = mem_inactive + mem_cache + mem_free;
-+ }
-+
-+ /* TODO: lpBuffer->ullAvailPageFile */
#else
struct sysinfo info;
char name[32];
diff --git a/multimedia/kodi/patches/patch-xbmc_utils_CPUInfo.cpp b/multimedia/kodi/patches/patch-xbmc_utils_CPUInfo.cpp
index d9f4c917c5e..63ebd9127b7 100644
--- a/multimedia/kodi/patches/patch-xbmc_utils_CPUInfo.cpp
+++ b/multimedia/kodi/patches/patch-xbmc_utils_CPUInfo.cpp
@@ -1,4 +1,4 @@
-$NetBSD: patch-xbmc_utils_CPUInfo.cpp,v 1.3 2015/11/17 18:15:33 jmcneill Exp $
+$NetBSD: patch-xbmc_utils_CPUInfo.cpp,v 1.4 2015/11/18 23:27:23 jmcneill Exp $
--- xbmc/utils/CPUInfo.cpp.orig 2015-10-19 06:31:15.000000000 +0000
+++ xbmc/utils/CPUInfo.cpp
@@ -20,25 +20,73 @@ $NetBSD: patch-xbmc_utils_CPUInfo.cpp,v 1.3 2015/11/17 18:15:33 jmcneill Exp $
size_t len;
int i;
char cpumodel[512];
-@@ -538,6 +538,8 @@ float CCPUInfo::getCPUFrequency()
+@@ -538,6 +538,12 @@ float CCPUInfo::getCPUFrequency()
if (sysctlbyname("dev.cpu.0.freq", &hz, &len, NULL, 0) != 0)
hz = 0;
return (float)hz;
+#elif defined(TARGET_NETBSD)
-+ return 0.f;
++ int hz = 0;
++ size_t len = sizeof(hz);
++ if (sysctlbyname("machdep.cpu.frequency.current", &hz, &len, NULL, 0) != 0)
++ hz = 0;
++ return (float)hz;
#else
int value = 0;
if (m_fCPUFreq && !m_cpuInfoForFreq)
-@@ -758,6 +760,8 @@ bool CCPUInfo::readProcStat(unsigned lon
- }
+@@ -699,7 +705,8 @@ bool CCPUInfo::readProcStat(unsigned lon
+ else
+ for (std::map<int, CoreInfo>::iterator it = m_cores.begin(); it != m_cores.end(); ++it)
+ it->second.m_fPct = double(m_lastUsedPercentage); // use CPU average as fallback
+-#elif defined(TARGET_FREEBSD)
++#elif defined(TARGET_FREEBSD) || defined(TARGET_NETBSD)
++#if defined(TARGET_FREEBSD)
+ long *cptimes;
+ size_t len;
+ int i;
+@@ -715,6 +722,19 @@ bool CCPUInfo::readProcStat(unsigned lon
+ free(cptimes);
+ return false;
}
- free(cptimes);
+#elif defined(TARGET_NETBSD)
-+ return false;
- #else
- if (m_fProcStat == NULL)
- return false;
-@@ -931,6 +935,18 @@ bool CCPUInfo::HasNeon()
++ uint64_t *cptimes;
++ size_t len;
++ int i;
++
++ len = sizeof(*cptimes) * m_cpuCount * CPUSTATES;
++ cptimes = (uint64_t*)malloc(len);
++ if (sysctlbyname("kern.cp_time", cptimes, &len, NULL, 0) != 0)
++ {
++ free(cptimes);
++ return false;
++ }
++#endif
+ user = 0;
+ nice = 0;
+ system = 0;
+@@ -722,7 +742,11 @@ bool CCPUInfo::readProcStat(unsigned lon
+ io = 0;
+ for (i = 0; i < m_cpuCount; i++)
+ {
++#if defined(TARGET_NETBSD)
++ int64_t coreUser, coreNice, coreSystem, coreIdle, coreIO;
++#else
+ long coreUser, coreNice, coreSystem, coreIdle, coreIO;
++#endif
+ double total;
+
+ coreUser = cptimes[i * CPUSTATES + CP_USER];
+@@ -741,7 +765,9 @@ bool CCPUInfo::readProcStat(unsigned lon
+ coreIO -= iter->second.m_io;
+
+ total = (double)(coreUser + coreNice + coreSystem + coreIdle + coreIO);
+- if(total != 0.0f)
++ if(total == 0.0f)
++ iter->second.m_fPct = 0.0f;
++ else
+ iter->second.m_fPct = ((double)(coreUser + coreNice + coreSystem) * 100.0) / total;
+
+ iter->second.m_user += coreUser;
+@@ -931,6 +957,18 @@ bool CCPUInfo::HasNeon()
#elif defined(TARGET_DARWIN_IOS)
has_neon = 1;
@@ -50,7 +98,7 @@ $NetBSD: patch-xbmc_utils_CPUInfo.cpp,v 1.3 2015/11/17 18:15:33 jmcneill Exp $
+ size_t len = sizeof(flag);
+ if (sysctlbyname("machdep.neon_present", &flag, &len, NULL, 0) == 0)
+ {
-+ has_neon = flag;
++ has_neon = 1;
+ }
+ }
+
diff --git a/multimedia/kodi/patches/patch-xbmc_utils_SystemInfo.cpp b/multimedia/kodi/patches/patch-xbmc_utils_SystemInfo.cpp
index 66721535275..8dec608b63a 100644
--- a/multimedia/kodi/patches/patch-xbmc_utils_SystemInfo.cpp
+++ b/multimedia/kodi/patches/patch-xbmc_utils_SystemInfo.cpp
@@ -1,4 +1,4 @@
-$NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp $
+$NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.2 2015/11/18 23:27:23 jmcneill Exp $
--- xbmc/utils/SystemInfo.cpp.orig 2015-10-19 06:31:15.000000000 +0000
+++ xbmc/utils/SystemInfo.cpp
@@ -42,7 +42,18 @@ $NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
osNameVer = GetOsName() + " " + GetOsVersion();
#elif defined(TARGET_ANDROID)
osNameVer = GetOsName() + " " + GetOsVersion() + " API level " + StringUtils::Format("%d", CJNIBuild::SDK_INT);
-@@ -1251,6 +1251,8 @@ std::string CSysInfo::GetBuildTargetPlat
+@@ -992,6 +992,10 @@ const std::string& CSysInfo::GetKernelCp
+ std::string machine(un.machine);
+ if (machine.compare(0, 3, "arm", 3) == 0)
+ kernelCpuFamily = "ARM";
++#if defined(TARGET_NETBSD)
++ else if (machine.compare(0, 6, "evbarm", 6) == 0)
++ kernelCpuFamily = "ARM";
++#endif
+ else if (machine.compare(0, 4, "mips", 4) == 0)
+ kernelCpuFamily = "MIPS";
+ else if (machine.compare(0, 4, "i686", 4) == 0 || machine == "i386" || machine == "amd64" || machine.compare(0, 3, "x86", 3) == 0)
+@@ -1251,6 +1255,8 @@ std::string CSysInfo::GetBuildTargetPlat
return "iOS";
#elif defined(TARGET_FREEBSD)
return "FreeBSD";
@@ -51,7 +62,7 @@ $NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
#elif defined(TARGET_ANDROID)
return "Android";
#elif defined(TARGET_LINUX)
-@@ -1274,6 +1276,8 @@ std::string CSysInfo::GetBuildTargetPlat
+@@ -1274,6 +1280,8 @@ std::string CSysInfo::GetBuildTargetPlat
return XSTR_MACRO(__IPHONE_OS_VERSION_MIN_REQUIRED);
#elif defined(TARGET_FREEBSD)
return XSTR_MACRO(__FreeBSD_version);
@@ -60,7 +71,7 @@ $NetBSD: patch-xbmc_utils_SystemInfo.cpp,v 1.1 2015/11/17 14:56:07 jmcneill Exp
#elif defined(TARGET_ANDROID)
return "API level " XSTR_MACRO(__ANDROID_API__);
#elif defined(TARGET_LINUX)
-@@ -1320,6 +1324,14 @@ std::string CSysInfo::GetBuildTargetPlat
+@@ -1320,6 +1328,14 @@ std::string CSysInfo::GetBuildTargetPlat
return StringUtils::Format("version %d.%d-STABLE", major, minor);
return StringUtils::Format("version %d.%d-CURRENT", major, minor);
diff --git a/multimedia/kodi/patches/patch-xbmc_windows_GUIWindowSystemInfo.cpp b/multimedia/kodi/patches/patch-xbmc_windows_GUIWindowSystemInfo.cpp
new file mode 100644
index 00000000000..d9403af2789
--- /dev/null
+++ b/multimedia/kodi/patches/patch-xbmc_windows_GUIWindowSystemInfo.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-xbmc_windows_GUIWindowSystemInfo.cpp,v 1.1 2015/11/18 23:27:23 jmcneill Exp $
+
+--- xbmc/windows/GUIWindowSystemInfo.cpp.orig 2015-10-19 06:31:15.000000000 +0000
++++ xbmc/windows/GUIWindowSystemInfo.cpp
+@@ -157,7 +157,7 @@ void CGUIWindowSystemInfo::FrameMove()
+ SET_CONTROL_LABEL(i++, g_sysinfo.GetCPUSerial());
+ #endif
+ SetControlLabel(i++, "%s %s", 22011, SYSTEM_CPU_TEMPERATURE);
+-#if !defined(__arm__) || defined(TARGET_RASPBERRY_PI)
++#if !defined(__arm__) || defined(TARGET_RASPBERRY_PI) || defined(TARGET_NETBSD)
+ SetControlLabel(i++, "%s %s", 13284, SYSTEM_CPUFREQUENCY);
+ #endif
+ #endif