mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #573 from MilhouseVH/fritsch4k
kodi/Intel: Various improvements from fritsch
This commit is contained in:
commit
949a8350e2
@ -17,6 +17,9 @@
|
||||
<setting id="videoscreen.screen">
|
||||
<visible>false</visible>
|
||||
</setting>
|
||||
<setting id="videoscreen.limitedrange">
|
||||
<level>1</level>
|
||||
</setting>
|
||||
</group>
|
||||
<group id="3">
|
||||
<setting id="videoscreen.noofbuffers">
|
||||
|
@ -0,0 +1,83 @@
|
||||
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
|
||||
|
||||
---
|
||||
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<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
|
||||
--- 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
|
||||
|
7
projects/Generic/filesystem/etc/X11/xorg-i915.conf
Normal file
7
projects/Generic/filesystem/etc/X11/xorg-i915.conf
Normal file
@ -0,0 +1,7 @@
|
||||
Section "Device"
|
||||
Identifier "Device0"
|
||||
Driver "intel"
|
||||
VendorName "INTEL Corporation"
|
||||
Option "TripleBuffer" "false"
|
||||
Option "TearFree" "false"
|
||||
EndSection
|
16
projects/Generic/filesystem/usr/bin/intel-fullrange.sh
Normal file
16
projects/Generic/filesystem/usr/bin/intel-fullrange.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
FB_TYPE="$(grep '^0 ' /proc/fb | sed 's/[^[:space:]] //')"
|
||||
|
||||
if [ "$FB_TYPE" == "inteldrmfb" ]; then
|
||||
OUTPUT=`/usr/bin/xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
|
||||
for out in $OUTPUT ; do
|
||||
# Hack - something is not yet fully right
|
||||
/usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Full"
|
||||
/usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Video 16:235 pass-through"
|
||||
# Seems there is a little race somewhere on some outputs
|
||||
# Turn the display shortly off and on again
|
||||
if [ -e "/storage/.config/forcedisplay" ]; then
|
||||
/usr/bin/xrandr -display :0 --output $out --off ; /usr/bin/xrandr -display :0 --output $out --auto
|
||||
fi
|
||||
done
|
||||
fi
|
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Restore full range after suspend
|
||||
Before=sleep.target
|
||||
StopWhenUnneeded=yes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/true
|
||||
ExecStop=-/bin/sh "/usr/bin/intel-fullrange.sh"
|
||||
|
||||
[Install]
|
||||
WantedBy=sleep.target
|
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=intel switch to full range
|
||||
Before=kodi.service
|
||||
After=graphical.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment=DISPLAY=:0.0
|
||||
ExecStart=-/bin/sh "/usr/bin/intel-fullrange.sh"
|
||||
StandardError=null
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=kodi.target
|
Loading…
x
Reference in New Issue
Block a user