Skip to content

Commit

Permalink
Merge pull request #1176 from lrusak/kodi-17
Browse files Browse the repository at this point in the history
remove and rework kodi patches
  • Loading branch information
chewitt committed Jan 25, 2017
2 parents 5912b7c + 286db2a commit b05dae1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 165 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,75 +1,39 @@
From b2db330176ca1115ae9a4bc31af082b80b87ecdb Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Thu, 11 Aug 2016 07:32:48 +0100
Subject: [PATCH] LibreELEC: Detect intel gpus and use limited range by default
From f040af300925c03a1547ff02d71921bde9893330 Mon Sep 17 00:00:00 2001
From: fritsch <Peter.Fruehberger@gmail.com>
Date: Sat, 14 Jan 2017 10:23:11 +0100
Subject: [PATCH] VAAPI/VDPAU: Integration specific to LibreELEC

---
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(+)
xbmc/settings/Settings.cpp | 17 +++++++++++++++++
1 file changed, 17 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<AVCodecID, std::string> &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<AVCodecID, std::string> &map, AVCodecID id);
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 0e429f3..7052391 100644
index 9940b6a..d7575f0 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()
@@ -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)))
+ bool isIntel = CDVDVideoCodec::IsIntel();
+ 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);
Expand All @@ -78,6 +42,3 @@ index 0e429f3..7052391 100644
}

void CSettings::InitializeOptionFillers()
--
2.7.4

0 comments on commit b05dae1

Please sign in to comment.