hieplpvip / Asus-Zenbook-Hackintosh

Run macOS on Asus Zenbook with OpenCore
199 stars 44 forks source link

ASUS Zenbook UX330UAR Screen Flickering #73

Closed andr-dev closed 4 years ago

andr-dev commented 4 years ago

What is your laptop? Asus Zenbook UX330UAR (i5-8250U, Intel HD 620)

Which version of macOS are you using? Mojave (10.14)

Describe the problems I've been looking to hackintosh this laptop for a few months now, I've followed the wiki instructions and everything works great except a bug where the screen flickers every once in a while ... however, after some time, the frequency of the flickers increases and its impossible to use the laptop. I found someone else had a similar issue a year ago: https://www.tonymacx86.com/threads/guide-asus-zenbook-using-clover-uefi-hotpatch.257448/post-1878623

Using RehabMan's "config_HD615_620_630_640_650.plist", there is no flicker and graphics work great however I don't have the FN key or USB hot-patches. I tried using the "ux330_kabylaker.plist" config with "change _DSM to XDSM" disabled and, unlike the guy in the post, there's ACPI errors everywhere and it doesn't boot.

I am currently in the process of "combining" these two config files to have non-flickering graphics (when using config_HD615_620_630_640_650.plist) and all other laptop patches by @hieplpvip at the same time.

I was wondering if anyone else had encountered this issue, and if there is a solution to the problem. I have quite a bit of free time now because I'm staying at home due to quarantine so I'll be working to see if I can find a solution.

Attach output from gen_debug

I'm running Clover on an external USB EFI partition so can't use gen_debug atm, will work on fixing that soon.

Additional context My laptop currently has the latest available BIOS (UX330UAR.310, 4/25/2019).

PaulMagos commented 4 years ago

For the same graphic card, I had this problem only with external monitor, I've managed it by using AAPL, ig-platform-id = 0000C087 and device-id = C0870000

hope I've helped you

andr-dev commented 4 years ago

Update:

After talking with @hieplpvip, I fixed the screen flickering issue on my Asus Zenbook UX330UAR! This issue may not be specific to the UX330UAR and as such the following instructions can be applied to any of the zenbooks. Before I show you how to fix it, here's a technical description of what was happening.

Before I begin, if any of the terminology is incorrect, send me a message and let me know so I can learn :)

As @hieplpvip mentioned, the script used to build the SSDT-UX330-KabyLakeR.aml ACPI patch includes an SSDT-IGPU patch for Intel HD 620 Graphics. In the past, IGPU properties were injected through SSDT's however the new standard is hotpatching the IGPU properties through config.plist (which is why other Intel HD 620 builds use config_HD615_620_630_640_650.plist as their base config). It seems that between the time @hieplpvip made the custom SSDT for the UX330 and now, WhateverGreen.kext has changed a bit and thus the old SSDT patch is incompatible with newer versions of WhateverGreen.kext, which get downloaded automatically with the script. This caused the screen flicker issues.

To fix this, I simply removed the IGPU SSDT from the uncompiled ACPI patch by deleting the line "#include 'include/SSDT-IGPU.dsl' " in "SSDT-UX330-KabyLakeR.dsl", which is the uncompiled .aml. I then rebuilt and patched graphics in the Clover config.plist as usual. This allowed me to hotpatch the graphics using RehabMan's config_HD615_620_630_640_650.plist by "merging" the two config.plists mentioned in the first post. After adding the graphics patches to the config.plist generated, everything worked like a charm.

I'll attach my config.plist to this issue thread if anyone else is having this issue as it is a really simple fix. I do recommend however rebuilding for your own Zenbook hackintosh as it may have more updated versions of the kexts and other important files. Here is a step by step guide to generate the same config as I did.

Step by step guide to fixing incorrect IGPU patch

This guide was written for the UX330UAR however it can be used for any other models experiencing screen-flickering issues. Simply edit the files for your model and use the right laptop base config for your Intel HD card at RehabMan's Laptop Config Repo. (If you're using another config because of your CPU/GPU, keep in mind the code snippets will not be the same).

To remove the SSDT IGPU patch, do the following: (This guide assumes you are following the wiki instructions)

  1. When you get to Step 2: Prepare USB, run the following instead
    cd ~
    git clone https://github.com/hieplpvip/ASUS-ZENBOOK-HACKINTOSH.git zenbook
    cd zenbook
    ./download.sh

    This will download the required kexts without compiling the ACPI (do not run ./make_acpi.sh)

  2. Find the file SSDT-UX330-KabyLakeR.dsl, which is the uncompiled .aml.
  3. Open it and delete the line #include 'include/SSDT-IGPU.dsl
  4. Proceed to run ./make_acpi.sh && ./make_config.sh to finish building the required files.
  5. Find config_UX330-KabyLakeR.plist in build/config
  6. Download RehabMan's config_HD615_620_630_640_650.plist

We will still be using config_UX330-KabyLakeR.plist however we will edit it and add in the necessary parts of config_HD615_620_630_640_650.plist

  1. Open config_UX330-KabyLakeR.plist and go to Devices ->FakeID and delete it
  2. Then, copy FakeID AND Properties fromconfig_HD615_620_630_640_650.plist -> Devices -> FaceID/Properties to your config_UX330-KabyLakeR.plist. This is what you want to copy over:
        <key>FakeID</key>
        <dict>
            <key>IntelGFX</key>
            <string>0x59168086</string>
        </dict>
        <key>Properties</key>
        <dict>
            <key>PciRoot(0)/Pci(0x02,0)</key>
            <dict>
                <key>AAPL,ig-platform-id</key>
                <data>AAAbWQ==</data>
                <key>device-id</key>
                <data>FlkAAA==</data>
                <key>#hda-gfx</key>
                <string>onboard-1</string>
                <key>#AAPL00,override-no-connect</key>
                <data></data>
                <key>#AAPL00,override-no-edid</key>
                <data></data>
                <key># DVMT-prealloc</key>
                <string>32MB BIOS, 19MB framebuffer, 9MB cursor bytes (credit RehabMan)</string>
                <key>framebuffer-patch-enable</key>
                <integer>1</integer>
                <key>framebuffer-stolenmem</key>
                <data>AAAwAQ==</data>
                <key>framebuffer-fbmem</key>
                <data>AACQAA==</data>
                <key>## @0 LVDS-&gt;DP</key>
                <string></string>
                <key>#framebuffer-con0-enable</key>
                <integer>1</integer>
                <key>#framebuffer-con0-type</key>
                <data>AAQAAA==</data>
                <key>## @1 HDMI</key>
                <string></string>
                <key>#framebuffer-con1-enable</key>
                <integer>1</integer>
                <key>#framebuffer-con1-type</key>
                <data>AAgAAA==</data>
                <key>#framebuffer-con1-flags</key>
                <data>hwEAAA==</data>
                <key>#framebuffer-con1-pipe</key>
                <data>EgAAAA==</data>
                <key>## @2 HDMI</key>
                <string></string>
                <key>#framebuffer-con2-enable</key>
                <integer>1</integer>
                <key>#framebuffer-con2-type</key>
                <data>AAgAAA==</data>
                <key>#framebuffer-con2-flags</key>
                <data>hwEAAA==</data>
                <key>#framebuffer-con2-pipe</key>
                <data>EgAAAA==</data>
                <key>## @3 HDMI</key>
                <string></string>
                <key>#framebuffer-con3-enable</key>
                <integer>1</integer>
                <key>#framebuffer-con3-type</key>
                <data>AAgAAA==</data>
                <key>#framebuffer-con3-flags</key>
                <data>hwEAAA==</data>
                <key>#framebuffer-con3-pipe</key>
                <data>EgAAAA==</data>
                <key>#1 0306-&gt;0105</key>
                <string>0x591b0000, 0105 instead of 0306, HDMI</string>
                <key>#1 framebuffer-con1-enable</key>
                <integer>1</integer>
                <key>#1 framebuffer-con1-alldata</key>
                <data>AQUKAAAIAACHAQAAAgQKAAAIAACHAQAA/wAAAAEAAAAgAAAA</data>
                <key>#2 0204-&gt;0105</key>
                <string>0x591b0000, 0105 instead of 0204, HDMI</string>
                <key>#2 framebuffer-con1-enable</key>
                <integer>1</integer>
                <key>#2 framebuffer-con1-alldata</key>
                <data>AQUKAAAIAACHAQAAAwYKAAAEAACHAQAA/wAAAAEAAAAgAAAA</data>
                <key>#3 no external</key>
                <string>0x591b0000, eliminate all external ports (0204 and 0306)</string>
                <key>#3 framebuffer-con1-enable</key>
                <integer>1</integer>
                <key>#3 framebuffer-con1-alldata</key>
                <data>/wAAAAEAAAAgAAAA/wAAAAEAAAAgAAAA/wAAAAEAAAAgAAAA</data>
            </dict>
            <key>PciRoot(0)/Pci(0x1f,3)</key>
            <dict>
                <key>#layout-id</key>
                <integer>3</integer>
                <key>#PinConfigurations</key>
                <data></data>
                <key>#hda-gfx</key>
                <string>onboard-1</string>
                <key>#no-controller-patch</key>
                <integer>1</integer>
            </dict>
        </dict>
  3. Find the Graphics section in config_UX330-KabyLakeR.plist and replace it with the one in config_HD615_620_630_640_650.plist. It should look like this:
    <key>Graphics</key>
    <dict>
        <key>#EDID</key>
        <dict>
            <key>Inject</key>
            <false/>
        </dict>
        <key>#ig-platform-id</key>
        <string>0x591b0000</string>
        <key>Inject</key>
        <dict>
            <key>ATI</key>
            <true/>
            <key>Intel</key>
            <false/>
            <key>NVidia</key>
            <true/>
        </dict>
    </dict>
  4. Make sure the SMBIOS ProductName property is set to MacBookPro14,1 and you have a valid SmUUID, SerialNumber and BoardSerialNumber
  5. Follow the remaining steps on the wiki).

If you have any questions, post them in this thread and I'll try my best to help you out. I will look to see if I can edit the .sh script files to make this automatic for the UX330UAR build (and any other models having the same issue).

Here is my config.plist (in a zip) without the SMBIOS properties. I highly recommend using it only as a reference to edit your own generated config.plist but if you're lazy I guess you can take it and add in the SMBIOS properties. No promises though :)

andr-dev commented 4 years ago

I posted my Clover EFI setup on my Github if anyone wants to take a look, hope it helps: https://github.com/andr-dev/ASUS-UX330UAR-Hackintosh