Jump to content

Tracing back the AMD GPU wakeup issue to its origin


Mieze
368 posts in this topic

Recommended Posts

awesome work.

Would this work for an RX 580 in an Egpu?

Yes, it should work with the Polaris GPUs too.

 

PS: It would be helpful if someone with a Polaris GPU could send me a dump of the GPU's PCI config space created with lspci (or RW-everything under Windows, etc.) so that I can verify the Base Address Register layout.

 

Mieze

  • Like 1
Link to comment
Share on other sites

Yes, it should work with the Polaris GPUs too.

 

PS: It would be helpful if someone with a Polaris GPU could send me a dump of the GPU's PCI config space created with lspci (or RW-everything under Windows, etc.) so that I can verify the Base Address Register layout.

 

Mieze

Hello Mieze!

Good work you began!

This dump contains lspci dump and more for Polaris GPU   #35  

 

We have three issues with Radeon drivers in HackOS

1. Bad GPU registers initialisation. Hope you resolved this.

2. Bad connectors in PC Videocard compared to Apple's framebuffer. If we set Inject=NO then Apple's driver calculates connectors by itself. But not enough for multimonitors.

3. Bad AMDRadeonX4000GLDriver.bundle (not for Hack). It can't be patched by Clover because it is loaded from user space. I may propose to create better bundle with name like AMDRadeonX4001GLDriver.bundle and patch the name somewhere it used.

  • Like 5
Link to comment
Share on other sites

Great work, Mieze

Thank you for sharing your findings

The patch works perfectly on Sapphire Radeon RX580 Nitro+!!

I don't even need to disable IGPU in BIOS, disabling CSM and setting the IGPU as a primary display is enough

The 4K screen is connected to the  Radeon card and I can boot with all debug messages shown on the screen+ Apple Logo  :hysterical:

I can go to sleep - and wake up. 

:thumbsup_anim:

  • Like 2
Link to comment
Share on other sites

Yes, it should work with the Polaris GPUs too.

 

PS: It would be helpful if someone with a Polaris GPU could send me a dump of the GPU's PCI config space created with lspci (or RW-everything under Windows, etc.) so that I can verify the Base Address Register layout.

 

Mieze

Tell me how you do it and I can dump it for you on my MP5,1 with RX 480

Hope this helps

DarwinDumper_3.0.3_21.10_21.46.29_MacPro5,1_Apple_X64_Unknown_17A405_henrybrock.zip

  • Like 1
Link to comment
Share on other sites

Tell me how you do it and I can dump it for you on my MP5,1 with RX 480

Hope this helps

Hello Pavo,

 

thank you for your friendly offer and the link but Slice already posted a link to this dump a few days ago.

 

Mieze

Link to comment
Share on other sites

I make little and cosmetic modification of your patch to add correct name, apply correct framebuffer and load custom rom. 

 

For rx 580

Device (GFX1)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    OperationRegion (PCIB, PCI_Config, Zero, 0x0100)
                    Field (PCIB, AnyAcc, NoLock, Preserve)
                    {
                        Offset (0x10), 
                        BAR0,   32, 
                        BAR1,   32, 
                        BAR2,   64, 
                        BAR4,   32, 
                        BAR5,   32
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        Store (Package (0x1C)
                            {
                                "AAPL,slot-name", 
                                Buffer (0x07)
                                {
                                    "Slot-4"
                                }, 

                                "@0,name", 
                                Buffer (0x0C)
                                {
                                    "ATY,Orinoco"
                                }, 

                                "@1,name", 
                                Buffer (0x0C)
                                {
                                    "ATY,Orinoco"
                                }, 

                                "@2,name", 
                                Buffer (0x0C)
                                {
                                    "ATY,Orinoco"
                                }, 

                                "@3,name", 
                                Buffer (0x0C)
                                {
                                    "ATY,Orinoco"
                                }, 

                                "@4,name", 
                                Buffer (0x0C)
                                {
                                    "ATY,Orinoco"
                                }, 

                                "ATY,Card#", 
                                Buffer (0x0C)
                                {
                                    "113-4E3531U"
                                }, 

                                "ATY,Copyright", 
                                Buffer (0x33)
                                {
                                    "(C) 1988-2017, AMD Technologies Inc."
                                }, 

                                "ATY,Rom#", 
                                Buffer (0x1D)
                                {
                                    "GV-RX580GAMING-8GD/F10/058AE"
                                }, 

                                "ATY,VendorID", 
                                Buffer (0x02)
                                {
                                     0x02, 0x10                                     
                                }, 

                                "ATY,DeviceID", 
                                Buffer (0x02)
                                {
                                     0xDF, 0x67                                     
                                }, 

                                "device_type", 
                                Buffer (0x12)
                                {
                                    "ATY,OrinocoParent"
                                }, 

                                "model", 
                                Buffer (0x13)
                                {
                                    "RX 580 G1 GIGABYTE"
                                }, 

                                "hda-gfx", 
                                Buffer (0x0A)
                                {
                                    "onboard-1"
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Method (_INI, 0, NotSerialized)  // _INI: Initialize
                    {
                        If (LEqual (BAR5, Zero))
                        {
                            Store (BAR2, Local0)
                        }
                        Else
                        {
                            Store (BAR5, Local0)
                        }

                        OperationRegion (GREG, SystemMemory, And (Local0, 0xFFFFFFFFFFFFFFF0), 0x8000)
                        Field (GREG, AnyAcc, NoLock, Preserve)
                        {
                            Offset (0x6800), 
                            GENA,   32, 
                            GCTL,   32, 
                            LTBC,   32, 
                            Offset (0x6810), 
                            PSBL,   32, 
                            SSBL,   32, 
                            PTCH,   32, 
                            PSBH,   32, 
                            SSBH,   32, 
                            Offset (0x6848), 
                            FCTL,   32, 
                            Offset (0x6EF8), 
                            MUMD,   32
                        }

                        Store (Zero, FCTL)
                        Store (Zero, PSBH)
                        Store (Zero, SSBH)
                        Store (Zero, LTBC)
                        Store (One, GENA)
                        Store (Zero, MUMD)
                    }
                }

                Device (HDAU)
                {
                    Name (_ADR, One)  // _ADR: Address
                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        Store (Package (0x02)
                            {
                                "hda-gfx", 
                                Buffer (0x0A)
                                {
                                    "onboard-1"
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }
                }

for r9 290x

Device (GFX2)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    OperationRegion (PCIB, PCI_Config, Zero, 0x0100)
                    Field (PCIB, AnyAcc, NoLock, Preserve)
                    {
                        Offset (0x10), 
                        BAR0,   32, 
                        BAR1,   32, 
                        BAR2,   64, 
                        BAR4,   32, 
                        BAR5,   32
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        Store (Package (0x1A)
                            {
                                "AAPL,slot-name", 
                                Buffer (0x07)
                                {
                                    "Slot-1"
                                }, 

                                "@0,name", 
                                Buffer (0x0B)
                                {
                                    "ATY,Baladi"
                                }, 

                                "@1,name", 
                                Buffer (0x0B)
                                {
                                    "ATY,Baladi"
                                }, 

                                "@2,name", 
                                Buffer (0x0B)
                                {
                                    "ATY,Baladi"
                                }, 

                                "@3,name", 
                                Buffer (0x0B)
                                {
                                    "ATY,Baladi"
                                }, 

                                "ATY,Card#", 
                                Buffer (0x11)
                                {
                                    "113-C6710101-100"
                                }, 

                                "ATY,Copyright", 
                                Buffer (0x25)
                                {
                                    "(C) 1988-2017, AMD Technologies Inc."
                                }, 

                                "ATY,Rom#", 
                                Buffer (0x36)
                                {
                                    "C67101 HAWAII XT A0 GDDR5 4GB 64MX32 STILT MLU +37.5M"
                                }, 

                                "ATY,VendorID", 
                                Buffer (0x02)
                                {
                                     0x02, 0x10                                     
                                }, 

                                "ATY,DeviceID", 
                                Buffer (0x02)
                                {
                                     0xB0, 0x67                                     
                                }, 

                                "device_type", 
                                Buffer (0x11)
                                {
                                    "ATY,BaladiParent"
                                }, 

                                "model", 
                                Buffer (0x14)
                                {
                                    "R9 290X Asus MATRIX"
                                }, 

                                "hda-gfx", 
                                Buffer (0x0A)
                                {
                                    "onboard-1"
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Method (_INI, 0, NotSerialized)  // _INI: Initialize
                    {
                        If (LEqual (BAR5, Zero))
                        {
                            Store (BAR2, Local0)
                        }
                        Else
                        {
                            Store (BAR5, Local0)
                        }

                        OperationRegion (GREG, SystemMemory, And (Local0, 0xFFFFFFFFFFFFFFF0), 0x8000)
                        Field (GREG, AnyAcc, NoLock, Preserve)
                        {
                            Offset (0x6800), 
                            GENA,   32, 
                            GCTL,   32, 
                            LTBC,   32, 
                            Offset (0x6810), 
                            PSBL,   32, 
                            SSBL,   32, 
                            PTCH,   32, 
                            PSBH,   32, 
                            SSBH,   32, 
                            Offset (0x6848), 
                            FCTL,   32, 
                            Offset (0x6EF8), 
                            MUMD,   32
                        }

                        Store (Zero, FCTL)
                        Store (Zero, PSBH)
                        Store (Zero, SSBH)
                        Store (Zero, LTBC)
                        Store (One, GENA)
                        Store (Zero, MUMD)
                    }
                }

                Device (HDAU)
                {
                    Name (_ADR, One)  // _ADR: Address
                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        Store (Package (0x02)
                            {
                                "hda-gfx", 
                                Buffer (0x0A)
                                {
                                    "onboard-1"
                                }
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }
                }

post-916820-0-24004600-1508706389_thumb.png

post-916820-0-42508500-1508706414_thumb.png post-916820-0-13936000-1508706431_thumb.png

post-916820-0-29941900-1508706475_thumb.png

  • Like 5
Link to comment
Share on other sites

I make little and cosmetic modification of your patch to add correct name, apply correct framebuffer and load custom rom. 

 

Yes, iIt can be done this way but it's also possible to let Clover inject these properties. In the end, both methods lead to the same result. Nevertheless, thank you!

 

Mieze

Link to comment
Share on other sites

Yes, iIt can be done this way but it's also possible to let Clover inject these properties. In the end, both methods lead to the same result. Nevertheless, thank you!

 

Mieze

True, but clover can not load two defriend framebuffer selected by me.  

Link to comment
Share on other sites

Just want to confirm, that Miezes patch from first post is working on my config as well. IGPU and CSM completely disabled in BIOS.

just have to make some "preperations" to make a tripple-monitor-setup working and some cosmetic changes as well,

as already Matthew82 has documented.

 

So now, i no longer nee LILU and WhatEverGreen kexts.

Thanx for another incredible work. Love it. Makes my Hackintosh so much easier.

  • Like 2
Link to comment
Share on other sites

Really great, I'm working with two GPU r9 270x and r9 270, on an AMD fx platform, with InjectAti and Framebuffer Futomaki in Clover, and with LILU and WhatEverGreen in kexts 10.12/10.13

 

 

I do not have a selection for IGPU,

but only enable CSM and legacy Vbios,\and inserted inject Ati and Fbuffer into Clover

Mac Pro di carlo.zip

Schermata 2017-10-23 alle 00.19.21.png

Schermata 2017-10-23 alle 00.19.28.png

Schermata 2017-10-23 alle 00.19.28.png

Link to comment
Share on other sites

@Mieze

 

Thanks a lot for this great solution.

 

Does this method work on Legacy BIOS as well or it only applies to UEFI? 

 

I have an old GA-EP45-DS3R and a Sapphire 7790 GPU which was working with WheteverGreen and Lilu, but ever since macOS High Sierra it's not working anymore. I get the black screen.

 

Thanks again

Link to comment
Share on other sites

Confirmed working without Whatevergreen.kext on Sapphire Nitro+ RX 580 4GB, High Sierra (10.13). Used SSDT aml provided by slice in clover patched folder. With clover injection System information looks better (shows as RX 480). Without clover injection still works and shows as AMD R9 XXX. Might need some cosmetic DSDT patch to show correct information. Sleep works. I have:

 

1. CSM Disabled

2. IGPU enabled

3. Primary Display PEG

4. ig-platform-id for HD 630 as 0x59120003 for quicksync

5. Lilu.kext and IntelGraphicsFixup.kext for quicksync

 

Everything works fine including hardware decoding by HD 630. SMBIOS used iMac18,3

  • Like 1
Link to comment
Share on other sites

with the patch, on Sapphire nitro+ RX 580 I can get the machine to work on single monitor, however, dual monitor is still not working. dual monitor didn't work with whatevergreen.kext too. Dual monitor works on 10.12.6 but second monitor fails to get signal in 10.13. 

(both monitor connected to DP ports, where ports are DP,DP,HDMI,HDMI, DDVI, both monitor are 4k monitor). 

 

I know some of us have same or similar card and working dual monitor setup. It would be of great help if anyone can give me directions to get my setup working. 

 

Thanks.

Link to comment
Share on other sites

×
×
  • Create New...