AMD-OSX / bugtracker

AMD OS X Bugtracker
13 stars 2 forks source link

Sidecar not working on iGPU-less systems reliably #1

Closed khronokernel closed 2 years ago

khronokernel commented 4 years ago

Description:

On macOS 10.15.1 and higher Sidecar is not stable on iGPU-less systems

Failed to bootstrap path: path = /usr/libexec/SidecarDisplayAgent, error = 108:

Notes:

Info that can help:

Genuine iMac Pro system dump running macOS Catalina 10.15.2 or newer(To verify if VCPSideCar device is present). Note retail demo models will not have this device

macOS Catalina 10.15 beta 10 and GM installer (19A578c and 19A582a). Mainly to compare Sidecar files(But full installers would be appreciated if possible):

We have a couple dumps already:

Errors reported after Sidecar fails, to see if there other spots failing:

DarwinDumps of Hackintoshes that have working sidecar without iGPUs(Intel and AMD are fine, helps to find a pattern):

sarkrui commented 4 years ago

A male from pcbeta.com reported that disabling the T2 chip on his genuine MacPro7,1 didn't make a difference to Sidecar and FCPX HW acceleration.

khronokernel commented 4 years ago

@sarkrui Can you please elaborate on how you "disable" a T2 exactly? The T2 isn't just a simple accelerator chip, instead taking over a majority of the chipset like SMBus and such and is still required for binary decryption during boot-up. If you're referring to the rendering pipeline, I'd still like further explanation on how that's happening. As far as I know the dGPU in the MacPro7,1 is always doing the rendering, and T2 only being used for bootstrap verification for Sidecar

sarkrui commented 4 years ago

It's been some days but there are follow-up replies from pcbeta forum. I assume he simply disabled T2 by opting No security for security boot and Allow booting from external media as he mentioned he disabled the chip and was able to install macOS on external SSD (shouldn't remove the original Apple drive). I've also pleased him to share his IOReg report with a disabled T2 chip. image

khronokernel commented 4 years ago

Ahhh as I thought, I actually started playing around with Sidecar again and actually got a somewhat working patch. Still looking into a better fix hopefully with a lilu plugin but atm this seems to work:

I tested this configuration a long time back with no success(10.15.2 iirc), but tried it again with 10.15.5 beta 3 and works decently. Lot of UI compression but a good start, this was on a 5700XT as well so might try with a Vega 56 when I get some time

sarkrui commented 4 years ago

In case other folks wonder how the value of shikigva was calculated, here's the instruction.

For example, to enable ForceOnlineRenderer, ExecutableWhitelist, and ReplaceBoardID. You sum 1 + 8 + 32 = 41 -> and pass shikigva=41.

ForceOnlineRenderer = 1,
AllowNonBGRA = 2,
ForceCompatibleRenderer = 4,
AddExecutableWhitelist = 8,
DisabledUnused16 = 16,
ReplaceBoardID = 32,
UnlockFP10Streaming = 64,
DeprecatedUnused128 = 128
junologue commented 4 years ago

Ahhh as I thought, I actually started playing around with Sidecar again and actually got a somewhat working patch. Still looking into a better fix hopefully with a lilu plugin but atm this seems to work:

  • iMac19,1 SMBIOS
  • shiki-id=Mac-27AD2F918AE68F61 shikigva=40 in boot-args

I tested this configuration a long time back with no success(10.15.2 iirc), but tried it again with 10.15.5 beta 3 and works decently. Lot of UI compression but a good start, this was on a 5700XT as well so might try with a Vega 56 when I get some time

This is really good news, did you managed to get this working on 10.15.4 as well? and also, is it just on iMac19,1? I really enjoy being on MacPro7,1 but maybe i'll never see sidecar for this SM...

sarkrui commented 4 years ago

From this post Comparison of Thunderbolt 3 performance on Hackintosh and MacPro7,1.

Rendering Master H264

MacPro7,1 takes 3'30'', 5700XT Hackintosh takes 2'28. Below the post, there's a reply saying that the T2 is useful for realtime rendering while it does nothing to encoding. Perhaps that's why in Sidecar, you experienced a lot of UI compression as there's no T2 acceleration.

lightingghost commented 4 years ago

Sidecar is not working for me, iPad shows a "Connecting" and then keeps showing black screen, but seems I can move the cursor into iPad. Airdrop/continuity works fine with the same iPad.

macOS 10.15.4 Hardware: Asrock C422 WSI/IMPI, Xeon W-2140b, Gigabyte Vega 56

I am using a iMacPro1,1 SMBIOS, and also tried shikigva=40 with shiki-id=Mac-7BA5B2D9E42DDD94, both did not work.

error log from system.log

Jul 11 23:47:47 odins-iMac-Pro xpcproxy[1273]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:47:47 odins-iMac-Pro xpcproxy[1274]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:47:53 odins-iMac-Pro com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.pid.SidecarDisplayAgent.1261): Failed to bootstrap path: path = /usr/libexec/SidecarDisplayAgent, error = 108: Invalid path
Jul 11 23:47:55 odins-iMac-Pro xpcproxy[1280]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:01 odins-iMac-Pro xpcproxy[1282]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:01 odins-iMac-Pro xpcproxy[1284]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:01 odins-iMac-Pro xpcproxy[1285]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:01 odins-iMac-Pro xpcproxy[1288]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:09 odins-iMac-Pro xpcproxy[1290]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:09 odins-iMac-Pro xpcproxy[1292]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:09 odins-iMac-Pro xpcproxy[1293]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:09 odins-iMac-Pro xpcproxy[1294]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:12 odins-iMac-Pro xpcproxy[1297]: libcoreservices: _dirhelper_userdir: 557: bootstrap_look_up returned (ipc/send) invalid destination port
Jul 11 23:48:19 odins-iMac-Pro MobileDeviceUpdater[1238]: Entered:_AMMuxedDeviceDisconnected, mux-device:4
Jul 11 23:48:19 odins-iMac-Pro AMPDeviceDiscoveryAgent[326]: Entered:_AMMuxedDeviceDisconnected, mux-device:4
Jul 11 23:48:19 odins-iMac-Pro MobileDeviceUpdater[1238]: Entered:__thr_AMMuxedDeviceDisconnected, mux-device:4
Jul 11 23:48:19 odins-iMac-Pro AMPDeviceDiscoveryAgent[326]: Entered:__thr_AMMuxedDeviceDisconnected, mux-device:4
Jul 11 23:48:19 odins-iMac-Pro MobileDeviceUpdater[1238]: tid:c10b - Mux ID not found in mapping dictionary
Jul 11 23:48:19 odins-iMac-Pro MobileDeviceUpdater[1238]: tid:c10b - Can't handle disconnect with invalid ecid
Jul 11 23:48:19 odins-iMac-Pro AMPDeviceDiscoveryAgent[326]: tid:9037 - Mux ID not found in mapping dictionary
Jul 11 23:48:19 odins-iMac-Pro AMPDeviceDiscoveryAgent[326]: tid:9037 - Can't handle disconnect with invalid ecid

other error logs that might be related

log show --predicate '(logType="error"||logType="fault")&&process="SidecarDisplayAgent"' --last 15m
Filtering the log data using "(logType == 16 OR logType == 17) AND process == "SidecarDisplayAgent""
Skipping info and debug messages, pass --info and/or --debug to include.
Timestamp                       Thread     Type        Activity             PID    TTL  
2020-07-11 23:48:01.673004-0700 0x5ff5     Error       0x0                  1261   0    SidecarDisplayAgent: [com.apple.sidecar:display] AVC[37da383c] RTCP Timeout
2020-07-11 23:48:01.674272-0700 0x52ab     Error       0x0                  1261   0    SidecarDisplayAgent: [com.apple.sidecar:display] === Sidecar Error SidecarErrorDomain (-401) === <private>
2020-07-11 23:48:01.753113-0700 0x6101     Error       0x0                  1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00006) does not exist
2020-07-11 23:48:01.753167-0700 0x6101     Error       0x0                  1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00006) does not exist
2020-07-11 23:48:09.841366-0700 0x6101     Error       0x0                  1261   0    SidecarDisplayAgent: [com.apple.sidecar:display] AVC[37da383d] RTCP Timeout
2020-07-11 23:48:09.841698-0700 0x52ab     Error       0x0                  1261   0    SidecarDisplayAgent: [com.apple.sidecar:display] === Sidecar Error SidecarErrorDomain (-401) === <private>
2020-07-11 23:48:09.918088-0700 0x6101     Error       0x0                  1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00007) does not exist
2020-07-11 23:48:09.918170-0700 0x6101     Error       0x0                  1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00007) does not exist
2020-07-11 23:48:12.594025-0700 0x6100     Error       0x8d2d               1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00008) does not exist
2020-07-11 23:48:12.594144-0700 0x6100     Error       0x8d2d               1261   0    SidecarDisplayAgent: (IOKit) [com.apple.iohid:default] HIDVS (id:7fb7075186a00008) does not exist
--------------------------------------------------------------------------------------------------------------------
Log      - Default:          0, Info:                0, Debug:             0, Error:         10, Fault:          0
Activity - Create:           0, Transition:          0, Actions:           0
cgrazy commented 3 years ago

Fun fact on an iMacPro1,1 AMD hack w/o iGPU that sidecar screen can be seen when connecting to the system via teamviewer for example. Then both screens can be selected.

tarbaII commented 2 years ago

For any new people to this thread, the "solution" is to use an iMac19,x or iMac20,x SMBIOS, install the FeatureUnlock kext, and run the command for Sidecar in the FeatureUnlock README. This is not recommended since iMac SMBIOSes expect an Intel iGPU, which AMD processors don't have. And although Sidecar works after doing this, the image quality is awful.

GreyAsteroid commented 2 years ago

Here's the fix for sidecar running on dGPUs looking awful,

defaults write com.apple.sidecar.display MinBitrate -int 2147483647 defaults write com.apple.sidecar.display MaxBitrate -int 2147483647

EDIT: After looking into the actual values more you probably want to just set both of those to the maximum int value (2147483647). Regardless of bandwidth this will just make sidecar use as much as it needs both via USB and Wi-Fi.

The reason why sidecar looks awful for some is that it's using the AVC encoder instead of the HEVC one. This means that the target bitrate of 37.517 mbps is obviously gonna look a lot worse. Unfortunately we cannot change the target bitrate however we can change the Min/Max.

~~defaults write com.apple.sidecar.display MinBitrate -int 1250000000 defaults write com.apple.sidecar.display MaxBitrate -int 1250000000~~

I guess by default it sets MinBitrate to 20000000 and MaxBitrate to 40000000, here I've set it to the maximum bitrate supported by USB 3.1 gen 2 (what I have my ipad plugged into, as well as the maximum the ipad itself supports).

These are fairly finicky though, it'll accept ungodly high values that will work well but some more realistic values will sometimes just revert to default. Low values like 159 aren't too bad but once you go to 160 it's a blurry mess until some point? where it becomes good again.

GreyAsteroid commented 2 years ago

After a bit, I've adjusted my values to 250000000. It seems to be visually lossless for my use case and it seems to have helped with some lingering instability in my setup. I should also mention that I'm using defaults write com.apple.sidecar.display LowLatency -bool True, which actually makes a fairly sizeable difference in latency.

tarbaII commented 2 years ago

@GreyAsteroid This is a great find, just had someone else try it out and it made Sidecar actually usable for them. I'll add this info to the AMD OS X FAQ.

GreyAsteroid commented 2 years ago

Another thing I'd like to share is defaults write com.apple.VideoProcessing BridgeEncode -bool false. Setting this to true on my iMac18,3 gives me "Remote encode requested on mac w/o bridge co-processor; ignoring" in my console. So I would assume that setting it to false on MacPro7,1 or iMacPro1,1 would make it fall back to GPU encoding instead of failing because of the nonexistent T2. This is however only a guess that I haven't been able to get someone to test yet.

tarbaII commented 2 years ago

Shaneee tried it and said it works pretty well. I wasn't able to get someone to bite on trying the command you just suggested, but I think this can be closed anyway. Thanks!

belgio99 commented 2 years ago

Actually, just tried BridgeEncode on i5-9400F, RX 580 and iMacPro1,1, but it still doesn't work. Tried applying defaults both on my user and sudo, and rebooting afterwards. (It's stuck on the black screen just as before). On the logs, avconferenced reports "no bridgeOS device available", both with BridgeEncode true and false, so I don't know if it still doesn't work, or if I'm missing something here.

GreyAsteroid commented 2 years ago

Actually, just tried BridgeEncode on i5-9400F, RX 580 and iMacPro1,1, but it still doesn't work. Tried applying defaults both on my user and sudo, and rebooting afterwards. (It's stuck on the black screen just as before). On the logs, avconferenced reports "no bridgeOS device available", both with BridgeEncode true and false, so I don't know if it still doesn't work, or if I'm missing something here.

Damn, you could try pairing that command with defaults write com.apple.AppleGVA gvaForceAMDKE -bool true but I don't have high hopes.

Thanks for testing it for me though!

belgio99 commented 2 years ago

No worries! Tried with gvaForceAMDKE, same thing unfortunately. Actually, I even pasted all the commands (LowLatency, MinBitrate, MaxBitrate) from this thread, but unfortunately nothing changes. I took a screenshot from the console app while searching for "videoprocessing", but let me know if there's something I should look up for, or some other command I could try!

Schermata 2022-07-08 alle 22 50 02

GreyAsteroid commented 2 years ago

Alright, I'm not purposefully looking for methods to enable Sidecar on MacPro7,1/iMacPro1,1 but while looking into hardware acceleration I keep bumping into things that could work.

  1. The T2 encoder has an IOProbeScore of 1000; same as iGPUs on iMacs. You could try using a dummy kext to adjust the IOProbeScore of the GPU (0) to be higher than the T2 encoder; i.e. 1001.
  2. The T2 encoder has a property called IOAVEHEVCEncode. This is set to 1 by default. You could try using a dummy kext to change this to 0.

EDIT: Now that I think about it, the T2 device wouldn't show up for Hackintoshes so these might not do much for hacks.

I'm fairly happy with my setup right now so I don't have much else to look for. I, unfortunately, stumbled upon something interesting that might actually enable HEVC encoding for me but unless it works I don't have much more to say in this closed thread.

syakiba commented 11 months ago

啊,正如我所想,我实际上又开始玩 Sidecar 并且实际上得到了一个_可以_工作的补丁。仍在寻找更好的修复方法,希望使用 lilu 插件,但 atm 这似乎有效:

  • iMac19,1 SMBIOS
  • shiki-id=Mac-27AD2F918AE68F61 shikigva=40在启动参数中

我很久以前就测试过这个配置,但没有成功(10.15.2 iirc),但在 10.15.5 beta 3 上再次尝试,效果很好。很多 UI 压缩,但一个好的开始,这也是在 5700XT 上进行的,所以当我有时间时可能会尝试使用 Vega 56

I spent three days searching online for almost every possible solution regarding the sidecar issue, and I meticulously tested each one. In the end, I was surprised to find that this particular solution worked. However, I decided to continue testing. So, I deleted shiki-id=Mac-27AD2F918AE68F61 and restarted my system, and to my surprise, Sidecar continued to work correctly. At this point, I gave up; I just couldn't figure out Sidecar, even though I had suspected that it might require an Intel CPU, regardless of whether it has an iGPU.

AMD5700X 6950XT iMac20,1