Skip to content

Commit

Permalink
Fix type issues in force-online
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Apr 1, 2020
1 parent f612723 commit 8169a6a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions WhateverGreen/kern_igfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ void IGFX::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
uint32_t forceOnline = 0;
if (PE_parse_boot_argn("igfxonln", &forceOnline, sizeof(forceOnline))) {
forceOnlineDisplay.enable = forceOnline != 0;
DBGLOG("weg", "force online display overriden by boot-argument %d", forceOnline);
DBGLOG("weg", "force online overriden by boot-argument %u", forceOnline);
} else if (WIOKit::getOSDataValue(info->videoBuiltin, "force-online", forceOnline)) {
forceOnlineDisplay.enable = forceOnline != 0;
DBGLOG("weg", "force online display overriden by device property %d", forceOnline);
DBGLOG("weg", "force online overriden by device property %u", forceOnline);
}

if (forceOnlineDisplay.enable) {
Expand Down Expand Up @@ -823,17 +823,17 @@ IOReturn IGFX::wrapFBClientDoAttribute(void *fbclient, uint32_t attribute, unsig
return FunctionCast(wrapFBClientDoAttribute, callbackIGFX->orgFBClientDoAttribute)(fbclient, attribute, unk1, unk2, unk3, unk4, externalMethodArguments);
}

bool IGFX::wrapGetDisplayStatus(IOService *framebuffer, void *displayPath) {
bool ret = FunctionCast(wrapGetDisplayStatus, callbackIGFX->orgGetDisplayStatus)(framebuffer, displayPath);
if (ret)
return true;

if (callbackIGFX->forceOnlineDisplay.customised)
ret = callbackIGFX->forceCompleteModeset.inList(framebuffer);
else
ret = true;
uint32_t IGFX::wrapGetDisplayStatus(IOService *framebuffer, void *displayPath) {
// 0 - offline, 1 - online, 2 - empty dongle.
uint32_t ret = FunctionCast(wrapGetDisplayStatus, callbackIGFX->orgGetDisplayStatus)(framebuffer, displayPath);
if (ret != 1) {
if (callbackIGFX->forceOnlineDisplay.customised)
ret = callbackIGFX->forceOnlineDisplay.inList(framebuffer) ? 1 : ret;
else
ret = 1;
}

DBGLOG("igfx", "getDisplayStatus forces %d", ret);
DBGLOG("igfx", "getDisplayStatus forces %u", ret);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion WhateverGreen/kern_igfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ class IGFX {
/**
* AppleIntelFramebuffer::getDisplayStatus to force display status on configured screens.
*/
static bool wrapGetDisplayStatus(IOService *framebuffer, void *displayPath);
static uint32_t wrapGetDisplayStatus(IOService *framebuffer, void *displayPath);

/**
* Load GuC-specific patches and hooks
Expand Down
6 changes: 3 additions & 3 deletions WhateverGreen/kern_igfx_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ static IOReturn fbdebugWrapConnectionProbe(IOService *framebuffer, uint8_t unk1,
return ret;
}

static bool fbdebugWrapGetDisplayStatus(IOService *framebuffer, void *displayPath) {
static uint32_t fbdebugWrapGetDisplayStatus(IOService *framebuffer, void *displayPath) {
auto idxnum = OSDynamicCast(OSNumber, framebuffer->getProperty("IOFBDependentIndex"));
int idx = (idxnum != nullptr) ? (int) idxnum->unsigned32BitValue() : -1;
SYSLOG("igfx", "getDisplayStatus %d start", idx);
bool ret = FunctionCast(fbdebugWrapGetDisplayStatus, fbdebugOrgGetDisplayStatus)(framebuffer, displayPath);
SYSLOG("igfx", "getDisplayStatus %d end - %d", idx, ret);
uint32_t ret = FunctionCast(fbdebugWrapGetDisplayStatus, fbdebugOrgGetDisplayStatus)(framebuffer, displayPath);
SYSLOG("igfx", "getDisplayStatus %d end - %u", idx, ret);
//FIXME: This is just a hack.
SYSLOG("igfx", "[HACK] forcing STATUS 1");
ret = 1;
Expand Down

1 comment on commit 8169a6a

@stevezhengshiqi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vit9696 Hi, thank you so much for making this great property. My device can now work with HDMI on macOS10.15.4. However, I met a stream access aux problem shown in my log. For example, in my log, it keep shows

2020-04-06 00:46:49.232006-0400  localhost kernel[0]: (AppleIntelKBLGraphicsFramebuffer) <AppleIntelKBLGraphicsFramebuffer`IntelFBClientControl::doAttribute(unsigned int, unsigned long*, unsigned long, unsigned long*, unsigned long*, IOExternalMethodArguments*)> [IGFB][ERROR  ] [AGDC] Failed with status -536870212 for stream access aux
2020-04-06 00:46:49.266511-0400  localhost kernel[0]: (AppleIntelKBLGraphicsFramebuffer) <AppleIntelKBLGraphicsFramebuffer`IntelFBClientControl::doAttribute(unsigned int, unsigned long*, unsigned long, unsigned long*, unsigned long*, IOExternalMethodArguments*)> [IGFB][ERROR  ] [AGDC] Failed with status -536870212 for stream access aux
2020-04-06 00:46:49.552977-0400  localhost kernel[0]: (AppleIntelKBLGraphicsFramebuffer) <AppleIntelKBLGraphicsFramebuffer`IntelFBClientControl::doAttribute(unsigned int, unsigned long*, unsigned long, unsigned long*, unsigned long*, IOExternalMethodArguments*)> [IGFB][ERROR  ] [AGDC] Failed with status -536870212 for stream access aux
2020-04-06 00:46:49.586347-0400  localhost kernel[0]: (AppleIntelKBLGraphicsFramebuffer) <AppleIntelKBLGraphicsFramebuffer`IntelFBClientControl::doAttribute(unsigned int, unsigned long*, unsigned long, unsigned long*, unsigned long*, IOExternalMethodArguments*)> [IGFB][ERROR  ] [AGDC] Failed with status -536870212 for stream access aux

After I remove

<key>force-online</key>
<data>AQAAAA==</data>

there would be no logs like that, but HDMI cannot work.

Please sign in to comment.