acidanthera / bugtracker

Acidanthera Bugtracker
385 stars 45 forks source link

WhateverGreen's DP to HDMI patch has no effect on IceLake platforms. #1616

Closed kingo132 closed 3 years ago

kingo132 commented 3 years ago

I'm using the latest version of WhateverGreen, the version number is 1.4.9.

You can find the information of my device and EFI here: https://github.com/kingo132/GPD-Win-Max-Hackintosh

This is my device configuration image

And this is the boot log of WhateverGreen

identified disk2 as removableidentified disk2s1 as removableWhateverGreen       weg: @ (DBG) non-apple-fw proceeding with devprops 32772
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) IGPU has real 8A52 acpi 8A5C fake 0000 and model Intel Iris Plus Graphics
WhateverGreen       weg: @ (DBG) user requested to fake with normal device-id
WhateverGreen       weg: @ (DBG) hooked configRead read methods!
WhateverGreen       weg: @ (DBG) found existing built-in
WhateverGreen     iokit: @ (DBG) getOSData applbkl was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-patch-enable has 1 value
WhateverGreen      igfx: @ (DBG) framebuffer-patch-enable 1
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-framebufferid was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-flags was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-camellia was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-mobile was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-pipecount was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-portcount was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-memorycount was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-stolenmem has 1300000 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-fbmem was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-unifiedmem was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-cursormem was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-enable has 1 value
WhateverGreen      igfx: @ (DBG) framebuffer-con0-enable 1
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-index was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-busid has 0 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-pipe has 0 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-type has 2 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-flags has 18 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-enable has 1 value
WhateverGreen      igfx: @ (DBG) framebuffer-con1-enable 1
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-index was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-busid has 9 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-pipe has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-type has 800 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-flags has 2C1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-enable has 1 value
WhateverGreen      igfx: @ (DBG) framebuffer-con2-enable 1
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-index was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-busid has A value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-pipe has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-type has 800 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-flags has 2C1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con3-enable was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con4-enable was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con5-enable was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-patch0-enable was not found
WhateverGreen      igfx: @ (DBG) DVMT: GMS value is supported by the driver. The fix has been disabled.
WhateverGreen      igfx: @ (DBG) DVMT: GMS value is 0x04; DVMT pre-allocated memory is 128 MB.
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-has-lspcon has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con0-preferred-lspcon-mode was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-has-lspcon has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con1-preferred-lspcon-mode has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-has-lspcon has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con2-preferred-lspcon-mode has 1 value
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con3-has-lspcon was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con3-preferred-lspcon-mode was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con4-has-lspcon was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con4-preferred-lspcon-mode was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con5-has-lspcon was not found
WhateverGreen     iokit: @ (DBG) getOSData framebuffer-con5-preferred-lspcon-mode was not found
WhateverGreen     iokit: @ (DBG) getOSData rps-control was not found
WhateverGreen     iokit: @ (DBG) getOSData complete-modeset was not found
WhateverGreen     iokit: @ (DBG) getOSData complete-modeset-framebuffers was not found
WhateverGreen     iokit: @ (DBG) getOSData force-online was not found
WhateverGreen     iokit: @ (DBG) getOSData igfxpavp was not found
WhateverGreen      igfx: @ (DBG) FCA: Enabled = 0.
WhateverGreen      igfx: @ (DBG) RRS: Enabled = 1.
WhateverGreen      igfx: @ (DBG) RWS: Enabled = 0.
WhateverGreen     shiki: @ (DBG) will autodetect autodetect GPU 0 whitelist 0
WhateverGreen     shiki: @ (DBG) pre-config: online 0, bgra 0, compat 0, whitelist 0, id 0, stream 0, hwdrm 0 swdrm 0
WhateverGreen       weg: @ (DBG) vinfo 1: 1280:800 32:3200:1
WhateverGreen       weg: @ (DBG) vinfo 2:  80:100 3200:1:0
WhateverGreen      igfx: @ (DBG) CDC: Functions have been routed successfully.
WhateverGreen      igfx: @ HDC: Failed to route the function.
WhateverGreen      igfx: @ SC: Failed to route functions.
WhateverGreen      igfx: @ I2C: Failed to route functions.
WhateverGreen      igfx: @ FCM: Failed to route the function hwRegsNeedUpdate.
WhateverGreen      igfx: @ BSF: Failed to route the function ComputeLaneCount.
WhateverGreen      igfx: @ (DBG) platform is snb 0 and list 0xFFFFFF7FA454F0D0
WhateverGreen       weg: @ (DBG) applying backlight patch
WhateverGreen       weg: @ (DBG) configRead32 IGPU 0x00001000 at off 0x00, result = 0x8A528086
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) configRead32 reported 0x8a5c8086 instead of 0x8a528086
WhateverGreen       weg: @ (DBG) configRead32 IGPU 0x00001000 at off 0x02, result = 0x8A528086
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) configRead32 reported 0x8a5c8086 instead of 0x8a528086
WhateverGreen       weg: @ (DBG) configRead32 IGPU 0x00001000 at off 0x00, result = 0x8A528086
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) configRead32 reported 0x8a5c8086 instead of 0x8a528086
WhateverGreen      igfx: @ (DBG) patching framebufferId 0x8A5C0001
WhateverGreen      igfx: @ (DBG) mobile: 0x00000001
WhateverGreen      igfx: @ (DBG) pipeCount: 3
WhateverGreen      igfx: @ (DBG) portCount: 3
WhateverGreen      igfx: @ (DBG) fbMemoryCount: 3
WhateverGreen      igfx: @ (DBG) stolenMemorySize: 0x01300000
WhateverGreen      igfx: @ (DBG) framebufferMemorySize: 0x00000000
WhateverGreen      igfx: @ (DBG) unifiedMemorySize: 0x60000000
WhateverGreen      igfx: @ (DBG) patching framebufferId 0x8A5C0001 connector [0] busId: 0x00, pipe: 0, type: 0x00000002, flags: 0x00000018
WhateverGreen      igfx: @ (DBG) patching framebufferId 0x8A5C0001 connector [2] busId: 0x09, pipe: 1, type: 0x00000800, flags: 0x000002C1
WhateverGreen      igfx: @ (DBG) patching framebufferId 0x8A5C0001 connector [3] busId: 0x0A, pipe: 1, type: 0x00000800, flags: 0x000002C1
WhateverGreen      igfx: @ (DBG) patching framebufferId 0x8A5C0001 successful
WhateverGreen      igfx: @ (DBG) CDC: ProbeCDClockFrequency() DInfo: Called with controller at 0xffffff8044f2e000.
WhateverGreen      igfx: @ CDC: ProbeCDClockFrequency() DInfo: The current core display clock frequency is 172.8 MHz.
WhateverGreen      igfx: @ (DBG) CDC: ProbeCDClockFrequency() DInfo: The currrent core display clock frequency is not supported.
WhateverGreen      igfx: @ (DBG) CDC: sanitizeCDClockFrequency() DInfo: Reference frequency is 38.4 MHz.
WhateverGreen      igfx: @ CDC: sanitizeCDClockFrequency() DInfo: Core Display Clock frequency will be set to 652.8 MHz.
WhateverGreen      igfx: @ (DBG) CDC: sanitizeCDClockFrequency() DInfo: Core Display Clock PLL frequency will be set to 1305600000 Hz.
WhateverGreen      igfx: @ (DBG) CDC: sanitizeCDClockFrequency() DInfo: Core Display Clock PLL has been disabled.
WhateverGreen      igfx: @ (DBG) CDC: sanitizeCDClockFrequency() DInfo: Core Display Clock has been reprogrammed and PLL has been re-enabled.
WhateverGreen      igfx: @ CDC: sanitizeCDClockFrequency() DInfo: Core Display Clock frequency is 652.8 MHz now.
WhateverGreen      igfx: @ (DBG) CDC: ProbeCDClockFrequency() DInfo: The core display clock has been switched to a supported frequency.
WhateverGreen      igfx: @ (DBG) CDC: ProbeCDClockFrequency() DInfo: Will invoke the original function.
WhateverGreen      igfx: @ (DBG) CDC: ProbeCDClockFrequency() DInfo: The original function returns 0x4dd1e000.
WhateverGreen       weg: @ (DBG) configRead16 IGPU 0x00001000 at off 0x02, result = 0x8a52
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) configRead16 IGPU reported 0x8a5c instead of 0x8a52
WhateverGreen       weg: @ (DBG) configRead32 IGPU 0x00001000 at off 0x00, result = 0x8A528086
WhateverGreen     iokit: @ (DBG) getOSData device-id has 8A5C value
WhateverGreen       weg: @ (DBG) configRead32 reported 0x8a5c8086 instead of 0x8a528086
WhateverGreen       weg: @ (DBG) panel display set returned 1

From the log, you can see it has successfully done the DP to HDMI patch. But the connector type of my external display is still DP (00 04 00 00). Shouldn't it be HDMI (00 08 00 00)?

image

And here is my full ioreg: mywm.ioreg.zip

kingo132 commented 3 years ago

I read some code of WEG today. WEG does have the IceLake HDMI patch code.

image

From the code, I can see the patch is done by modifying the value of the AppleIntelICLLPGraphicsFramebuffer.kext (in the memory, maybe).

image

The offset of these values is found by search the platform id in AppleIntelICLLPGraphicsFramebuffer.kext.

image (1)

As you can see, it has a start address to begin searching. And this start address is found by a global variable called "_gPlatformInformationList".

image (2)

I can find this _gPlatformInformationList variable in AppleIntelICLLPGraphicsFramebuffer.kext. Which do have many framebuffer configuration values.

image (3)

While patching, it just static_casted the memory he finds to a struct called "FramebufferICLLP".

image (4)

The definition of this structure can indeed reflect the value in AppleIntelICLLPGraphicsFramebuffer.kext accordingly.

QQ20210425-150440@2x

The above is the current process of how WEG is patching connector type to HDMI. In order to verify whether WEG modified the interface type correctly, I did a small test.

I managed to find the offset of the connector configuration data of my platform id 0x8A5C0001 in AppleIntelICLLPGraphicsFramebuffer.text. Here is what I found.

QQ20210425-121542-2x

I just replaced the connector type in this binary image from 00040000 to 00080000. And I putted it back into /System/Library/Extensions/AppleIntelICLLPGraphicsFramebuffer.kext/Contents/MacOS/ and then rebuilt the kext cache.

After reboot, I found the modified binary has taken effect, WEG read the connector type 00080000.

But the connector type of my external display is still 00 04 00 00. So I can draw some conclusion that maybe the way WEG is trying to patch the HDMI connector type of IceLake devices does not affect the final connector type. There may be other places of the apple driver that need to be modified too.

stevezhengshiqi commented 3 years ago

@kingo132 Please check ICL framebuffers in IGPU Chart. Apple has dropped HDMI connecter type support in ICL platform, so there’s no reason to add dp->hdmi feature for ICL platform.

kingo132 commented 3 years ago

@kingo132 Please check ICL framebuffers in IGPU Chart. Apple has dropped HDMI connecter type support in ICL platform, so there’s no reason to add dp->hdmi feature for ICL platform.

Thanks stevezhenshiqi, I know about this, I'm not going to get HDMI working, I'm trying to get my Displayport audio working. As the FAQ of WEG says, it need to change the connector type to HDMI to get the Display port audio working.

stevezhengshiqi commented 3 years ago

I would say it’s more like an AppleHDA issue which needs to be pathced on your model, like what https://github.com/acidanthera/AppleALC/blob/master/Resources/Controllers.plist#L793 does.

vit9696 commented 3 years ago

As explained above it is not an issue. If you have issues with AppleALC HDMI patches, provide new ones that resolve things for you. This is oss.

kingo132 commented 3 years ago

I would say it’s more like an AppleHDA issue which needs to be pathced on your model, like what https://github.com/acidanthera/AppleALC/blob/master/Resources/Controllers.plist#L793 does.

As explained above it is not an issue. If you have issues with AppleALC HDMI patches, provide new ones that resolve things for you. This is oss.

Thanks bros. The initial reason I'm researching this is that I can't output any audio to my external display. No matter using any type-c, type-c to DP, or type-c to HDMI cable.

First I'm trying from AppleALC. I tested all the layout-id of AppleALC and also I tried to dump the audio codec from ubuntu. Both no success. Also, I tried to change many device ids in the device property, still no success.

By the way, AppleALC does have a patch for IceLake, I tried to modify it but also no success.

https://github.com/acidanthera/bugtracker/issues/1283#issuecomment-824802110

After all of this, I'm trying to find a solution in WEG. I'm wondering if it is because WEG not patching the connector type correctly. Here is what the FAQ of WEG says.

image

So if this quote is correct, then the connector type of my external display is still DP (00 04 00 00), but not HDMI (00 08 00 00). The HDMI patch of WEG has no effect.

Also, I searched nearly all the IceLake Hackintoshes in Github. All of them are laptops. You can find them here.

None of them can output any audio to the external display. So I'm wondering this may not be a specific problem related only to my device.

vit9696 commented 3 years ago

I do not believe this applies to Ice Lake. Ice Lake is quite different from the previous generations, and a lot of code in it was community-contributed.

kingo132 commented 3 years ago

I do not believe this applies to Ice Lake. Ice Lake is quite different from the previous generations, and a lot of code in it was community-contributed.

Thank you for this information. If IceLake platform is so different, then another new patch may be needed to get the external display audio to work. I shall continue to analyze AppleALC, AppleIntelICLLPGraphicsFramebuffer, or any other related kexts to find this new patch.

vit9696 commented 3 years ago

Most likely it is to be supported by AppleHDAGFX driver, which AppleALC turns off as it cannot coexist with AppleHDA to our experience. You could try experimenting with it.

kingo132 commented 3 years ago

Most likely it is to be supported by AppleHDAGFX driver, which AppleALC turns off as it cannot coexist with AppleHDA to our experience. You could try experimenting with it.

OK, thanks, and do you mean AppleGFXHDA instead of AppleHDAGFX ? I can only find this name in my Catalina version.

jason@my299 Extensions % ls *HDA* 
AppleGFXHDA.kext:
Contents

AppleHDA.kext:
Contents

And by the way, I tried another VoodooHDA for opencore, which is called VoodooHDA-OC. It seems recently come out.

https://github.com/chris1111/VoodooHDA-OC

This one also can not output audio to the external display.

vit9696 commented 3 years ago

Yes, made a mistake in the name. VoodooHDA has never supported any recent digital audio. VoodooHDA-OC is nothing else but a normal VoodooHDA just more accurately compiled for an older macOS.

kingo132 commented 3 years ago

Yes, made a mistake in the name. VoodooHDA has never supported any recent digital audio. VoodooHDA-OC is nothing else but a normal VoodooHDA just more accurately compiled for an older macOS.

I see. Thank you!

m0d16l14n1 commented 3 years ago

Most likely it is to be supported by AppleHDAGFX driver, which AppleALC turns off as it cannot coexist with AppleHDA to our experience. You could try experimenting with it.

Hello @vit9696! I was able to load AppleGFXHDA8086_9D71Controller, with that one DP audio is working properly, but no analog output (speakers, headphones). But Type-C to HDMI now can output external sound.

I just did remove some unload AppleGFXHDA stuff from AppleALC and that's worked. AppleHDA is not loading (only AppleGFXHDA and AppleHDAController). Is there any chance to get them (maybe force?) to work both together?

Here is the IOreg

P.S. > or maybe there is a chance to fix that panic in AppleHDA to use it for both digital and analog sound? https://github.com/acidanthera/bugtracker/issues/1283#issue-742282212

HDEFwithAPPLEGFHXDA.ioreg.zip