Skip to content

Commit

Permalink
refactor!: Remove unnecessary dGPU logic
Browse files Browse the repository at this point in the history
Latest Lilu version (1.7.0) should have the original bug fixed. Update your kexts, people.
  • Loading branch information
VisualEhrmanntraut committed Dec 4, 2024
1 parent f3cfd97 commit 1f84531
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion NootedRed/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<key>OSBundleLibraries</key>
<dict>
<key>as.vit9696.Lilu</key>
<string>1.6.4</string>
<string>1.7.0</string>
<key>com.apple.iokit.IOPCIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.bsd</key>
Expand Down
36 changes: 10 additions & 26 deletions NootedRed/NRed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,24 +189,10 @@ void NRed::processPatcher(KernelPatcher &patcher) {

devInfo->processSwitchOff();

if (devInfo->videoBuiltin == nullptr) {
for (size_t i = 0; i < devInfo->videoExternal.size(); i++) {
auto *device = OSDynamicCast(IOPCIDevice, devInfo->videoExternal[i].video);
if (device == nullptr) { continue; }
auto devid = WIOKit::readPCIConfigValue(device, WIOKit::kIOPCIConfigDeviceID) & 0xFF00;
if (WIOKit::readPCIConfigValue(device, WIOKit::kIOPCIConfigVendorID) == WIOKit::VendorID::ATIAMD &&
(devid == 0x1500 || devid == 0x1600)) {
this->iGPU = device;
break;
}
}
PANIC_COND(this->iGPU == nullptr, "NRed", "No iGPU found");
} else {
this->iGPU = OSDynamicCast(IOPCIDevice, devInfo->videoBuiltin);
PANIC_COND(this->iGPU == nullptr, "NRed", "videoBuiltin is not IOPCIDevice");
PANIC_COND(WIOKit::readPCIConfigValue(this->iGPU, WIOKit::kIOPCIConfigVendorID) != WIOKit::VendorID::ATIAMD,
"NRed", "videoBuiltin is not AMD");
}
this->iGPU = OSDynamicCast(IOPCIDevice, devInfo->videoBuiltin);
PANIC_COND(this->iGPU == nullptr, "NRed", "videoBuiltin is not IOPCIDevice");
PANIC_COND(WIOKit::readPCIConfigValue(this->iGPU, WIOKit::kIOPCIConfigVendorID) != WIOKit::VendorID::ATIAMD, "NRed",
"videoBuiltin is not AMD");

WIOKit::renameDevice(this->iGPU, "IGPU");
WIOKit::awaitPublishing(this->iGPU);
Expand Down Expand Up @@ -241,14 +227,12 @@ void NRed::processPatcher(KernelPatcher &patcher) {
bzero(name, sizeof(name));
for (size_t i = 0, ii = 0; i < devInfo->videoExternal.size(); i++) {
auto *device = OSDynamicCast(IOPCIDevice, devInfo->videoExternal[i].video);
if (device != nullptr &&
(WIOKit::readPCIConfigValue(device, WIOKit::kIOPCIConfigVendorID) != WIOKit::VendorID::ATIAMD ||
WIOKit::readPCIConfigValue(device, WIOKit::kIOPCIConfigDeviceID) != this->deviceID)) {
snprintf(name, arrsize(name), "GFX%zu", ii++);
WIOKit::renameDevice(device, name);
WIOKit::awaitPublishing(device);
updatePropertiesForDevice(device);
}
if (device == nullptr) { continue; }

snprintf(name, arrsize(name), "GFX%zu", ii++);
WIOKit::renameDevice(device, name);
WIOKit::awaitPublishing(device);
updatePropertiesForDevice(device);
}

DeviceInfo::deleter(devInfo);
Expand Down

0 comments on commit 1f84531

Please sign in to comment.