summaryrefslogtreecommitdiff
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
parent6ad5d896abfdc38550afb4a93aa37dfa96fa3f7f (diff)
downloadpkgsrc-349cdb9d9a8d3c9f4f9cfb3be65e00435e19c08d.tar.gz
Improve CPU / memory / system information on NetBSD.
-rw-r--r--multimedia/kodi/distinfo9
-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
5 files changed, 112 insertions, 41 deletions
diff --git a/multimedia/kodi/distinfo b/multimedia/kodi/distinfo
index 7c6d6e0144a..c567399c275 100644
--- a/multimedia/kodi/distinfo
+++ b/multimedia/kodi/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2015/11/17 18:15:33 jmcneill Exp $
+$NetBSD: distinfo,v 1.7 2015/11/18 23:27:23 jmcneill Exp $
SHA1 (15.2-Isengard.tar.gz) = 4acb4a60eadc7289f873cff5add31693b9520cba
RMD160 (15.2-Isengard.tar.gz) = d81d3f15783b2b69920ea85d7e04f01872f2d85f
@@ -31,7 +31,7 @@ SHA1 (patch-xbmc_interfaces_python_XBPython.cpp) = 0ad33ef736f12b6aca8667da5d509
SHA1 (patch-xbmc_linux_LinuxTimezone.cpp) = 18974ed63d1ac35a4060ea3d01826120b016c06e
SHA1 (patch-xbmc_linux_PlatformDefs.h) = 56d70fce18807b10cb8d42ac0feca94d0c113c57
SHA1 (patch-xbmc_linux_XFileUtils.cpp) = 4c03a869957ca501adaa5dc0d966cfd043e0d5c9
-SHA1 (patch-xbmc_linux_XMemUtils.cpp) = a225fd8d90e58c12295c47126c76ded36a5bcec5
+SHA1 (patch-xbmc_linux_XMemUtils.cpp) = 2c8fb8f80feb4d5f50518d9bd6fcc69519674658
SHA1 (patch-xbmc_network_linux_NetworkLinux.cpp) = febc3a9791d0c087261ccbbecdcffcaa4793e333
SHA1 (patch-xbmc_peripherals_bus_PeripheralBusUSB.h) = e3682d8fbfad9bca11a706c2ca3a77f0a7751e3a
SHA1 (patch-xbmc_peripherals_bus_linux_PeripheralBusUSBLibUSB.cpp) = 040678e8379f6797e8276d9787d60fcdb24e17c9
@@ -42,11 +42,12 @@ SHA1 (patch-xbmc_storage_MediaManager.cpp) = 5a816d5c6b060a99aa498f6f9b62571873d
SHA1 (patch-xbmc_system.h) = 10738c487ed6c2de066483cc077ad05037132da8
SHA1 (patch-xbmc_system__gl.h) = e2b8e3d57c6d838020163cf56e8f868c959af937
SHA1 (patch-xbmc_threads_platform_pthreads_ThreadImpl.cpp) = f8853a8ace422d9ab088be89b5562da552edcc7a
-SHA1 (patch-xbmc_utils_CPUInfo.cpp) = 79f044c36291886b1d32e80700ba3191aa93faf8
+SHA1 (patch-xbmc_utils_CPUInfo.cpp) = 292699f70c30c9462faea7c8bb2d2edb8836d226
SHA1 (patch-xbmc_utils_CharsetConverter.cpp) = 420a1e39d24c38dca2a8702a22b8cf67ef04dd3f
SHA1 (patch-xbmc_utils_Stopwatch.cpp) = fd2b8f7112e89ce164a0329ea3ee389f85705d1f
-SHA1 (patch-xbmc_utils_SystemInfo.cpp) = 751ca3390422387cea4dc0f240bb55eeb9e077a5
+SHA1 (patch-xbmc_utils_SystemInfo.cpp) = 444e0e34842f97660d521b9715c01fa4fe99a9f0
SHA1 (patch-xbmc_utils_test_TestSystemInfo.cpp) = eeca9e097346f9f2c7f047f5906d6ffb75fd393b
SHA1 (patch-xbmc_windowing_WinEvents.cpp) = 5e1c202214cd95671cc8bb503dd49080efd828f2
SHA1 (patch-xbmc_windowing_WindowingFactory.h) = 736df0f1a0f3c7e9048481a58c15951bdea017f1
SHA1 (patch-xbmc_windowing_X11_XRandR.cpp) = e0d03f225704019fb162022020d1d9ed72ed480a
+SHA1 (patch-xbmc_windows_GUIWindowSystemInfo.cpp) = 761af54a7728059356e14b15b55383d5a53c92a1
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