xbmc-pvr: update XVBA patch, add some more upstream patches

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-01-04 19:24:38 +01:00
parent 4f11fc6e3b
commit 053ce926d6
5 changed files with 695 additions and 335 deletions

View File

@ -0,0 +1,255 @@
From ee1a1e2c428b5923da9c39f5a78bc9208e4f2047 Mon Sep 17 00:00:00 2001
From: CrystalP <CrystalP@xbmc.org>
Date: Mon, 2 Jan 2012 02:48:24 -0500
Subject: [PATCH] [WIN] fix reporting system memory > 4GB. Need to use
GlobalMemoryEx/MEMORYSTATUSEX instead of GlobalMemory
---
xbmc/GUIInfoManager.cpp | 13 ++++----
xbmc/guilib/TextureBundleXPR.cpp | 9 +++--
xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp | 7 ++--
xbmc/linux/PlatformDefs.h | 12 ++++----
xbmc/linux/XSyncUtils.cpp | 36 ++++++++++-----------
xbmc/linux/XSyncUtils.h | 2 +-
xbmc/windows/GUIWindowDebugInfo.cpp | 11 ++++---
7 files changed, 46 insertions(+), 44 deletions(-)
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 0e73d84..1faac26 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -1393,21 +1393,22 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow)
case SYSTEM_USED_MEMORY_PERCENT:
case SYSTEM_TOTAL_MEMORY:
{
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- int iMemPercentFree = 100 - ((int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f ));
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ int iMemPercentFree = 100 - ((int)( 100.0f* (stat.ullTotalPhys - stat.ullAvailPhys)/stat.ullTotalPhys + 0.5f ));
int iMemPercentUsed = 100 - iMemPercentFree;
if (info == SYSTEM_FREE_MEMORY)
- strLabel.Format("%luMB", (ULONG)(stat.dwAvailPhys/MB));
+ strLabel.Format("%luMB", (ULONG)(stat.ullAvailPhys/MB));
else if (info == SYSTEM_FREE_MEMORY_PERCENT)
strLabel.Format("%i%%", iMemPercentFree);
else if (info == SYSTEM_USED_MEMORY)
- strLabel.Format("%luMB", (ULONG)((stat.dwTotalPhys - stat.dwAvailPhys)/MB));
+ strLabel.Format("%luMB", (ULONG)((stat.ullTotalPhys - stat.ullAvailPhys)/MB));
else if (info == SYSTEM_USED_MEMORY_PERCENT)
strLabel.Format("%i%%", iMemPercentUsed);
else if (info == SYSTEM_TOTAL_MEMORY)
- strLabel.Format("%luMB", (ULONG)(stat.dwTotalPhys/MB));
+ strLabel.Format("%luMB", (ULONG)(stat.ullTotalPhys/MB));
}
break;
case SYSTEM_SCREEN_MODE:
diff --git a/xbmc/guilib/TextureBundleXPR.cpp b/xbmc/guilib/TextureBundleXPR.cpp
index d6df822..037b4c6 100644
--- a/xbmc/guilib/TextureBundleXPR.cpp
+++ b/xbmc/guilib/TextureBundleXPR.cpp
@@ -279,10 +279,11 @@ bool CTextureBundleXPR::LoadFile(const CStdString& Filename, CAutoTexBuffer& Unp
if (!buffer || !UnpackedBuf.Set((BYTE*)XPhysicalAlloc(file->second.UnpackedSize, MAXULONG_PTR, 128, PAGE_READWRITE)))
{ // failed due to lack of memory
#ifndef _LINUX
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- CLog::Log(LOGERROR, "Out of memory loading texture: %s (need %lu bytes, have %lu bytes)", name.c_str(),
- file->second.UnpackedSize + file->second.PackedSize, stat.dwAvailPhys);
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ CLog::Log(LOGERROR, "Out of memory loading texture: %s (need %lu bytes, have %"PRIu64" bytes)", name.c_str(),
+ file->second.UnpackedSize + file->second.PackedSize, stat.ullAvailPhys);
#elif defined(__APPLE__) || defined(__FreeBSD__)
CLog::Log(LOGERROR, "Out of memory loading texture: %s (need %d bytes)", name.c_str(),
file->second.UnpackedSize + file->second.PackedSize);
diff --git a/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp b/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp
index 22ebe2e..910b0cc 100644
--- a/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp
+++ b/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp
@@ -434,9 +434,10 @@
PyObject* XBMC_GetFreeMem(PyObject *self, PyObject *args)
{
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- return PyInt_FromLong( stat.dwAvailPhys / ( 1024 * 1024 ) );
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ return PyInt_FromLong( stat.ullAvailPhys / ( 1024 * 1024 ) );
}
// getCpuTemp() method
diff --git a/xbmc/linux/PlatformDefs.h b/xbmc/linux/PlatformDefs.h
index 8910bbc..aaed576 100644
--- a/xbmc/linux/PlatformDefs.h
+++ b/xbmc/linux/PlatformDefs.h
@@ -423,18 +423,18 @@ struct _stati64 {
#define _stat stat
// Memory
-typedef struct _MEMORYSTATUS
+typedef struct _MEMORYSTATUSEX
{
DWORD dwLength;
DWORD dwMemoryLoad;
uint64_t dwTotalPhys;
uint64_t dwAvailPhys;
- uint64_t dwTotalPageFile;
- uint64_t dwAvailPageFile;
- uint64_t dwTotalVirtual;
- uint64_t dwAvailVirtual;
-} MEMORYSTATUS, *LPMEMORYSTATUS;
+ uint64_t ullTotalPageFile;
+ uint64_t ullAvailPageFile;
+ uint64_t ullTotalVirtual;
+ uint64_t ullAvailVirtual;
+} MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
// Common HRESULT values
#ifndef NOERROR
diff --git a/xbmc/linux/XSyncUtils.cpp b/xbmc/linux/XSyncUtils.cpp
index 454ff85..19c4b5a 100644
--- a/xbmc/linux/XSyncUtils.cpp
+++ b/xbmc/linux/XSyncUtils.cpp
@@ -47,13 +47,12 @@
static FILE* procMeminfoFP = NULL;
#endif
-void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
+void GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
{
if (!lpBuffer)
return;
- memset(lpBuffer, 0, sizeof(MEMORYSTATUS));
- lpBuffer->dwLength = sizeof(MEMORYSTATUS);
+ memset(lpBuffer, 0, sizeof(MEMORYSTATUSEX));
#ifdef __APPLE__
uint64_t physmem;
@@ -63,7 +62,7 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
// Total physical memory.
if (sysctl(mib, miblen, &physmem, &len, NULL, 0) == 0 && len == sizeof (physmem))
- lpBuffer->dwTotalPhys = physmem;
+ lpBuffer->ullTotalPhys = physmem;
// Virtual memory.
mib[0] = CTL_VM; mib[1] = VM_SWAPUSAGE;
@@ -71,8 +70,8 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
len = sizeof(struct xsw_usage);
if (sysctl(mib, miblen, &swap, &len, NULL, 0) == 0)
{
- lpBuffer->dwAvailPageFile = swap.xsu_avail;
- lpBuffer->dwTotalVirtual = lpBuffer->dwTotalPhys + swap.xsu_total;
+ lpBuffer->ullAvailPageFile = swap.xsu_avail;
+ lpBuffer->ullTotalVirtual = lpBuffer->ullTotalPhys + swap.xsu_total;
}
// In use.
@@ -89,8 +88,8 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
{
uint64_t used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pageSize;
- lpBuffer->dwAvailPhys = lpBuffer->dwTotalPhys - used;
- lpBuffer->dwAvailVirtual = lpBuffer->dwAvailPhys; // FIXME.
+ lpBuffer->ullAvailPhys = lpBuffer->ullTotalPhys - used;
+ lpBuffer->ullAvailVirtual = lpBuffer->ullAvailPhys; // FIXME.
}
}
#elif defined(__FreeBSD__)
@@ -101,8 +100,8 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
/* physmem */
len = sizeof(physmem);
if (sysctlbyname("hw.physmem", &physmem, &len, NULL, 0) == 0) {
- lpBuffer->dwTotalPhys = physmem;
- lpBuffer->dwTotalVirtual = physmem;
+ lpBuffer->ullTotalPhys = physmem;
+ lpBuffer->ullTotalVirtual = physmem;
}
/* pagesize */
len = sizeof(pagesize);
@@ -122,11 +121,11 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
mem_free *= pagesize;
/* mem_avail = mem_inactive + mem_cache + mem_free */
- lpBuffer->dwAvailPhys = mem_inactive + mem_cache + mem_free;
- lpBuffer->dwAvailVirtual = mem_inactive + mem_cache + mem_free;
+ lpBuffer->ullAvailPhys = mem_inactive + mem_cache + mem_free;
+ lpBuffer->ullAvailVirtual = mem_inactive + mem_cache + mem_free;
if (sysctlbyname("vm.stats.vm.v_swappgsout", &swap_free, &len, NULL, 0) == 0)
- lpBuffer->dwAvailPageFile = swap_free * pagesize;
+ lpBuffer->ullAvailPageFile = swap_free * pagesize;
#else
struct sysinfo info;
char name[32];
@@ -159,12 +158,11 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer)
rewind(procMeminfoFP);
fflush(procMeminfoFP);
}
- lpBuffer->dwLength = sizeof(MEMORYSTATUS);
- lpBuffer->dwAvailPageFile = (info.freeswap * info.mem_unit);
- lpBuffer->dwAvailPhys = ((info.freeram + info.bufferram) * info.mem_unit);
- lpBuffer->dwAvailVirtual = ((info.freeram + info.bufferram) * info.mem_unit);
- lpBuffer->dwTotalPhys = (info.totalram * info.mem_unit);
- lpBuffer->dwTotalVirtual = (info.totalram * info.mem_unit);
+ lpBuffer->ullAvailPageFile = (info.freeswap * info.mem_unit);
+ lpBuffer->ullAvailPhys = ((info.freeram + info.bufferram) * info.mem_unit);
+ lpBuffer->ullAvailVirtual = ((info.freeram + info.bufferram) * info.mem_unit);
+ lpBuffer->ullTotalPhys = (info.totalram * info.mem_unit);
+ lpBuffer->ullTotalVirtual = (info.totalram * info.mem_unit);
#endif
}
diff --git a/xbmc/linux/XSyncUtils.h b/xbmc/linux/XSyncUtils.h
index c8effa2..f3ad36f 100644
--- a/xbmc/linux/XSyncUtils.h
+++ b/xbmc/linux/XSyncUtils.h
@@ -36,7 +36,7 @@
#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0 ) + 0 )
#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0 ) + 0 )
-void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer);
+void GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer);
#endif
diff --git a/xbmc/windows/GUIWindowDebugInfo.cpp b/xbmc/windows/GUIWindowDebugInfo.cpp
index 1b2bafa..916b032 100644
--- a/xbmc/windows/GUIWindowDebugInfo.cpp
+++ b/xbmc/windows/GUIWindowDebugInfo.cpp
@@ -97,17 +97,18 @@ void CGUIWindowDebugInfo::Process(unsigned int currentTime, CDirtyRegionList &di
CStdString info;
if (LOG_LEVEL_DEBUG_FREEMEM <= g_advancedSettings.m_logLevel)
{
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
CStdString profiling = CGUIControlProfiler::IsRunning() ? " (profiling)" : "";
CStdString strCores = g_cpuInfo.GetCoresUsageString();
#if !defined(_LINUX)
- info.Format("LOG: %sxbmc.log\nMEM: %d/%d KB - FPS: %2.1f fps\nCPU: %s%s", g_settings.m_logFolder.c_str(),
- stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
+ info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s%s", g_settings.m_logFolder.c_str(),
+ stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), profiling.c_str());
#else
double dCPU = m_resourceCounter.GetCPUUsage();
info.Format("LOG: %sxbmc.log\nMEM: %"PRIu64"/%"PRIu64" KB - FPS: %2.1f fps\nCPU: %s (CPU-XBMC %4.2f%%%s)", g_settings.m_logFolder.c_str(),
- stat.dwAvailPhys/1024, stat.dwTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
+ stat.ullAvailPhys/1024, stat.ullTotalPhys/1024, g_infoManager.GetFPS(), strCores.c_str(), dCPU, profiling.c_str());
#endif
}
--
1.7.5.4

View File

@ -0,0 +1,27 @@
From 2f91d0ca3735ab9b1abbfe6e3c6613e56951b7d2 Mon Sep 17 00:00:00 2001
From: wsoltys <wiso@xbmc.org>
Date: Mon, 2 Jan 2012 11:13:02 +0100
Subject: [PATCH] fixed: Linux compiler error (hopefully)
---
xbmc/linux/PlatformDefs.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xbmc/linux/PlatformDefs.h b/xbmc/linux/PlatformDefs.h
index aaed576..33d1c96 100644
--- a/xbmc/linux/PlatformDefs.h
+++ b/xbmc/linux/PlatformDefs.h
@@ -428,8 +428,8 @@ struct _stati64 {
DWORD dwLength;
DWORD dwMemoryLoad;
- uint64_t dwTotalPhys;
- uint64_t dwAvailPhys;
+ uint64_t ullTotalPhys;
+ uint64_t ullAvailPhys;
uint64_t ullTotalPageFile;
uint64_t ullAvailPageFile;
uint64_t ullTotalVirtual;
--
1.7.5.4

View File

@ -0,0 +1,30 @@
From 32df6ef9fc30cd2215e2a0886ceb5dab368ee31a Mon Sep 17 00:00:00 2001
From: arnova <nospam@void.org>
Date: Mon, 2 Jan 2012 11:41:02 +0100
Subject: [PATCH] fixed: Linux compiler error (again)
---
xbmc/GUIInfoManager.cpp | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 1faac26..0102008 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -1708,9 +1708,10 @@ bool CGUIInfoManager::GetInt(int &value, int info, int contextWindow, const CGUI
case SYSTEM_FREE_MEMORY:
case SYSTEM_USED_MEMORY:
{
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- int memPercentUsed = (int)( 100.0f* (stat.dwTotalPhys - stat.dwAvailPhys)/stat.dwTotalPhys + 0.5f );
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(MEMORYSTATUSEX);
+ GlobalMemoryStatusEx(&stat);
+ int memPercentUsed = (int)( 100.0f* (stat.ullTotalPhys - stat.ullAvailPhys)/stat.ullTotalPhys + 0.5f );
if (info == SYSTEM_FREE_MEMORY)
value = 100 - memPercentUsed;
else
--
1.7.5.4

View File

@ -0,0 +1,29 @@
From 067004b0301366cb4bafc22dff21ec396e044bb7 Mon Sep 17 00:00:00 2001
From: arnova <arnova@void.org>
Date: Wed, 21 Dec 2011 13:59:13 +0100
Subject: [PATCH] [SDL] fixed: Crash when mixer fails to initialise
---
xbmc/guilib/GUIAudioManager.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/xbmc/guilib/GUIAudioManager.cpp b/xbmc/guilib/GUIAudioManager.cpp
index 83f4e40..db58426 100644
--- a/xbmc/guilib/GUIAudioManager.cpp
+++ b/xbmc/guilib/GUIAudioManager.cpp
@@ -73,8 +73,10 @@ void CGUIAudioManager::Initialize(int iDevice)
#elif defined(HAS_SDL_AUDIO)
Mix_CloseAudio();
if (Mix_OpenAudio(44100, AUDIO_S16, 2, 4096))
- CLog::Log(LOGERROR, "Unable to open audio mixer");
- Mix_Volume(0, (int)(128.f * (g_settings.m_nVolumeLevel - VOLUME_MINIMUM) / (float)(VOLUME_MAXIMUM - VOLUME_MINIMUM)));
+ CLog::Log(LOGERROR, "Unable to open audio mixer");
+ else
+ Mix_Volume(0, (int)(128.f * (g_settings.m_nVolumeLevel - VOLUME_MINIMUM) / (float)(VOLUME_MAXIMUM - VOLUME_MINIMUM)));
+
m_bInitialized = true;
#endif
}
--
1.7.5.4