Skip to content
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

IGFX: Convert existing patches to submodules #78

Merged
merged 32 commits into from
Dec 12, 2020

Conversation

0xFireWolf
Copy link
Contributor

Abstract:

This PR converts more existing IGFX patches to submodules, revises the backlight fix to support ICL platforms, and introduces the concept of coordinated injections.

Coordinated Injections

Introduction:
The Coordinated Injections module allows multiple submodules to inject code into a shared function. We classify common patterns of code injection as three categories, prologue injection, replacer injection and epilogue injection. The prologue injector injects code before calling the original function, while the epilogue one injects code after calling the original function. The replacer injector overwrites the original implementation and thus does not call the original function. As such, the coordinator maintains three lists of injection descriptors.

An injection descriptor describes how to inject the code. It defines a trigger value that will be monitored by the coordinator, an injector function that will be called by the coordinator when the trigger value is observed, and a pointer to the next element in the linked list. Both trigger and injector function type are defined by a concrete submodule. Take the shared ReadRegister32() submodule as an example, we define the trigger as the register address, so if the graphics driver tries to read a value from that register, the coordinator would invoke the injector function. As a result, we can separate a giant wrapper function into multiple tiny ones where each of them deals with a specific register.

Implementation:
Submodules inherited from the InjectionCoordinator class get support of coordinated injections automatically, and patch developers do not need write any additional code. Currently, both ReadRegister32() and WriteRegister32() implement this feature and expose convenient helper functions to access the original implementation. Submodules that require access to these two functions must set their requiresMMIORegistersReadAccess and requiresMMIORegistersWriteAccess properties to true respectively.

Related Changes:

Future Changes:
We will probably need to separate AUX registers-related functions into separate shared submodules as well. The maximum link rate fix is the only one that injects code to the ReadAUX() function. If separations are necessary, I will probably submit another PR along with a new fix that relies on it.

Thanks for your time,
FireWolf

@Lorys89
Copy link
Contributor

Lorys89 commented Dec 10, 2020

@0xFireWolf

for the problem that the ice lake igpu patch does not start recovery? do you have any feedback on this problem?
photo

@m0d16l14n1
Copy link

@0xFireWolf

for the problem that the ice lake igpu patch does not start recovery? do you have any feedback on this problem?
photo

In my case (Ice Lake laptop too), as i have already mentioned, i have no difference with that backlight fix / or that new changes. Laptop booting okay, no problems, except that black screen bug for 7-10 seconds on login screen.

@vit9696
Copy link
Collaborator

vit9696 commented Dec 12, 2020

Does not seem to have really obvious flaws and contains fairly important changes. Merging as is, let's get it tested for longer time before the release. Thank you.

@vit9696 vit9696 merged commit 1f8e6ea into acidanthera:master Dec 12, 2020
@Lorys89
Copy link
Contributor

Lorys89 commented Dec 20, 2020

Does not seem to have really obvious flaws and contains fairly important changes. Merging as is, let's get it tested for longer time before the release. Thank you.

Schermata 2020-12-20 alle 17 58 17
Schermata 2020-12-20 alle 17 58 41

to real ioreg mbp 16,2

@Lorys89
Copy link
Contributor

Lorys89 commented Mar 15, 2023

@0xFireWolf acidanthera/bugtracker#2241 On beta 13.3 recurs problem of backlighting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants