From a063d8f61d8d21cff2fb3ba3fdb89d608fec3f27 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sat, 14 Jan 2017 01:48:18 -0800 Subject: [PATCH 1/4] kodi: remove patch, possibly fixed in kernel 4.9 --- .../kodi-999.99-ae-settings-samplerate.patch | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch b/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch deleted file mode 100644 index 53f3705363..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-ae-settings-samplerate.patch +++ /dev/null @@ -1,75 +0,0 @@ -From aabc63419df8aa69f156afdafb28820c3c9ccdc7 Mon Sep 17 00:00:00 2001 -From: fritsch -Date: Sat, 1 Nov 2014 12:44:54 +0100 -Subject: [PATCH] AdvancedSettings: Add minimalSampleRate to ActiveAE cause of - broken AVRs out there - ---- - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 8 ++++++++ - xbmc/settings/AdvancedSettings.cpp | 3 +++ - xbmc/settings/AdvancedSettings.h | 2 ++ - 3 files changed, 13 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index bf7e439..1687bad 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -28,6 +28,7 @@ using namespace ActiveAE; - #include "cores/AudioEngine/Encoders/AEEncoderFFmpeg.h" - - #include "settings/Settings.h" -+#include "settings/AdvancedSettings.h" - #include "windowing/WindowingFactory.h" - - #define MAX_CACHE_LEVEL 0.5 // total cache time of stream in seconds -@@ -1504,6 +1505,13 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett - format.m_channelLayout = AE_CH_LAYOUT_2_0; - } - -+ // OpenELEC workaround to define a minimum sample Rate for broken AVRs -+ if (format.m_sampleRate < g_advancedSettings.m_minimumSampleRate) -+ { -+ format.m_sampleRate = g_advancedSettings.m_minimumSampleRate; -+ CLog::Log(LOGDEBUG, "CActiveAE::MinimumSampleRate - Forced by use to samplerate %d", format.m_sampleRate); -+ } -+ - if (m_settings.config == AE_CONFIG_FIXED) - { - format.m_sampleRate = m_settings.samplerate; -diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index c4fa298..35728e4 100644 ---- a/xbmc/settings/AdvancedSettings.cpp -+++ b/xbmc/settings/AdvancedSettings.cpp -@@ -108,6 +108,8 @@ void CAdvancedSettings::Initialize() - return; - - m_audioHeadRoom = 0; -+ // OpenELEC workaround for broken AVRs -+ m_minimumSampleRate = 8000; - m_ac3Gain = 12.0f; - m_audioApplyDrc = -1.0f; - m_dvdplayerIgnoreDTSinWAV = false; -@@ -464,6 +466,7 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) - { - XMLUtils::GetFloat(pElement, "ac3downmixgain", m_ac3Gain, -96.0f, 96.0f); - XMLUtils::GetInt(pElement, "headroom", m_audioHeadRoom, 0, 12); -+ XMLUtils::GetInt(pElement, "minimumsamplerate", m_minimumSampleRate, 8000, 192000); - XMLUtils::GetString(pElement, "defaultplayer", m_audioDefaultPlayer); - // 101 on purpose - can be used to never automark as watched - XMLUtils::GetFloat(pElement, "playcountminimumpercent", m_audioPlayCountMinimumPercent, 0.0f, 101.0f); -diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h -index b0b4df1..7137614 100644 ---- a/xbmc/settings/AdvancedSettings.h -+++ b/xbmc/settings/AdvancedSettings.h -@@ -140,6 +140,8 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler - static void SettingOptionsLoggingComponentsFiller(const CSetting *setting, std::vector< std::pair > &list, int ¤t, void *data); - - int m_audioHeadRoom; -+ // OpenELEC workaround for minimum sample Rate -+ int m_minimumSampleRate; - float m_ac3Gain; - std::string m_audioDefaultPlayer; - float m_audioPlayCountMinimumPercent; --- -2.1.4 - From 764595b2b86ba1d0315f59eb5e176905b1d30ff4 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sat, 14 Jan 2017 01:49:01 -0800 Subject: [PATCH 2/4] kodi: remove patch, p-state driver exposes scaling_cur_freq just fine --- ...ead-frequency-output-if-using-intel-.patch | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch diff --git a/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch b/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch deleted file mode 100644 index bec2769ce6..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-100.11-add-support-to-read-frequency-output-if-using-intel-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 993c50a689feee190557a98a34f76683cf46c589 Mon Sep 17 00:00:00 2001 -From: Stephan Raue -Date: Mon, 1 Sep 2014 03:16:37 +0200 -Subject: [PATCH 11/13] add support to read frequency output if using intel's - pstate driver - ---- - xbmc/utils/CPUInfo.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/xbmc/utils/CPUInfo.cpp b/xbmc/utils/CPUInfo.cpp -index 9e709e7..9b5279f 100644 ---- a/xbmc/utils/CPUInfo.cpp -+++ b/xbmc/utils/CPUInfo.cpp -@@ -271,6 +271,8 @@ CCPUInfo::CCPUInfo(void) - m_fProcTemperature = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); // On Raspberry PIs - - m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r"); -+ if (m_fCPUFreq == NULL) -+ m_fCPUFreq = fopen ("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq", "r"); - if (!m_fCPUFreq) - { - m_cpuInfoForFreq = true; --- -2.5.0 - From 82e434597deafdf88da1f065717326c184a636ef Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sat, 14 Jan 2017 02:05:18 -0800 Subject: [PATCH 3/4] kodi: remove old intel detection patch --- .../kodi-999.99-detect-intel-gpus.patch | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch b/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch deleted file mode 100644 index fc1ebf792c..0000000000 --- a/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch +++ /dev/null @@ -1,83 +0,0 @@ -From b2db330176ca1115ae9a4bc31af082b80b87ecdb Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Thu, 11 Aug 2016 07:32:48 +0100 -Subject: [PATCH] LibreELEC: Detect intel gpus and use limited range by default - ---- - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp | 11 +++++++++++ - xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h | 5 +++++ - xbmc/settings/Settings.cpp | 9 +++++++++ - 3 files changed, 25 insertions(+) - -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -index e8071bd..83db224 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.cpp -@@ -22,6 +22,8 @@ - #include "settings/Settings.h" - #include "settings/lib/Setting.h" - #include "windowing/WindowingFactory.h" -+#include "utils/SysfsUtils.h" -+#include "utils/StringUtils.h" - - bool CDVDVideoCodec::IsSettingVisible(const std::string &condition, const std::string &value, const CSetting *setting, void *data) - { -@@ -72,3 +74,12 @@ bool CDVDVideoCodec::IsCodecDisabled(const std::map &map - } - return false; // don't disable what we don't have - } -+ -+bool CDVDVideoCodec::IsIntel() -+{ -+ // check if we are running on intel hardware -+ std::string gpuvendor; -+ SysfsUtils::GetString("/proc/fb", gpuvendor); -+ -+ return StringUtils::EndsWith(gpuvendor, "inteldrmfb"); -+} -diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -index a2da9de..cc8a574 100644 ---- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h -@@ -257,6 +257,11 @@ public: - static bool IsSettingVisible(const std::string &condition, const std::string &value, const CSetting *setting, void *data); - - /** -+ * Check if we are using an Intel GPU -+ */ -+ static bool IsIntel(); -+ -+ /** - * Interact with user settings so that user disabled codecs are disabled - */ - static bool IsCodecDisabled(const std::map &map, AVCodecID id); -diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp -index 0e429f3..7052391 100644 ---- a/xbmc/settings/Settings.cpp -+++ b/xbmc/settings/Settings.cpp -@@ -32,6 +32,7 @@ - #include "cores/AudioEngine/AEFactory.h" - #include "cores/playercorefactory/PlayerCoreFactory.h" - #include "cores/VideoPlayer/VideoRenderers/BaseRenderer.h" -+#include "cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodec.h" - #include "filesystem/File.h" - #include "guilib/GraphicContext.h" - #include "guilib/GUIAudioManager.h" -@@ -911,6 +912,14 @@ void CSettings::InitializeDefaults() - - if (g_application.IsStandAlone()) - ((CSettingInt*)m_settingsManager->GetSetting(CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNSTATE))->SetDefault(POWERSTATE_SHUTDOWN); -+ -+#if ((defined(HAVE_LIBVA) || defined(HAVE_LIBVDPAU))) -+ bool isIntel = CDVDVideoCodec::IsIntel(); -+ // Intel driver is operating in passthrough mode so use limited range by default -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOSCREEN_LIMITEDRANGE))->SetDefault(isIntel); -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVAAPI))->SetDefault(isIntel); -+ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVDPAU))->SetDefault(!isIntel); -+#endif - } - - void CSettings::InitializeOptionFillers() --- -2.7.4 - From deb8e68a2c2ff314b4fc7adcad09952f41c4770a Mon Sep 17 00:00:00 2001 From: fritsch Date: Sat, 14 Jan 2017 02:05:52 -0800 Subject: [PATCH 4/4] kodi: add reworked intel detection patch to avoid polluting DVDCodecInfo --- .../kodi-999.99-detect-intel-gpus.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch diff --git a/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch b/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch new file mode 100644 index 0000000000..4665dafcd7 --- /dev/null +++ b/packages/mediacenter/kodi/patches/kodi-999.99-detect-intel-gpus.patch @@ -0,0 +1,44 @@ +From f040af300925c03a1547ff02d71921bde9893330 Mon Sep 17 00:00:00 2001 +From: fritsch +Date: Sat, 14 Jan 2017 10:23:11 +0100 +Subject: [PATCH] VAAPI/VDPAU: Integration specific to LibreELEC + +--- + xbmc/settings/Settings.cpp | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp +index 9940b6a..d7575f0 100644 +--- a/xbmc/settings/Settings.cpp ++++ b/xbmc/settings/Settings.cpp +@@ -77,6 +77,7 @@ + #include "utils/log.h" + #include "utils/RssManager.h" + #include "utils/StringUtils.h" ++#include "utils/SysfsUtils.h" + #include "utils/SystemInfo.h" + #include "utils/Weather.h" + #include "utils/XBMCTinyXML.h" +@@ -914,6 +915,22 @@ void CSettings::InitializeDefaults() + + if (g_application.IsStandAlone()) + ((CSettingInt*)m_settingsManager->GetSetting(CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNSTATE))->SetDefault(POWERSTATE_SHUTDOWN); ++ ++ ++// LibreELEC integration patch. We ship a special limited range intel kernel patch ++// that enables us to control the full / limited / clamping with just altering ++// the kodi limitedrange setting. ++// For intel we use Limited Range, for nvidia we use full range ++// that setting is also used to enable vdpau on nvidia only, vaapi on intel only ++#if ((defined(HAVE_LIBVA) || defined(HAVE_LIBVDPAU))) ++ std::string gpuvendor; ++ SysfsUtils::GetString("/proc/fb", gpuvendor); ++ bool isIntel = StringUtils::EndsWith(gpuvendor, "inteldrmfb"); ++ // Intel driver is operating in passthrough mode so use limited range by default ++ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOSCREEN_LIMITEDRANGE))->SetDefault(isIntel); ++ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVAAPI))->SetDefault(isIntel); ++ ((CSettingBool*)GetSetting(CSettings::SETTING_VIDEOPLAYER_USEVDPAU))->SetDefault(!isIntel); ++#endif + } + + void CSettings::InitializeOptionFillers()