Contribute
Register

Razer Blade 15 - High Sierra 10.13.6 - Success(-)

Status
Not open for further replies.
Joined
Nov 27, 2012
Messages
49
Motherboard
Razer Blade 15
CPU
i7 8750H
Graphics
UHD 630, 1070 GTX, 144hz 1080p display.
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
Ok, by changing (in SSDT-PNLF);
// add 4 bytes
Offset(0xc8254),

and hardcoding;
// max pwm
LEVW = 0x1D4C0
// somewhat lower pwm
LEVX = 0x0A000

You can clearly see that it is possible to change the brightness. And it loads up with w/o a black screen.
I guess LEVW can stay hardcoded to max pwm, but somehow we need to tie LEVX to whatever is at 0xAB0C8258.

I'm not much of an asm guru, so lulz. Something like
^LEVX = 0xAB0C8258 // this doesn't work btw.

This driver could be cleaned up a lot to serve just one purpose for the razer blade 15. (or any coffee lake uhd 630). Also, from what I see the maxpwm is tied directly to which panel is loaded up from applebacklightinjector, which seems strange. Basically, I would suggest splitting out two values, one for max pwm and one for the actual panel you want to use. I just default to Name(_UID, 0x10).

This probably overflows (bit shifts) also; ^LEVX & 0xFFFF since we are dealing with values > 0xFFFF.

A question I have is what decides to show the brightness controls on the display? The selected panel? Or the fact that LEVX is mapped to a memory address?
 
Last edited:

RehabMan

Moderator
Joined
May 2, 2012
Messages
184,100
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
  1. MacBook Air
Mobile Phone
  1. iOS
Ok, by changing (in SSDT-PNLF);
// add 4 bytes
Offset(0xc8254),

and hardcoding;
// max pwm
LEVW = 0x1D4C0
// somewhat lower pwm
LEVX = 0x0A000

You can clearly see that it is possible to change the brightness. And it loads up with w/o a black screen.
I guess LEVW can stay hardcoded to max pwm, but somehow we need to tie LEVX to whatever is at 0xAB0C8258.

I'm not much of an asm guru, so lulz. Something like
^LEVX = 0xAB0C8258 // this doesn't work btw.

This driver could be cleaned up a lot to serve just one purpose for the razer blade 15. (or any coffee lake uhd 630). Also, from what I see the maxpwm is tied directly to which panel is loaded up from applebacklightinjector, which seems strange. Basically, I would suggest splitting out two values, one for max pwm and one for the actual panel you want to use. I just default to Name(_UID, 0x10).

This probably overflows (bit shifts) also; ^LEVX & 0xFFFF since we are dealing with values > 0xFFFF.

A question I have is what decides to show the brightness controls on the display? The selected panel? Or the fact that LEVX is mapped to a memory address?

You never attached any PR files.

Note that _INI actions are configurable via SSDT-RMCF.aml.

Primarily, you must insure that the LMAX matches what Apple is using for PWMMax in the framebuffer.
 
Joined
Nov 27, 2012
Messages
49
Motherboard
Razer Blade 15
CPU
i7 8750H
Graphics
UHD 630, 1070 GTX, 144hz 1080p display.
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
I think I figured it out. To get backlight to turn on there is a framebuffer change done in clover. If you look at the display it thinks it's running on an external monitor. If you remove this framebuffer change, the backlight doesn't come on, but the display show that it's running on the internal monitor and the brightness slider works.

So, just download this third party app which allows you to change brightness on an external monitor:
https://itunes.apple.com/us/app/brightness-slider/id456624497?mt=12

And it works.

This is obviously a hack, but hey, it's a hackintosh.
 
Joined
Sep 2, 2013
Messages
87
Motherboard
Lenovo Thinkpad X1 Yoga 20FQ
CPU
i7-6600U
Graphics
HD 520
Mac
  1. MacBook Pro
  2. Mac mini
Mobile Phone
  1. Android
  2. iOS
I think I figured it out. To get backlight to turn on there is a framebuffer change done in clover. If you look at the display it thinks it's running on an external monitor. If you remove this framebuffer change, the backlight doesn't come on, but the display show that it's running on the internal monitor and the brightness slider works.

So, just download this third party app which allows you to change brightness on an external monitor:
https://itunes.apple.com/us/app/brightness-slider/id456624497?mt=12

And it works.

This is obviously a hack, but hey, it's a hackintosh.

This is most certainly not native brightness tho
 
Joined
Nov 27, 2012
Messages
49
Motherboard
Razer Blade 15
CPU
i7 8750H
Graphics
UHD 630, 1070 GTX, 144hz 1080p display.
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
This is most certainly not native brightness tho

Were you able to get full brightness with that app? If not, you might need the pnlf I created.
 
Joined
Sep 2, 2013
Messages
87
Motherboard
Lenovo Thinkpad X1 Yoga 20FQ
CPU
i7-6600U
Graphics
HD 520
Mac
  1. MacBook Pro
  2. Mac mini
Mobile Phone
  1. Android
  2. iOS
With your changes to PNLF the brightness changes during boot (which is better than a black screen, good job!!), however, I'm not getting a slider when spoofing KBL. I tried a while ago to not spoof KBL and I did get a slider, however, as you stated, the brightness was too low and only started working after a few minutes.

Now I'm trying to get it working without using KBL spoofing with your PNLF edits, however, I'm getting stuck on Apple logo, empty progress bar and mouse. (also tried without SSDT-PNLF and backlight injector)

@blodtanner could you please share your clover?
 

Attachments

  • razer.ioreg.zip
    776.9 KB · Views: 43
  • CLOVER.zip
    5.1 MB · Views: 55
Joined
Nov 27, 2012
Messages
49
Motherboard
Razer Blade 15
CPU
i7 8750H
Graphics
UHD 630, 1070 GTX, 144hz 1080p display.
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
With your changes to PNLF the brightness changes during boot (which is better than a black screen, good job!!), however, I'm not getting a slider when spoofing KBL. I tried a while ago to not spoof KBL and I did get a slider, however, as you stated, the brightness was too low and only started working after a few minutes.

Now I'm trying to get it working without using KBL spoofing with your PNLF edits, however, I'm getting stuck on Apple logo, empty progress bar and mouse. (also tried without SSDT-PNLF and backlight injector)

@blodtanner could you please share your clover?

My clover is exactly like yours. The issue I had was with 17G2112. I rolled back.
The problem is the framebuffer changes (where the display ports are switched) as far as I can tell. If you look at your display in About this mac -> Displays mine shows that I'm using a 30.5 display. There are no easy way in Mac (as far as I can tell) to adjust the brightness of external displays. That's why that app works, it allows for adjustment of brightness for all displays.

Code:
// Adding PNLF device for IntelBacklight.kext or AppleBacklight.kext+AppleBacklightInjector.kext

#define SANDYIVY_PWMMAX 0x710
#define HASWELL_PWMMAX 0xad9
#define SKYLAKE_PWMMAX 0x56c
#define CUSTOM_PWMMAX_07a1 0x07a1
#define CUSTOM_PWMMAX_1499 0x1499

#ifndef NO_DEFINITIONBLOCK
DefinitionBlock("", "SSDT", 2, "hack", "_PNLF", 0)
{
#endif
    External(RMCF.BKLT, IntObj)
    External(RMCF.LMAX, IntObj)
    External(RMCF.LEVW, IntObj)
    External(RMCF.GRAN, IntObj)
    External(RMCF.FBTP, IntObj)

    External(_SB.PCI0.IGPU, DeviceObj)
    Scope(_SB.PCI0.IGPU)
    {
        OperationRegion(RMP3, PCI_Config, 0, 0x14)
    }

    // For backlight control
    Device(_SB.PCI0.IGPU.PNLF)
    {
        Name(_ADR, Zero)
        Name(_HID, EisaId ("APP0002"))
        Name(_CID, "backlight")
        Name(_UID, 0)
        Name(_STA, 0x0B)

        Field(^RMP3, AnyAcc, NoLock, Preserve)
        {
            Offset(0x02), GDID,16,
            Offset(0x10), BAR1,32,
        }
        OperationRegion(RMB1, SystemMemory, BAR1 & ~0xF, 0xe1184)
        Field(RMB1, AnyAcc, Lock, Preserve)
        {
            Offset(0x48250),
            LEV2, 32,
            LEVL, 32,
            Offset(0x70040),
            P0BL, 32,
            Offset(0xc2000),
            GRAN, 32,
            Offset(0xc8254),
            LEVW, 32,
            LEVX, 32,
            Offset(0xe1180),
            PCHL, 32,
        }

        Method(_INI)
        {
            // IntelBacklight.kext takes care of this at load time...
            // If RMCF.BKLT does not exist, it is assumed you want to use AppleBacklight.kext...
            Local4 = 1
            If (CondRefOf(\RMCF.BKLT)) { Local4 = \RMCF.BKLT }
            If (0 == (1 & Local4)) { Return }

            // Adjustment required when using AppleBacklight.kext
            Local0 = ^GDID
            Local2 = Ones
            If (CondRefOf(\RMCF.LMAX)) { Local2 = \RMCF.LMAX }
            // Determine framebuffer type (for PWM register layout)

               
             Local2 = 0x1D4C0
               
             LEVW = 0x1D4C0
             LEVX = 0x1D4C0
            _UID = 16              
           
        }
    }
#ifndef NO_DEFINITIONBLOCK
}
#endif
//EOF

This code is pretty terrible, and it only works for this laptop, and it can be simplified a lot. Like all the local stuff doesn't do anything and there are really only 3 lines needed; LEWX, LEVX and _UID = 16.

To make a proper fix for this, I think we need to figure out WHY the display port framebuffer injections are needed. And if they can be fixed.

If you remove the "Modify 0x591B0000 video ports to match 15X (port 0 to eDP, port 1 to HDMI, port 2 to DP, port 3 nonexistent)" patch you will see that brightness goes to 0 but it shows that it's rendering on the internal display AND the brightness keys (FN + F8/F9) work. I use a flash light as my backlight to test these things lol :)
 

Feartech

Moderator
Joined
Aug 3, 2013
Messages
27,001
Motherboard
Asus N752VX-OpenCore
CPU
i7-6700HQ / HM170
Graphics
HD 530 1920 x 1080
Mac
  1. iMac
Mobile Phone
  1. iOS
My clover is exactly like yours. The issue I had was with 17G2112. I rolled back.
The problem is the framebuffer changes (where the display ports are switched) as far as I can tell. If you look at your display in About this mac -> Displays mine shows that I'm using a 30.5 display. There are no easy way in Mac (as far as I can tell) to adjust the brightness of external displays. That's why that app works, it allows for adjustment of brightness for all displays.

Code:
// Adding PNLF device for IntelBacklight.kext or AppleBacklight.kext+AppleBacklightInjector.kext

#define SANDYIVY_PWMMAX 0x710
#define HASWELL_PWMMAX 0xad9
#define SKYLAKE_PWMMAX 0x56c
#define CUSTOM_PWMMAX_07a1 0x07a1
#define CUSTOM_PWMMAX_1499 0x1499

#ifndef NO_DEFINITIONBLOCK
DefinitionBlock("", "SSDT", 2, "hack", "_PNLF", 0)
{
#endif
    External(RMCF.BKLT, IntObj)
    External(RMCF.LMAX, IntObj)
    External(RMCF.LEVW, IntObj)
    External(RMCF.GRAN, IntObj)
    External(RMCF.FBTP, IntObj)

    External(_SB.PCI0.IGPU, DeviceObj)
    Scope(_SB.PCI0.IGPU)
    {
        OperationRegion(RMP3, PCI_Config, 0, 0x14)
    }

    // For backlight control
    Device(_SB.PCI0.IGPU.PNLF)
    {
        Name(_ADR, Zero)
        Name(_HID, EisaId ("APP0002"))
        Name(_CID, "backlight")
        Name(_UID, 0)
        Name(_STA, 0x0B)

        Field(^RMP3, AnyAcc, NoLock, Preserve)
        {
            Offset(0x02), GDID,16,
            Offset(0x10), BAR1,32,
        }
        OperationRegion(RMB1, SystemMemory, BAR1 & ~0xF, 0xe1184)
        Field(RMB1, AnyAcc, Lock, Preserve)
        {
            Offset(0x48250),
            LEV2, 32,
            LEVL, 32,
            Offset(0x70040),
            P0BL, 32,
            Offset(0xc2000),
            GRAN, 32,
            Offset(0xc8254),
            LEVW, 32,
            LEVX, 32,
            Offset(0xe1180),
            PCHL, 32,
        }

        Method(_INI)
        {
            // IntelBacklight.kext takes care of this at load time...
            // If RMCF.BKLT does not exist, it is assumed you want to use AppleBacklight.kext...
            Local4 = 1
            If (CondRefOf(\RMCF.BKLT)) { Local4 = \RMCF.BKLT }
            If (0 == (1 & Local4)) { Return }

            // Adjustment required when using AppleBacklight.kext
            Local0 = ^GDID
            Local2 = Ones
            If (CondRefOf(\RMCF.LMAX)) { Local2 = \RMCF.LMAX }
            // Determine framebuffer type (for PWM register layout)

              
             Local2 = 0x1D4C0
              
             LEVW = 0x1D4C0
             LEVX = 0x1D4C0
            _UID = 16             
          
        }
    }
#ifndef NO_DEFINITIONBLOCK
}
#endif
//EOF

This code is pretty terrible, and it only works for this laptop, and it can be simplified a lot. Like all the local stuff doesn't do anything and there are really only 3 lines needed; LEWX, LEVX and _UID = 16.

To make a proper fix for this, I think we need to figure out WHY the display port framebuffer injections are needed. And if they can be fixed.

If you remove the "Modify 0x591B0000 video ports to match 15X (port 0 to eDP, port 1 to HDMI, port 2 to DP, port 3 nonexistent)" patch you will see that brightness goes to 0 but it shows that it's rendering on the internal display AND the brightness keys (FN + F8/F9) work. I use a flash light as my backlight to test these things lol :)
As per rules, please update your hardware profile to allow others to help you easier
https://www.tonymacx86.com/account/

please read the faq for proper hardware profile setup:
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
 
Joined
Nov 27, 2012
Messages
49
Motherboard
Razer Blade 15
CPU
i7 8750H
Graphics
UHD 630, 1070 GTX, 144hz 1080p display.
Mac
  1. MacBook Pro
Mobile Phone
  1. Android
  2. iOS
Only the 3rd word is changed in this patch from 0x98000000 to 0x87010000. I don't know the structure of these words to figure out what they mean.
 
Joined
Sep 2, 2013
Messages
87
Motherboard
Lenovo Thinkpad X1 Yoga 20FQ
CPU
i7-6600U
Graphics
HD 520
Mac
  1. MacBook Pro
  2. Mac mini
Mobile Phone
  1. Android
  2. iOS
My clover is exactly like yours. The issue I had was with 17G2112. I rolled back.
The problem is the framebuffer changes (where the display ports are switched) as far as I can tell. If you look at your display in About this mac -> Displays mine shows that I'm using a 30.5 display. There are no easy way in Mac (as far as I can tell) to adjust the brightness of external displays. That's why that app works, it allows for adjustment of brightness for all displays.

Code:
// Adding PNLF device for IntelBacklight.kext or AppleBacklight.kext+AppleBacklightInjector.kext

#define SANDYIVY_PWMMAX 0x710
#define HASWELL_PWMMAX 0xad9
#define SKYLAKE_PWMMAX 0x56c
#define CUSTOM_PWMMAX_07a1 0x07a1
#define CUSTOM_PWMMAX_1499 0x1499

#ifndef NO_DEFINITIONBLOCK
DefinitionBlock("", "SSDT", 2, "hack", "_PNLF", 0)
{
#endif
    External(RMCF.BKLT, IntObj)
    External(RMCF.LMAX, IntObj)
    External(RMCF.LEVW, IntObj)
    External(RMCF.GRAN, IntObj)
    External(RMCF.FBTP, IntObj)

    External(_SB.PCI0.IGPU, DeviceObj)
    Scope(_SB.PCI0.IGPU)
    {
        OperationRegion(RMP3, PCI_Config, 0, 0x14)
    }

    // For backlight control
    Device(_SB.PCI0.IGPU.PNLF)
    {
        Name(_ADR, Zero)
        Name(_HID, EisaId ("APP0002"))
        Name(_CID, "backlight")
        Name(_UID, 0)
        Name(_STA, 0x0B)

        Field(^RMP3, AnyAcc, NoLock, Preserve)
        {
            Offset(0x02), GDID,16,
            Offset(0x10), BAR1,32,
        }
        OperationRegion(RMB1, SystemMemory, BAR1 & ~0xF, 0xe1184)
        Field(RMB1, AnyAcc, Lock, Preserve)
        {
            Offset(0x48250),
            LEV2, 32,
            LEVL, 32,
            Offset(0x70040),
            P0BL, 32,
            Offset(0xc2000),
            GRAN, 32,
            Offset(0xc8254),
            LEVW, 32,
            LEVX, 32,
            Offset(0xe1180),
            PCHL, 32,
        }

        Method(_INI)
        {
            // IntelBacklight.kext takes care of this at load time...
            // If RMCF.BKLT does not exist, it is assumed you want to use AppleBacklight.kext...
            Local4 = 1
            If (CondRefOf(\RMCF.BKLT)) { Local4 = \RMCF.BKLT }
            If (0 == (1 & Local4)) { Return }

            // Adjustment required when using AppleBacklight.kext
            Local0 = ^GDID
            Local2 = Ones
            If (CondRefOf(\RMCF.LMAX)) { Local2 = \RMCF.LMAX }
            // Determine framebuffer type (for PWM register layout)

            
             Local2 = 0x1D4C0
            
             LEVW = 0x1D4C0
             LEVX = 0x1D4C0
            _UID = 16           
        
        }
    }
#ifndef NO_DEFINITIONBLOCK
}
#endif
//EOF

This code is pretty terrible, and it only works for this laptop, and it can be simplified a lot. Like all the local stuff doesn't do anything and there are really only 3 lines needed; LEWX, LEVX and _UID = 16.

To make a proper fix for this, I think we need to figure out WHY the display port framebuffer injections are needed. And if they can be fixed.

If you remove the "Modify 0x591B0000 video ports to match 15X (port 0 to eDP, port 1 to HDMI, port 2 to DP, port 3 nonexistent)" patch you will see that brightness goes to 0 but it shows that it's rendering on the internal display AND the brightness keys (FN + F8/F9) work. I use a flash light as my backlight to test these things lol :)

I don't think native brightness will ever work if you use KBL fake id. When using KBL fake id in display settings it shows a monitor while when not faking id it shows a MacBook screen.

Edit:
Btw, I managed to boot without fakeid by changing Chipset -> SA -> Graphics configuration -> Primary Display to IGFX. However, it boots to black screen again (brightness is ok during boot tho) and no brightness slider.
 
Last edited:
Status
Not open for further replies.
Top