Contribute
Register

Native Brightness working without 'blinkscreen' using patched AppleBacklight.kext

Status
Not open for further replies.
Update: after waking from sleep, the video no longer appears in the display... It goes to the HDMI device with the same resolution from the display... oh lord

You should definitely never use dual-link, as your screen is 1366x768 (correct?). Dual-link is to be used only for higher resolution displays, as those displays use a different cable from the motherboard to the LVDS display (a dual-link cable).
Perfect, I just didn't know that DualLink set is the default, so it took me some time and a lot of help from people like you to discover I should set it to 0...

Compiling will not check that the package size is too large. It is not an error. For example, this is valid code although not acceptable for _DSM return.
In my MaciASL configuration it checks... If the package size is too large it gives me a remark and if it is too short it gives me an error...

In the returned package there are 4 total entries, the last two uninitialized. OS X won't like that and the compiler will not complain. It is valid code, but not valid for _DSM.
I have no idea why, but each entry inside Method (_DSM) seem to count as two, at first I tried to manually insert the number of entries in Package and always got remarks/errors, then I removed it and let the app calculate it. And the result is exactly two times the number of entries.

It is just taking the "mobileness" out of the equation, so no backlight adjustment/manipulation...
For the moment I'm dealing with it with Brightness Slider app, but I don't know yet if adding a translucent black rectangle over the screen saves energy, I believe it does but it might not...

I'm suggesting you try it and start experimenting with the different values. There is much more control with ACPIBacklight as you can use a different range of values (you don't have to stick with the 0-0x710 range as you do with AppleBacklight).
I know but I tried going up to 4648 (the value used to be shown at AppleBacklightAtBoot, and also given that 4650 was the max brightness in Windows) without effect, the maximum is still very low, so whatever else I could try from that topic would only help me at controlling and not actually at reaching my full backlight...
 
In my MaciASL configuration it checks... If the package size is too large it gives me a remark and if it is too short it gives me an error...

Yes, but it is very easy to ignore a remark. I make it a habit to remove the package size when making changes such that the compiler calculates the package size for you. For example:
Code:
// a 5-entry package, compiler calculates package size
Package() { 1, 2, 3, 4, 5 }

I have no idea why, but each entry inside Method (_DSM) seem to count as two, at first I tried to manually insert the number of entries in Package and always got remarks/errors, then I removed it and let the app calculate it. And the result is exactly two times the number of entries.

Each item counts as one. Commas separate items in a package. In a _DSM, you're providing key/value pairs, so the count will always be even.

For the moment I'm dealing with it with Brightness Slider app, but I don't know yet if adding a translucent black rectangle over the screen saves energy, I believe it does but it might not...

It won't save energy. The backlight is still full on, but the LCD panel pixels are modified to let less or more light though (I assume the energy produced by the backlight is instead converted to heat).

I know but I tried going up to 4648 (the value used to be shown at AppleBacklightAtBoot, and also given that 4650 was the max brightness in Windows) without effect, the maximum is still very low, so whatever else I could try from that topic would only help me at controlling and not actually at reaching my full backlight...

If you reply to that topic, I'll try to help with some experiments. One thing you can do is add this method to your PNLF:
Code:
Method(DEB1, 0, NotSerialized) { Store(Arg0, KLVX) }

With the debug version of ACPIBacklight and ioio, you can set the value of KLVX and RawBrightness manually:
Code:
# in Terminal, try 4650... examples...
ioio -s ACPIBacklightPanel KLVX 4650
ioio -s ACPIBacklightPanel RawBrightness 4650
ioio -s ACPIBacklightPanel RawBrightness 3000
# in Terminal, try 0x710... examples...
ioio -s ACPIBacklightPanel KLVX 0x710
ioio -s ACPIBacklightPanel RawBrightness 0x710
ioio -s ACPIBacklightPanel RawBrightness 0x380

So, with ioio, you can manipulate the hardware registers directly from Terminal, experiment, and note the results if any.

It could be that your backlight is controlled by different hardware or a different setup (there is quite a few options in this hardware [read the Intel docs at the link provided in post #1]).
 
Yes, but it is very easy to ignore a remark. I make it a habit to remove the package size when making changes such that the compiler calculates the package size for you.
That's exactly what I said I'm doing :D

It won't save energy. The backlight is still full on, but the LCD panel pixels are modified to let less or more light though (I assume the energy produced by the backlight is instead converted to heat).
Ok so now I have two big reasons not to keep on what I was doing: useless HDMI cable + energy saving. Let's go!

If you reply to that topic, I'll try to help with some experiments.
Great, now just before we go to that topic: I've installed ACPIBacklight debug version, ioio, and when trying to add that Method to PNLF I receive expected errors such as KLVX not existing. As from other reads I saw that the post #1 is not anymore the way to go, what other patch do you suggest me to apply before changing PNLF?
Not sure if I should start experimenting with nguyen's script and the Windows values (0x111 - 0x122A or 273 - 4650)
 
That's exactly what I said I'm doing :D


Ok so now I have two big reasons not to keep on what I was doing: useless HDMI cable + energy saving. Let's go!


Great, now just before we go to that topic: I've installed ACPIBacklight debug version, ioio, and when trying to add that Method to PNLF I receive expected errors such as KLVX not existing. As from other reads I saw that the post #1 is not anymore the way to go, what other patch do you suggest me to apply before changing PNLF?
Not sure if I should start experimenting with nguyen's script and the Windows values (0x111 - 0x122A or 273 - 4650)

If you get an error about KLVX not existing, you haven't applied the patches appropriate for ACPIBacklight or you didn't add the method to the PNLF device. They are available in my laptop repo: https://github.com/RehabMan/Laptop-DSDT-Patch. "Brightness fix (HD3000/HD4000)".

You do not have to modify the actual _BCL data (nguyenmac's script) to start experimenting with ioio/KLVX/RawBrightness, etc. You can do that later when you figure out if anything works.
 
If you get an error about KLVX not existing, you haven't applied the patches appropriate for ACPIBacklight or you didn't add the method to the PNLF device. They are available in my laptop repo: https://github.com/RehabMan/Laptop-DSDT-Patch. "Brightness fix (HD3000/HD4000)".
Yes, I hadn't, I just wanted to be sure where to start from. Indeed it was very good to ask, I really wouldn't know it. Thank you :)

You do not have to modify the actual _BCL data (nguyenmac's script) to start experimenting with ioio/KLVX/RawBrightness, etc. You can do that later when you figure out if anything works.
Just what I thought. I'll try some experimenting here and next discussions will be moved to ACPIBacklight topic. For the moment I just want to end up the discussion here saying a giant thank you :clap:
 
Rehab?

The DSDT Patch with ACPIBacklight.kext, works awesome, i have awesome low brightness values :)

The only one thing is, that my system boots always at max brightness.
What do i need to change in the PNLF Device?

What i understand is, i need to change here something:
Store(0xad90ad9, LEVX)

(something in the ad9 (2777)? )

I've modifyed the _BCL values, because my screens max brightness ends with 1400 and not 2777...
Maybe it ends on 1388 (2777 / 2)

However, it's working perfect with the changed _BCL values and acpibacklight, the only thing i want to change is brightness at boot...

Thank you :)

Code:
Device (PNLF)        {
            Name (_ADR, Zero)
            Name (_HID, EisaId ("APP0002"))
            Name (_CID, "backlight")
            Name (_UID, 10)
            Name (_STA, 0x0B)
            //define hardware register access for brightness
            // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI
            OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)
            Field (BRIT, AnyAcc, Lock, Preserve)
            {
                Offset(0x4824c),
                LEV2, 32,
                LEVL, 32,
                Offset (0x7003C),
                P0BL, 32,
                Offset(0xc824c),
                LEVW, 32,
                LEVX, 32,
            }
            Method (_INI, 0, NotSerialized)
            {
                // If the BIOS actually sets the values prior to boot, this would be
                // how (maybe) to capture them.  My Envy does not have the capability
                // to set brightness and I find these values are not set.
                // The current value could also be in LEVL, and probably is even
                // though OS X seems to manipulate only the low 16-bits of LEVX to
                // change brightness.
                // Because the low-order 16-bits are set to zero on the Envy, enabling
                // this code causes a blank screen before the login screena appears.
                //
                //Store(LEVX, Local0)
                //Store(ShiftRight(Local0,16), Local1)
                //Store(And(Local0,0xFFFF), Local2)
                //Divide(Multiply(Local2, 0xad9), Local1, Local0)
                //Or(Local0, 0xad90000, Local0)
                //
                //REVIEW: wait for vblank to change things
                //While(LEqual (P0BL, Local1)) {}
                //
                // This is part of the "keep startup level"...
                // see comment above.
                //Store(Local0, LEVX)
                //
                // This 0xC value comes from looking what OS X initializes this
                // register to after display sleep (using ACPIDebug/ACPIPoller)
                Store(0xC0000000, LEVW)
                // Because this laptop starts at full brightness, I just set it right
                // here.  This is to insure _BQC and XBQC return the correct level
                // at startup.
                Store(0xad90ad9, LEVX)
            }
            // _BCM/_BQC: set/get for brightness level
            Method (_BCM, 1, NotSerialized)
            {
                // store new backlight level
                Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)
                If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }
                Store(Or(DerefOf(Index(_BCL,Local0)),And(LEVX,0xFFFF0000)), LEVX)
            }
            Method (_BQC, 0, NotSerialized)
            {
                Store(Match(_BCL, MGE, And(LEVX, 0xFFFF), MTR, 0, 2), Local0)
                If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }
                Return(DerefOf(Index(_BCL, Local0)))
            }
            Method (_DOS, 1, NotSerialized)
            {
                ^^PCI0.IGPU._DOS(Arg0)
            }
            // extended _BCM/_BQC for setting "in between" levels
            Method (XBCM, 1, NotSerialized)
            {
                // store new backlight level
                If (LGreater(Arg0, XRGH)) { Store(XRGH, Arg0) }
                If (LAnd(Arg0, LLess(Arg0, XRGL))) { Store(XRGL, Arg0) }
                Store(Or(Arg0,And(LEVX,0xFFFF0000)), LEVX)
            }
            Method (XBQC, 0, NotSerialized)
            {
                Store(And(LEVX,0xFFFF), Local0)
                If (LGreater(Local0, XRGH)) { Store(XRGH, Local0) }
                If (LAnd(Local0, LLess(Local0, XRGL))) { Store(XRGL, Local0) }
                Return(Local0)
            }
            // Use XOPT=1 to disable smooth transitions
            Name (XOPT, Zero)
            // XRGL/XRGH: defines the valid range
            Name (XRGL, 1)
            Name (XRGH, 1400)
            // _BCL: returns list of valid brightness levels
            // first two entries describe ac/battery power levels
            Name (_BCL, Package()
            {
                780,
                320,
                0,
                2, 4, 6, 9,
                12, 15, 19, 23,
                27, 32, 37, 42,
                48, 54, 60, 67,
                74, 82, 90, 99,
                108, 118, 130, 143,
                157, 172, 188, 205,
                223, 242, 262, 283,
                305, 328, 352, 377,
                403, 430, 458, 487,
                517, 547, 577, 609,
                641, 674, 708, 743,
                779, 810, 845, 880,
                915, 950, 985, 1020,
                1055, 1095, 1140, 1190,
                1240, 1290, 1340, 1400,
            })
        }
 
Rehab?

The DSDT Patch with ACPIBacklight.kext, works awesome, i have awesome low brightness values :)

The only one thing is, that my system boots always at max brightness.
What do i need to change in the PNLF Device?

What i understand is, i need to change here something:
Store(0xad90ad9, LEVX)

(something in the ad9 (2777)? )

I've modifyed the _BCL values, because my screens max brightness ends with 1400 and not 2777...
Maybe it ends on 1388 (2777 / 2)

However, it's working perfect with the changed _BCL values and acpibacklight, the only thing i want to change is brightness at boot...

Thank you :)

Code:
Device (PNLF)        {
            Name (_ADR, Zero)
            Name (_HID, EisaId ("APP0002"))
            Name (_CID, "backlight")
            Name (_UID, 10)
            Name (_STA, 0x0B)
            //define hardware register access for brightness
            // you can see BAR1 value in RW-Everything under Bus00,02 Intel VGA controler PCI
            OperationRegion (BRIT, SystemMemory, \_SB.PCI0.IGPU.BAR1, 0xc8254)
            Field (BRIT, AnyAcc, Lock, Preserve)
            {
                Offset(0x4824c),
                LEV2, 32,
                LEVL, 32,
                Offset (0x7003C),
                P0BL, 32,
                Offset(0xc824c),
                LEVW, 32,
                LEVX, 32,
            }
            Method (_INI, 0, NotSerialized)
            {
                // If the BIOS actually sets the values prior to boot, this would be
                // how (maybe) to capture them.  My Envy does not have the capability
                // to set brightness and I find these values are not set.
                // The current value could also be in LEVL, and probably is even
                // though OS X seems to manipulate only the low 16-bits of LEVX to
                // change brightness.
                // Because the low-order 16-bits are set to zero on the Envy, enabling
                // this code causes a blank screen before the login screena appears.
                //
                //Store(LEVX, Local0)
                //Store(ShiftRight(Local0,16), Local1)
                //Store(And(Local0,0xFFFF), Local2)
                //Divide(Multiply(Local2, 0xad9), Local1, Local0)
                //Or(Local0, 0xad90000, Local0)
                //
                //REVIEW: wait for vblank to change things
                //While(LEqual (P0BL, Local1)) {}
                //
                // This is part of the "keep startup level"...
                // see comment above.
                //Store(Local0, LEVX)
                //
                // This 0xC value comes from looking what OS X initializes this
                // register to after display sleep (using ACPIDebug/ACPIPoller)
                Store(0xC0000000, LEVW)
                // Because this laptop starts at full brightness, I just set it right
                // here.  This is to insure _BQC and XBQC return the correct level
                // at startup.
                Store(0xad90ad9, LEVX)
            }
            // _BCM/_BQC: set/get for brightness level
            Method (_BCM, 1, NotSerialized)
            {
                // store new backlight level
                Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)
                If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }
                Store(Or(DerefOf(Index(_BCL,Local0)),And(LEVX,0xFFFF0000)), LEVX)
            }
            Method (_BQC, 0, NotSerialized)
            {
                Store(Match(_BCL, MGE, And(LEVX, 0xFFFF), MTR, 0, 2), Local0)
                If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }
                Return(DerefOf(Index(_BCL, Local0)))
            }
            Method (_DOS, 1, NotSerialized)
            {
                ^^PCI0.IGPU._DOS(Arg0)
            }
            // extended _BCM/_BQC for setting "in between" levels
            Method (XBCM, 1, NotSerialized)
            {
                // store new backlight level
                If (LGreater(Arg0, XRGH)) { Store(XRGH, Arg0) }
                If (LAnd(Arg0, LLess(Arg0, XRGL))) { Store(XRGL, Arg0) }
                Store(Or(Arg0,And(LEVX,0xFFFF0000)), LEVX)
            }
            Method (XBQC, 0, NotSerialized)
            {
                Store(And(LEVX,0xFFFF), Local0)
                If (LGreater(Local0, XRGH)) { Store(XRGH, Local0) }
                If (LAnd(Local0, LLess(Local0, XRGL))) { Store(XRGL, Local0) }
                Return(Local0)
            }
            // Use XOPT=1 to disable smooth transitions
            Name (XOPT, Zero)
            // XRGL/XRGH: defines the valid range
            Name (XRGL, 1)
            Name (XRGH, 1400)
            // _BCL: returns list of valid brightness levels
            // first two entries describe ac/battery power levels
            Name (_BCL, Package()
            {
                780,
                320,
                0,
                2, 4, 6, 9,
                12, 15, 19, 23,
                27, 32, 37, 42,
                48, 54, 60, 67,
                74, 82, 90, 99,
                108, 118, 130, 143,
                157, 172, 188, 205,
                223, 242, 262, 283,
                305, 328, 352, 377,
                403, 430, 458, 487,
                517, 547, 577, 609,
                641, 674, 708, 743,
                779, 810, 845, 880,
                915, 950, 985, 1020,
                1055, 1095, 1140, 1190,
                1240, 1290, 1340, 1400,
            })
        }

Use Esc or F10 to enter BIOS setup. Use Fn+brightness keys to modify your backlight level to one you like. Hit F10 and save. Reboot and enjoy your new startup backlight level.
 
Use Esc or F10 to enter BIOS setup. Use Fn+brightness keys to modify your backlight level to one you like. Hit F10 and save. Reboot and enjoy your new startup backlight level.
You are joking :)
I have no fn keys in bios... They aren't working there...
However, i can't change brightness in bios... Its just max brightness in bios...

Is there any code way?

For example, if i put in dsdt:
If brightness(Local0) > 1300
store( "800", Local0 )...

Or sth like that? :)

Thank you Rehab :)
 
You are joking :)
I have no fn keys in bios... They aren't working there...
However, i can't change brightness in bios... Its just max brightness in bios...

Is there any code way?

For example, if i put in dsdt:
If brightness(Local0) > 1300
store( "800", Local0 )...

Or sth like that? :)

Thank you Rehab :)

In the event of no brightness controls while in BIOS (the Probook has this), you could modify the patch so it uses a different value, but that would be rather silly, since the brightness will be changed again when OS X starts up and restores the brightness to the last value used before you shutdown/restarted. The value you place in the patch would be very short-lived (a few seconds).

Is there something wrong with your nvram setup where the brightness is not being restored to the value at the previous session? If so, focus on fixing your nvram problem.
 
No it doesn't restore to the previous session...
Strange, does it have something todo, that i need to change the Bar1 Value from Bus00/02?

I don't know what nvram is exactly... it stores some things...
For example, im using tripple boot with clover (Windows/OSX/Ubuntu), and clover stores the last booted item...
Clover boots the last system... So that means, my nvram is working?

Thank you :)

EDIT:
Speaker Volume = (Is exactly the same after restart/power off/power on)
Resolution = (Same after power off/power on)
Clover = Remebers the last booted system
Brightness = Doesn't remember the last session... (Always at max on boot)

Maybe NVram is working, but i the PNLF code doesn't access the right memory adress?

Cheers :)
 
Status
Not open for further replies.
Back
Top