-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new submodule as an alternative to Backlight Registers Fix (BLR), fixing the 3-minute dark screen issue and making Backlight Smoother (BLS) work on mobile Coffee Lake platforms running macOS 13.4 or later #113
Merged
Merged
Changes from 8 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9e3e2eb
BLRS: Add the definition of the assembly patch descriptor.
0xFireWolf ac8bfe5
BRS: Add a new patch submodule that reverts the optimizations done in…
0xFireWolf 45eccad
Project: Update the change log.
0xFireWolf c18444e
Project: Add the boot argument and the device property to README.
0xFireWolf 8147b64
BRS: Fix typos in the documentation.
0xFireWolf ba3ca8e
BRS: Fix the indentation in the documentation.
0xFireWolf f191739
Project: Revise the changeling.
0xFireWolf 039806f
BRS: Preserve the base address of the MMIO region stored in `%rcx` be…
0xFireWolf 9304cd6
BLR: Simplify the implementation.
0xFireWolf 35ac5b1
BLT: Add a new submodule that analyzes backlight related functions an…
0xFireWolf 6575154
BLT: Use `getMember()` to update the member field because it returns …
0xFireWolf 496d07a
IGFX: Mark `BRS` deprecated.
0xFireWolf a4dded9
BLT: Preserve the PWM frequency set by the system firmware and write …
0xFireWolf 4caf663
BLT: Fix a typo.
0xFireWolf ea6d7e8
BLT: Now available as of macOS 13.4 since macOS 14.0 DP1 contains the…
0xFireWolf 6c1294a
IGFX: Remove the deprecated Backlight Registers Supplemental Fix (BRS…
0xFireWolf 8017057
BLT: Add the description of the submodule to the file-level abstract.
0xFireWolf f5ce20e
Project: Revise the change log.
0xFireWolf dfe7b7c
Project: Update the README.
0xFireWolf 198e479
BLT: Revise the abstract of the patch submodule.
0xFireWolf 5c2cae8
Project: Update the manual to document the new Backlight Registers Al…
0xFireWolf d0037fd
Project: Update the README.
0xFireWolf 8432fbc
Merge branch 'master' into squashed
0xFireWolf File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppleIntelFramebufferController::hwSetBacklight is rather short, maybe it is more reasonable to solve the field offsets and simply rewrite the function ourselves?
a2
argument), so two other ifs and MMIO ops also do not matter for us.What we are left with is:
mov [rbx+2E78h], r14d
backlight level set in the end of the function.mov rcx, [rbx+1A08h]
MMIO space.Perhaps do it the other way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also be smarter and perform offset detection in dynamic.
For this you could:
Now you have both offsets you need, so you can just reimplement AppleIntelFramebufferController::hwSetBacklight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I carefully revisited
hwSetBacklight
and its callersLightUpEDP
andhwSetPanelPower
, and I think that finding the offset of each required member field and rewritinghwSetBacklight
is the right approach to this issue.Yes, we do have own logic for updating registers at
0xc8254
and0xc8258
, but I am not sure which two MMIO ops you referred to do not matter. Here is Apple's implementation and my thoughts are...0x2e60
.0x1d30
.WriteRegister32()
explicitly.0x1a08
.0x2e84
.0xFFFF
and stores in the member field at0x2e80
, but there is no guarantee that the value remains the same forever.0x2e80
.hwSetPanelPower
andLightUpEDP
always invokehwSetBacklight
with the brightness value stored in the member field at0x2e78
, so it's weird thathwSetBacklight
just stores the same value to that member field again, but I think it's better to keep this in our implementation.0x2e78
.Your proposed approach that uses dummy controller objects is really interesting, but I think it's better to disassemble
hwSetBacklight()
, identify the offsets of the divider and the brightness level and implement the backlight registers fix in ourhwSetBacklight()
wrapper. Now the problem lies in the caller site. I managed to disassemble those two callers and generate the assembly patch for each of them at runtime so that they will callhwSetBacklight()
explicitly. I have added a new patch submodule to reflect the new changes and can confirm that it works on my machine properly. It would be great if you can review it and provide suggestions on making the new submodule easier to maintain in future. Once you approve the new changes, I will remove the supplemental fix from the WEG.