Activate AMD hardware acceleration

Discussion in 'Mac Pro' started by h9826790, May 3, 2019.

  1. h9826790, May 3, 2019
    Last edited: Jun 23, 2019 at 11:11 AM

    h9826790 macrumors G5

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
    #1
    10.14.5 is now official. And I can confirm that AMD card users (Polaris or above) can enjoy H264 hardware encode / H264 hardware decode / and HEVC hardware decode.
    Screenshot 2019-05-14 at 8.56.15 AM.png

    The procedure is as follow: (please read through the entire Q&A section BEFORE you do anything. You should know how to recover, or may need to use alternate procedure, etc)

    1) Keep SIP disabled

    2) Download Lilu.kext version 1.3.5

    3) Download WhateverGreen.kext version 1.2.8

    4) open Lilu.kext

    5) enter Contents

    6) create folder "Plugins" (N.B. This folder is INSIDE Contents, please do NOT miss step 5)
    Screenshot 2019-05-14 at 2.12.59 PM.png

    7) Copy the WhateverGreen.kext into Plugins

    8) Copy the whole modded Lilu kext to /Library⁩/Extensions/

    9) Open terminal

    10) Enter
    Code:
    sudo chmod -R 755 /Library/Extensions/Lilu.kext
    11) Enter
    Code:
    sudo chown -R root:wheel /Library/Extensions/Lilu.kext
    12) Enter
    Code:
    sudo touch /Library/Extensions
    13) Enter
    Code:
    sudo kextcache -update-volume /
    (you may get some strange return with this command, don't worry about it)

    14) Enter
    Code:
    sudo nvram boot-args="shikigva=96 shiki-id=Mac-7BA5B2D9E42DDD94"
    15) Reboot

    Q: Is this safe?
    A: Tested since 10.14.5 beta 4, so far, no system damaged by this mod.

    Q: Is there any down side?
    A: Yes, iTunes / Netflix DRM streaming may not work, but fully download DRM movie should not be affected.
    (iTunes and Netflix still works on my cMP with the RX580. The exact condition to make it work is unknown at this moment. But seems Chromium base browsers are OK. e.g. Chrome, Brave, Edge, etc)

    Q: Any other known issue?
    A: Photos app crash if HDMIAudio.kext is also installed. Besides, few more users reported system freeze. It seems only Polaris GPU is affected e.g. RX580. So far, all freeze only occur in Apple apps. e.g. FCPX, Photos, Compressor, etc. 3rd party apps such as PP, DV, VideoProc are not affected. However, Polaris GPU hwaccel seems perfectly stable in 10.13.6 beta by hex editing the AppleGVA file. Beside, Adobe Media Encoder seems will cause the video engine stall. Not system freeze / crash, but the video engine simply like stop working, perform extremely bad. Normal performance can only recover by reboot.

    Q: If my system crash after the mod, how to fix it?
    A: NVRAM reset will remove the boot argument, and disable the kexts. So, will effective revert your system back to the original state. Once your system boot again, you can remove the kext.

    Q: What's the benefit?
    A: Able to play some very demanding HEVC video (e.g. this one)
    https://4kmedia.org/sony-swordsmith-hdr-uhd-4k-demo/

    This is how my cMP can play this video now. Smooth playback with very low CPU usage (please use a browser that support VP9 to watch all the following Youtube videos in 4k, otherwise, you may not able to read the details)


    Able to edit raw H264 directly smoothly, no need to transcode to ProRes anymore, greatly reduce the storage speed and capacity requirement. Most likely can improve productivity as well


    Able to edit raw HEVC directly smoothly, no need to transcode to ProRes anymore, greatly reduce the storage speed and capacity requirement. Most likely can improve productivity as well


    Can greatly improve H264 export speed with low CPU usage (depends on your CPU / GPU spec)


    Able to record the screen at 4k smoothly. As you can see from the above link. My cMP now can do those stuff and still record the screen smoothly at the same time.

    Able to play VP9 video smoothly. My cMP now can play 8K youtube video with zero frame drop. (VP9 only partially supported in UVD, therefore, CPU usage still very high, this is normal)
    8K Youtube.jpg

    Q: Can this work in 10.14.4 or before?
    A: NO (Update 1: One user reported that latest 10.13.6 with Vega also work with this mod.)

    Q: Can this work for Nvidia GPU?
    A: NO

    Q: Can this work for flashed 7950 etc?
    A: I don't know. Please test it for me. (Update: The answer is NO, thanks bazza5938 to perform the test)

    Q: Which software can benefit from this mod?
    A: This will provide hardware acceleration at system level. So far, all my tested software works (e.g. FCPX, iMovie, Handbrake, Compressor, VideoProc, DVDFab, DV, AE, PP, FFMpeg, QuickTime Player, VLC, IINA......)

    Q: If I do a NVRAM reset due to other reason, how to regain these functions?
    A: Repeat step 14 and reboot

    Q: What's the recommendation GPU?
    A: RX560, RX580, Vega 56, Vega 64, Vega FE. (Update: for this particular purpose, Vega is definitely better than Polaris card. There is zero crash / freeze report from Vega users yet).

    Q: Why not recommend the Radeon VII or RX570, etc.
    A: AFAIK, they all work, I just not sure how mature the overall support is (as a GPU).

    Q: Is this QuickSync?
    A: NO, QuickSync is the hardware acceleration for Intel iGPU, not the generic term for GPU video hardware acceleration. AMD GPU use UVD (Unified Video Decoder) for decoding, and VCE (Video Coding Engine) for encoding. All this will be controlled by VideoToolBox automatically in macOS, virtually transparent to users. It's the same concept as QuickSync, but not QuickSync.

    Q: I can see that my GPU is working in Compressor before this mod (on a cMP). Is that mean I already have hardware acceleration?
    A: NO, we are talking about H264 hardware acceleration here. Not the general compute hardware acceleration. They are completely different.

    Q: How's the quality of the hardware encoded video?
    A: Not as good as software encoder in general. But if at high bitrate, the difference isn't noticeable.

    Q: When will we able to get HEVC encoding as well?
    A: I don't know. But you can always boot to Windows and use HEVC hardware encode.

    Q: How much improvement can I expect?
    A: Well, depends on usage. But a quick iMovie 4K H264 export test shows a Vega 64 can reduce the export time from 6:19 to 1:25, which means reduced the export time by ~77% (on a dual X5680 cMP).

    Q: Why VideoProc shows no HEVC decode after the mod?
    A: I don't know why, but this is normal in this case. My recommendation is to download demo HEVC video from the above link, and play it via QuickTime (or simply via Finder preview). As long as the CPU usage only stay around 20% (but not 800%), that means HEVC decoding is working properly.

    Q: Should I install the newer version of Lilu and WhateverGreen?
    A: NO. Despite the newer version can work, but provide no extra function in this case, and I have no idea if the newer one has poorer stability. If I found a better way / kext to use. I will update the post accordingly.

    Q: I experienced system freeze, Console log shows "GPU Restart" event, what should I do?
    A: PRAM reset will bring your system back to normal. If you are with Polaris GPU (RX560, RX570, RX580, etc), it seems some people are affected by this bug. What I found is an alternate method by directly hex edit the AppleGVA file seems more stable for these GPUs. Initial test shows very safe to do so, even I completely destroy the AppleGVA file, the OS can still boot to desktop. If you prefer to go this route, please make sure you know how to restore the file (or even completely recover from an unbootable OS). The info is at post #205.

    Q: How do I know if hardware acceleration is really working?
    A: My suggestion is by using Terminal. Detail info in post #273.
     
  2. SkipperRi macrumors regular

    SkipperRi

    Joined:
    Jul 11, 2015
    Location:
    Rijeka, Croatia
    #2
    Hey, this is great news! I have one question about first screenshot. How did you get that information, in which software?
     
  3. octoviaa macrumors member

    Joined:
    Oct 19, 2013
    #3
    Confirm the fix work with RX570 and 10.14.5 final.
    I do need to run 'Kext Util' though (just run and let it do its own stuff e.g. fixing permission, etc).
    After 'Kext Util' finish doing its own stuff, then I reboot and h.264 acceleration is enabled.
     
  4. h9826790 thread starter macrumors G5

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
    #4
  5. SkipperRi macrumors regular

    SkipperRi

    Joined:
    Jul 11, 2015
    Location:
    Rijeka, Croatia
  6. bookemdano macrumors 65816

    Joined:
    Jul 29, 2011
    #6
    Thanks for the work you spent on this tutorial h9826790. I had never heard of WhateverGreen before (and Shiki before it). Here is the Github if anyone else is interested: https://github.com/acidanthera/WhateverGreen

    Do you know what Apple changed with 10.14.5 that allows this to work?
     
  7. bazza5938 macrumors newbie

    bazza5938

    Joined:
    Nov 25, 2018
    Location:
    United Kingdom
    #7
    Thanks for posting this here, I must try it with my 7950 just to see if I can get any hardware encode/decode out of it before updating to 10.14.5 final, since I know the rx580 works beautifully
     
  8. csd, May 14, 2019
    Last edited: May 14, 2019

    csd macrumors newbie

    Joined:
    Sep 3, 2017
    Location:
    Ireland
    #8
    ** I fixed this by clearing NVRAM and starting from scratch again **
    ** Leaving this below in case anyone has similar issues with boot-args **

    Folks,

    I've tried this but seem to be failing at the boot-args stage. I can set the boot-args fine (nvram -p shows they're there), but then when I reboot the entry has disappeared completely and I've no acceleration. SIP is disabled.

    $ sudo nvram boot-args="shikigva=96 shiki-id=Mac-7BA5B2D9E42DDD94"
    $ nvram -p | grep args
    boot-args shikigva=96 shiki-id=Mac-7BA5B2D9E42DDD94

    Then when I reboot:

    $ nvram -p | grep args
    $

    Here's the full list of my currently set nvram settings:

    $ nvram -p
    boot-gamma -L%00%00j%05%00%0022YM%1a%00%00%00%00%00%00%00%00%00%00%00%00%00
    bluetoothInternalControllerInfo %15%82%ac%05%00%00%11Z%04%0c%ce%ed%d6%ea
    bluetoothActiveControllerInfo %15%82%ac%05%00%00%00%00%11Z%04%0c%ce%ed%d6%ea
    SystemAudioVolumeDB %fa
    SystemAudioVolume :
    csr-active-config w%00%00%00
    EFIBluetoothDelay %b8%0b
    efi-backup-boot-device-data-data %02%01%0c%00%d0A%03%0a%00%00%00%00%01%01%06%00%02%1f%03%12%0a%00%02%00%00%00%00%00%04%01*%00%02%00%00%00(@%06%00%00%00%00%00%e0%1f2:%00%00%00%00%12|P%83%b0%9d/F%9ck6?%ce;fS%02%02%04%03$%00%f7%fct%be|%0b%f3I%91G%01%f4%04.hB%0f%ea%94%0bT%93%c8J%8c%a0w%e9%b1%17%bd%8e%04%04%9a%00\%00E%005%008%00B%005%00A%00D%009%00-%00F%009%007%00F%00-%003%00E%003%003%00-%00A%00B%008%008%00-%00D%00B%00F%001%001%00D%004%00B%002%009%00C%00E%00\%00S%00y%00s%00t%00e%00m%00\%00L%00i%00b%00r%00a%00r%00y%00\%00C%00o%00r%00e%00S%00e%00r%00v%00i%00c%00e%00s%00\%00b%00o%00o%00t%00.%00e%00f%00i%00%00%00%7f%ff%04%00

    SIP showing disabled:
    $ csrutil status
    System Integrity Protection status: disabled.

    System Information is showing LiLu and WhateverGreen are loaded, but I guess they're not working because the correct parameters haven't been passed to them at boot.

    Any ideas?

    Thanks,

    Colin
     
  9. lukethemore macrumors newbie

    lukethemore

    Joined:
    May 14, 2019
    Location:
    Milano (Italy)
    #9
    sorry for my question that can be stupid ... but ...


    why Apple doesn't turn on these "features" by default ?


    everytime is the same story: disable some feature, overwrite kext, reboot ... and so on ... why ???
     
  10. IndioX macrumors regular

    IndioX

    Joined:
    Oct 1, 2018
    Location:
    austria/europe
    #11
  11. h9826790 thread starter macrumors G5

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
  12. csd macrumors newbie

    Joined:
    Sep 3, 2017
    Location:
    Ireland
    #13
    Just a follow-up after some testing.

    1. Playback of HEVC 4K60 went from stuttering to perfectly smooth. Even the 120 Mbps HEVC Jellyfish file plays perfectly.
    2. There's now a 50% improvement in Handbrake transcoding when I select the VideoToolbox H.264 encoder instead the x264 encoder (25 fps vs 16 fps in converting the 120 Mbps jellyfish 4K file to a 6 Mbps 1080p file). VideoToolbox doesn't seem to be using HyperThreading, only 6 threads show busy in Activity Monitor; x264 uses all 12 threads on my system. But even with no HT, VideoToolbox is still 50% faster with the native GPU acceleration!
    /csd
     
  13. thomasthegps macrumors regular

    Joined:
    Sep 23, 2015
    Location:
    France
    #14
    I wonder how editing performance in fcx with this patch compares to newer macs.
    --- Post Merged, May 15, 2019 ---
    The answer is pretty simple: money
     
  14. h9826790, May 15, 2019
    Last edited: May 15, 2019

    h9826790 thread starter macrumors G5

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
    #15
    2. I am quite sure handbrake only use the GPU to encode, but not decode.

    e.g. When I ask FFMpeg to use GPU for BOTH decoding and encoding. The CPU loading is very very low.
    GPU HEVC to H264.png

    However, if I only ask FFMpeg to use GPU to encode, but leave the decoding part for CPU. Then the CPU will hit 1000% loading (similar to Handbrake).
    CPU HEVC to H264.png

    And as you can see. When we transcoding HEVC to H264. If the source video is too demanding for the CPU. The GPU transcoding performance will be holding back by the CPU. In my above test, using pure GPU transcoding is about 10% faster. So, your computer will end up use more power, but work slower.

    However, if the CPU is fast enough to handle the source video, then using CPU to decode, and use GPU to encode usually will have better result.

    Anyway, using more CPU not necessary means better now.
     
  15. IndioX macrumors regular

    IndioX

    Joined:
    Oct 1, 2018
    Location:
    austria/europe
    #16
    AMD hardware acceleration works also in high sierra 10.13.6
    with security update 2019-003 and bootROM 144.0.0.0.0 !?!


    Screen-Shot-2019-05-15-at-19.31.35.jpg
     
  16. Hendrik94 macrumors regular

    Hendrik94

    Joined:
    Oct 17, 2014
    Location:
    Germany
  17. tsialex macrumors 601

    tsialex

    Joined:
    Jun 13, 2016
    Location:
    Brazil
    #18
    iMac Pro has hardware acceleration with High Sierra, so it's not a surprise.
     
  18. IndioX macrumors regular

    IndioX

    Joined:
    Oct 1, 2018
    Location:
    austria/europe
    #19
    but so far it was said that it should only work from 10.14.5 on
     
  19. tsialex macrumors 601

    tsialex

    Joined:
    Jun 13, 2016
    Location:
    Brazil
    #20
    10.14.5 brought support for eGPU RX-580, iMac had encoding support for VEGA GPUs since not long after release, if my memory still works.
     
  20. IndioX macrumors regular

    IndioX

    Joined:
    Oct 1, 2018
    Location:
    austria/europe
    #21
    would mean that the RX580 does not work under 10.13.6

    I'll watch that when I have time
     
  21. tsialex macrumors 601

    tsialex

    Joined:
    Jun 13, 2016
    Location:
    Brazil
    #22
    Some one should test it and confirm if hardware encode works for RX-580 faking iMac Pro.

    VEGA is not a surprise, already works with iMac Pro and High Sierra.
     
  22. h9826790 thread starter macrumors G5

    h9826790

    Joined:
    Apr 3, 2014
    Location:
    Hong Kong
    #23
    Interesting, with this mod? Or native?
     
  23. IndioX macrumors regular

    IndioX

    Joined:
    Oct 1, 2018
    Location:
    austria/europe
    #24
    with mode, test on my vega64
    but I don't know if this works with the RX580 as well
    hope to get to test it soon
     
  24. VaZ, May 15, 2019
    Last edited: May 15, 2019

    VaZ macrumors member

    VaZ

    Joined:
    Aug 31, 2012
    #25
    What app is that Hardware Info ?
    So all Polaris and higher cards are the RX cards correct?

    WOW my VLC uses 400% CPU to play that. Horrible Indeed. If so time to replace my Tahiti 7970
     

Share This Page

280 May 3, 2019