Skip to content
Permalink
Browse files

Added `shikigva=16` (repurposed) property to use AMD hardware DRM dec…

…oder in select apps
  • Loading branch information
vit9696 committed Nov 21, 2019
1 parent 200ce32 commit 7d30dd8a624d0d3b2d4882fcc689b9db4964efd5
Showing with 104 additions and 13 deletions.
  1. +1 −0 Changelog.md
  2. +4 −1 Manual/FAQ.Shiki.en.md
  3. +4 −1 Manual/FAQ.Shiki.ru.md
  4. +66 −0 Resources/Patches.plist
  5. +26 −7 WhateverGreen/kern_shiki.cpp
  6. +3 −4 WhateverGreen/kern_shiki.hpp
@@ -10,6 +10,7 @@ WhateverGreen Changelog
- Added `applbkl` aliases to IORegistry (data, 32-bit)
- Added `applbkl-name` and `applbkl-data` IORegistry data keys to provide custom backlight data
- Fixed applying CoreFP patches on Apple firmware, when they are not needed
- Added `shikigva=16` (repurposed) property to use AMD hardware DRM decoder in select apps

This comment has been minimized.

Copy link
@cattyhouse

cattyhouse Nov 21, 2019

Contributor

worked like a charm, thank you, Vit

This comment has been minimized.

Copy link
@cattyhouse

cattyhouse Nov 21, 2019

Contributor

feel like i should post here, Safari still does not play this one: https://bitmovin.com/demos/drm, if you want me to fire a bug, i will do it.

This comment has been minimized.

Copy link
@vit9696

vit9696 Nov 21, 2019

Author Collaborator

Works fine, just a bit glitchy (also, first video has incompatible format). Better check Netflix or something.

Снимок экрана 2019-11-21 в 21 18 31

This comment has been minimized.

Copy link
@cattyhouse

cattyhouse Nov 21, 2019

Contributor

Thanks, confirmed to work, there are 3 options. DASH does not work. HLS and Smooth work.

This comment has been minimized.

Copy link
@johnnync13

johnnync13 Nov 21, 2019

any solutions to igpu intel?

This comment has been minimized.

Copy link
@vit9696

vit9696 Nov 21, 2019

Author Collaborator

No, and not planned. You will need to flash and provision Apple ME firmware to get IGPU DRM decoder to work. Currently we have no plans to get involved in this.

This comment has been minimized.

Copy link
@paksman

paksman Nov 22, 2019

I have R9 290X GPU and this helps for Apple TV app to start a tv show but as soon as apple intro and trailers finish the stream stops. I guess i need more recent polaris + AMD GPU for this to work

This comment has been minimized.

Copy link
@vit9696

vit9696 Nov 22, 2019

Author Collaborator

Could you check if replacing Mac-7BA5B2D9E42DDD94 (iMacPro1,1) with Mac-F60DEB81FF30ACF6 with (MacPro6,1) helps anyhow? Here in two places:
https://github.com/acidanthera/WhateverGreen/blob/f928080/WhateverGreen/kern_shiki.cpp#L208
MacPro6,1 has bandwidth limitations in AppleGVA.framework Info.plist, so it might be of some help. Feel free to try other models if you want. It will unlikely help, but is worth trying and reporting.

This comment has been minimized.

Copy link
@paksman

paksman Nov 22, 2019

Thank you very much vit9696, i appreciate your suggestions, will try it tonight and also try to get some logs...

This comment has been minimized.

Copy link
@vit9696

vit9696 Nov 22, 2019

Author Collaborator

Logs will not help here, it will either work or not. Just reporting that it failed is good enough.

This comment has been minimized.

Copy link
@paksman

paksman Nov 22, 2019

Thanks, tried with iMacPro1,1, MacPro6,1 and MacPro7,1, it failed in all three cases.

This comment has been minimized.

Copy link
@andreszerocross

andreszerocross Nov 23, 2019

"Add shikigva=16 argument to boot-args or to DeviceProperties in any GPU."

I can watch AppelTV with with boot-argumen "shikigva=16", but i want to set it in DeviceProperties / DSDT.

i tried to add this
Screen Shot 2019-11-23 at 19 26 58

But, i can't watch appleTV with that,

This comment has been minimized.

Copy link
@andreszerocross

andreszerocross Nov 23, 2019

Forget it,, i change patch in DSDT like below and AppleTV is working.
16 = 10. Sorry
image


#### v1.3.4
- Added support for disabled AppleGraphicsDevicePolicy in AMD drivers on 10.15.1
@@ -126,7 +126,10 @@ To fix it up disable Shiki, reboot, and run `sudo update_dyld_shared_cache -forc
To check that read `/System/Library/PrivateFrameworks/AppleGVA.framework/Info.plist`, if your mac model or board id is present there, then this model does support hardware video decoding acceleration. You are to select a closest configuration to the one you own. For example, iMac13,1 uses an IGPU/discrete GPU combo whereas iMac13,3 only has an IGPU. If you use a model meant to work with a discrete GPU without a graphical card installed VDA will not work and you are likely to get an error from VDADecoderChecker. To correct this either choose an accurate model or edit the `forceOfflineRenderer` property in the Info.plist, it will need to be set to NO.

- _How can I enable Intel online video decoder when AppleGVA enforces offline?_
Add `shikigva=1` argument to boot-args.
Add `shikigva=1` argument to boot-args or to DeviceProperties in any GPU.

- _How can I enable AMD DRM for Music, Safari, TV, leaving IGPU for other applications?_
Add `shikigva=16` argument to boot-args or to DeviceProperties in any GPU.

- _How can I inject IOVARendererID/IOVARendererSubID in certain NVIDIA GPUs?_
NVIDIA drivers do not properly add these values necessary for VDA decoding for Maxwell and Pascal GPUs in their Web drivers. You could add them with a plist-only kext. The correct values for VP4 GPUs are:
@@ -124,7 +124,10 @@ Shiki сейчас часть [WhateverGreen](https://github.com/acidanthera/Wha
Это можно узнать из `/System/Library/PrivateFrameworks/AppleGVA.framework/Info.plist`, если ваша Mac модель или ID платы присутствуют там, то эта модель поддерживает аппаратное декодирование видео. Вы должны выбрать ближайшую к вашей конфигурации ПК. Для примера iMac13,1 использует и IGPU, и дискретную видеокарту в паре, тогда как iMac13,3 имеет только IGPU. Если вы используете Mac модель не имеющую дискретной видеокарты, то VDA не будет работать, и вероятно вы получите ошибку от VDADecoderChecker. Используйте более близкую Mac модель или отредактируйте свойство `forceOfflineRenderer` в Info.plist выставив там значение NO для исправления.

- _Как включить онлайн декодер Intel, когда в AppleGVA указан оффлайн?_
Добавьте `shikigva=1` в аргументы загрузки ядра.
Добавьте `shikigva=1` в аргументы загрузки ядра или как DeviceProperty свойство в любую графическую карту.

- _Как включить DRM декодер AMD для Music, Safari, TV, оставив IGPU декодер для остальных программ?_
Добавьте `shikigva=16` в аргументы загрузки ядра или как DeviceProperty свойство в любую графическую карту.

- _Как можно сделать инжекцию IOVARendererID/IOVARendererSubID в некоторых видеокартах NVIDIA?_
Веб драйвера NVIDIA могут не добавлять эти значения для карт на архитектуре Maxwell и Pascal. Вы можете их добавить в кекст состоящий из одного plist (legacy) сами. Правильными значениями для VP4 графических процессоров являются:
@@ -257,6 +257,26 @@
<key>Segment</key>
<string>TextCstring</string>
</dict>
<dict>
<key>Comment</key>
<string>board-id -&gt; hwdrm-id (normally for iMacPro1,1)</string>
<key>Flags</key>
<string>UserPatcher::BinaryModPatchFlags::LocalOnly</string>
<key>CPU</key>
<string>CPU_TYPE_X86_64</string>
<key>Find</key>
<data>Ym9hcmQtaWQA</data>
<key>Replace</key>
<data>aHdkcm0taWQA</data>
<key>Skip</key>
<integer>0</integer>
<key>Count</key>
<integer>1</integer>
<key>Section</key>
<string>HWDRMID</string>
<key>Segment</key>
<string>TextCstring</string>
</dict>
</array>
</dict>
<dict>
@@ -561,6 +581,52 @@
<key>Flags</key>
<string>PF::MatchSuffix</string>
</dict>
<dict>
<key>Path</key>
<string>/Applications/iTunes.app/Contents/MacOS/iTunes</string>
<key>Section</key>
<string>HWDRMID</string>
<key>Type</key>
<string>Legacy</string>
</dict>
<dict>
<key>Path</key>
<string>/Applications/QuickTime Player.app/Contents/MacOS/QuickTime Player</string>
<key>Section</key>
<string>HWDRMID</string>
<key>ModernPrefix</key>
<string>/System</string>
</dict>
<dict>
<key>Path</key>
<string>/System/Applications/TV.app/Contents/MacOS/TV</string>
<key>Section</key>
<string>HWDRMID</string>
<key>Type</key>
<string>Modern</string>
</dict>
<dict>
<key>Path</key>
<string>/System/Applications/Music.app/Contents/MacOS/Music</string>
<key>Section</key>
<string>HWDRMID</string>
<key>Type</key>
<string>Modern</string>
</dict>
<dict>
<key>Path</key>
<string>/System/Library/Frameworks/WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.xpc/Contents/MacOS/com.apple.WebKit.WebContent</string>
<key>Section</key>
<string>HWDRMID</string>
</dict>
<dict>
<key>Path</key>
<string>/VDADecoderCheckerAMD</string>
<key>Section</key>
<string>HWDRMID</string>
<key>Flags</key>
<string>PF::MatchSuffix</string>
</dict>
</array>
</dict>
</plist>
@@ -44,7 +44,7 @@ void SHIKI::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
return;

if (info->firmwareVendor == DeviceInfo::FirmwareVendor::Apple) {
// DRMI is just fine on Apple hardware
// DRM is just fine on Apple hardware
disableSection(SectionNDRMI);
disableSection(SectionFCPUID);
}
@@ -55,10 +55,10 @@ void SHIKI::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
bool addExecutableWhitelist = false;
bool replaceBoardID = false;
bool unlockFP10Streaming = false;
bool useHwDrmDecoder = false;

cpuGeneration = CPUInfo::getGeneration();


auto getBootArgument = [](DeviceInfo *info, const char *name, void *bootarg, int size) {
if (PE_parse_boot_argn(name, bootarg, size))
return true;
@@ -92,8 +92,12 @@ void SHIKI::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
allowNonBGRA = bootarg & AllowNonBGRA;
forceCompatibleRenderer = bootarg & ForceCompatibleRenderer;
addExecutableWhitelist = bootarg & AddExecutableWhitelist;
useHwDrmDecoder = bootarg & UseHwDrmDecoder;
replaceBoardID = bootarg & ReplaceBoardID;
unlockFP10Streaming = bootarg & UnlockFP10Streaming;

if (useHwDrmDecoder && (replaceBoardID || addExecutableWhitelist))
PANIC("shiki", "Hardware DRM decoder cannot be used with custom board or whitelist");
} else {
// Starting with 10.13.4 Apple has fixed AppleGVA to no longer require patching for compatible renderer.
if ((getKernelVersion() == KernelVersion::HighSierra && getKernelMinorVersion() < 5) ||
@@ -113,9 +117,18 @@ void SHIKI::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
DBGLOG("shiki", "will autodetect autodetect GPU %d whitelist %d", autodetectGFX, addExecutableWhitelist);
}

DBGLOG("shiki", "pre-config: online %d, bgra %d, compat %d, whitelist %d, id %d, stream %d",
DBGLOG("shiki", "pre-config: online %d, bgra %d, compat %d, whitelist %d, id %d, stream %d, hwdrm %d",
forceOnlineRenderer, allowNonBGRA, forceCompatibleRenderer, addExecutableWhitelist, replaceBoardID,
unlockFP10Streaming);
unlockFP10Streaming, useHwDrmDecoder);

if (useHwDrmDecoder) {
// We do not need NDRMI patches for AMD hardware decoder.
disableSection(SectionNDRMI);
disableSection(SectionFCPUID);
} else {
// Otherwise we do not want hardware decoder.
disableSection(SectionHWDRMID);
}

// Disable unused sections
if (!forceOnlineRenderer)
@@ -180,11 +193,17 @@ void SHIKI::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
!disableWhitelist, !disableCompatRenderer, cpuGeneration, hasExternalNVIDIA, hasExternalAMD);
}

if (customBoardID[0]) {
if (customBoardID[0] || useHwDrmDecoder) {
auto entry = IORegistryEntry::fromPath("/", gIODTPlane);
if (entry) {
DBGLOG("shiki", "changing shiki-id to %s", customBoardID);
entry->setProperty("shiki-id", customBoardID, static_cast<uint32_t>(strlen(customBoardID)+1));
if (customBoardID[0]) {
DBGLOG("shiki", "changing shiki-id to %s", customBoardID);
entry->setProperty("shiki-id", customBoardID, static_cast<uint32_t>(strlen(customBoardID)+1));
}
if (useHwDrmDecoder) {
DBGLOG("shiki", "setting hwdrm-id to iMacPro1,1");
entry->setProperty("hwdrm-id", const_cast<char *>("Mac-7BA5B2D9E42DDD94"), static_cast<uint32_t>(sizeof("Mac-7BA5B2D9E42DDD94")));
}
entry->release();
} else {
SYSLOG("shiki", "failed to obtain iodt tree");
@@ -60,8 +60,9 @@ class SHIKI {
// It is enabled automatically on 10.12 and 10.13 if shikigva is *NOT* passed and ForceCompatibleRenderer or
// FixSandyBridgeClassName are automatically enabled.
AddExecutableWhitelist = 8,
// Removed in current version.
DisabledUnused16 = 16,
// Use hardware decoder (normally AMD) by pretending to be iMacPro in apps that require it.
// For example, in Safari for Netflix or in TV.app for TV+.
UseHwDrmDecoder = 16,
// Replace board-id used by AppleGVA and AppleVPA by a different board-id.
// Sometimes it is feasible to use different GPU acceleration settings from the main mac model.
// By default Mac-27ADBB7B4CEE8E61 (iMac14,2) will be used, but you can override this via shiki-id boot-arg.
@@ -72,8 +73,6 @@ class SHIKI {
// similar to the one found in iTunes. Newer streaming services require FairPlay 2.0, which is hardware-only,
// so nothing could be done about them.
UnlockFP10Streaming = 64,
// Removed in current version.
DeprecatedUnused128 = 128
};

/**

0 comments on commit 7d30dd8

Please sign in to comment.
You can’t perform that action at this time.