Skip to content

Commit

Permalink
Do not terminate patching on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
PMheart committed Jul 11, 2022
1 parent 2194c87 commit 02ab31c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions WhateverGreen/kern_igfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,25 +1062,28 @@ bool IGFX::applySklAsKblPatches(IOService *that) {
// The removal of profile 2 under VTSupportedProfileArray allows fallback to software encoding/decoding.
// Thanks dhinakg and aben for finding this.
const char *hevcCapProps[] = { "IOGVAHEVCDecodeCapabilities", "IOGVAHEVCEncodeCapabilities" };
bool found = false;
for (auto prop : hevcCapProps) {
found = false;

auto hevcCap = OSDynamicCast(OSDictionary, that->getProperty(prop));
if (!hevcCap)
return false;
continue;

auto newHevcCap = OSDictionary::withDictionary(hevcCap);
if (!newHevcCap)
return false;
continue;

auto vtSuppProf = OSDynamicCast(OSArray, newHevcCap->getObject("VTSupportedProfileArray"));
if (!vtSuppProf) {
newHevcCap->release();
return false;
continue;
}

auto newVtSuppProf = OSArray::withArray(vtSuppProf);
if (!newVtSuppProf) {
newHevcCap->release();
return false;
continue;
}

unsigned int count = newVtSuppProf->getCount();
Expand All @@ -1089,12 +1092,13 @@ bool IGFX::applySklAsKblPatches(IOService *that) {
if (!num) {
newVtSuppProf->release();
newHevcCap->release();
return false;
continue;
}

if (num->unsigned8BitValue() == 2) {
DBGLOG("igfx", "removing profile 2 from VTSupportedProfileArray/%s index %u on Skylake with KBL kexts", prop, i);
newVtSuppProf->removeObject(i);
found = true;
break;
}
}
Expand All @@ -1106,7 +1110,7 @@ bool IGFX::applySklAsKblPatches(IOService *that) {
newHevcCap->release();
}

return true;
return found;
}

bool IGFX::wrapAcceleratorStart(IOService *that, IOService *provider) {
Expand Down

0 comments on commit 02ab31c

Please sign in to comment.