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

Changed the default delay of optimizing display data buffer allocations from 0 to 1 second #93

Merged
merged 4 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
WhateverGreen Changelog
=======================
#### v1.5.5
- Changed the default delay of optimizing display data buffer allocations from 0 to 1 second to fix the issue that both internal and external displays flicker on some Ice Lake-based laptops. (Thanks @m0d16l14n1)
- Disabled the black screen fix on Ice Lake platforms as it is only applicable to SKL/KBL/CFL/CML platforms.
- Disabled the force complete modeset submodule on Ice Lake platforms as HDMI/DVI connections are not supported by the driver.

#### v1.5.4
- Added the fix for the short period garbled screen after the system boots on Ice Lake platforms. (by @0xFireWolf, also thanks @m0d16l14n1 and @kingo132)

Expand Down
7 changes: 7 additions & 0 deletions Manual/FAQ.IntelHD.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,13 @@ igfx: @ (DBG) BLS: [COMM] Processing the request: Current = 0x00014ead; Target =
为核显添加 `enable-dbuf-early-optimizer` 属性或者直接使用 `-igfxdbeo` 启动参数以修复 Ice Lake 笔记本开机后内屏短暂花屏的问题。
若发现内核日志记录了如下 DBUF 以及 Pipe Underrun 相关的错误信息,请启用此补丁来修复这些错误。

此补丁通过提前调用优化显示缓冲区分配的函数来修复 DBUF 相关错误。
用户可通过 `dbuf-optimizer-delay` 设备属性来指定具体的延迟时间(单位为秒,值类型为`Data`)。
若用户未指定此属性,*WEG* 将使用如下所述的默认值。

社区用户反馈 1 到 3 秒的延迟可在不影响外接显示器的情况下修复 DBUF 相关错误,而 *WEG* v1.5.4 所用的默认 0 秒延迟可能会导致部分笔记本外接显示器时内屏外屏同时花屏的问题。
从 v1.5.5 开始,默认的延迟时间改为 1 秒,这样用户在通常情况下无需手动添加设备属性来修改延迟时间。

<details>
<summary>包含 DBUF 以及 Pipe Underrun 错误信息的内核日志</summary>

Expand Down
8 changes: 8 additions & 0 deletions Manual/FAQ.IntelHD.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2666,6 +2666,14 @@ Add the `enable-dbuf-early-optimizer` property to `IGPU` or use the `-igfxdbeo`
otherwise your builtin display remains garbled for 7 to 15 seconds after the system boots.
You need this fix if you observe a bunch of errors mentioning "DBUF" and "pipe underrun" in the kernel log.

This fix works by calling the function that optimizes the display data buffer allocations early.
You may specify the delay in seconds (value of type `Data`) via the `dbuf-optimizer-delay` property.
If the property is not specified, the default value will be used (see below).

The community reports that a delay of 1 to 3 seconds is adequate for avoiding the underrun issue on the builtin display without having negative impacts on external displays,
and that the default delay of 0 second used in *WEG* v1.5.4 may lead to both internal and external displays flickering on some laptops.
Starting from v1.5.5, the default delay is changed to 1 second, so in most cases users do not have to specify the delay manually.

<details>
<summary>Sample kernel log that contains DBUF-related errors</summary>

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ indices of connectors for which online status is enforced. Format is similar to
- `-igfxblr` boot argument (and `enable-backlight-registers-fix` property) to fix backlight registers on KBL, CFL and ICL platforms.
- `-igfxmpc` boot argument (`enable-max-pixel-clock-override` and `max-pixel-clock-frequency` properties) to increase max pixel clock (as an alternative to patching CoreDisplay.framework).
- `-igfxbls` boot argument (and `enable-backlight-smoother` property) to make brightness transitions smoother on IVB+ platforms. [Read the manual](https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md#customize-the-behavior-of-the-backlight-smoother-to-improve-your-experience)
- `-igfxdbeo` boot argument (and `enable-dbuf-early-optimizer` property) to fix the Display Data Buffer (DBUF) issues on ICL+ platforms.
- `-igfxdbeo` boot argument (and `enable-dbuf-early-optimizer` property) to fix the Display Data Buffer (DBUF) issues on ICL+ platforms. [Read the manual](https://github.com/acidanthera/WhateverGreen/blob/master/Manual/FAQ.IntelHD.en.md#fix-the-issue-that-the-builtin-display-remains-garbled-after-the-system-boots-on-icl-platforms)

#### Credits

Expand Down
8 changes: 5 additions & 3 deletions WhateverGreen/kern_igfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void IGFX::init() {
currentFramebuffer = &kextIntelSKLFb;
modForceCompleteModeset.supported = modForceCompleteModeset.legacy = true; // not enabled, as on legacy operating systems it casues crashes.
modTypeCCheckDisabler.enabled = getKernelVersion() >= KernelVersion::BigSur;
modBlackScreenFix.available = true;
break;
case CPUInfo::CpuGeneration::KabyLake:
supportsGuCFirmware = true;
Expand All @@ -75,6 +76,7 @@ void IGFX::init() {
modRPSControlPatch.available = true;
modForceWakeWorkaround.enabled = true;
modTypeCCheckDisabler.enabled = getKernelVersion() >= KernelVersion::BigSur;
modBlackScreenFix.available = true;
break;
case CPUInfo::CpuGeneration::CoffeeLake:
supportsGuCFirmware = true;
Expand All @@ -89,6 +91,7 @@ void IGFX::init() {
modRPSControlPatch.available = true;
modForceWakeWorkaround.enabled = true;
modTypeCCheckDisabler.enabled = true;
modBlackScreenFix.available = true;
break;
case CPUInfo::CpuGeneration::CannonLake:
supportsGuCFirmware = true;
Expand All @@ -102,7 +105,6 @@ void IGFX::init() {
currentGraphics = &kextIntelICL;
currentFramebuffer = &kextIntelICLLPFb;
currentFramebufferOpt = &kextIntelICLHPFb;
modForceCompleteModeset.supported = modForceCompleteModeset.enabled = true;
modDVMTCalcFix.available = true;
break;
case CPUInfo::CpuGeneration::CometLake:
Expand All @@ -117,6 +119,7 @@ void IGFX::init() {
modForceCompleteModeset.supported = modForceCompleteModeset.enabled = true;
modRPSControlPatch.available = true;
modTypeCCheckDisabler.enabled = true;
modBlackScreenFix.available = true;
break;
case CPUInfo::CpuGeneration::RocketLake:
gPlatformGraphicsSupported = false;
Expand Down Expand Up @@ -760,8 +763,7 @@ void IGFX::BlackScreenFix::init() {
void IGFX::BlackScreenFix::processKernel(KernelPatcher &patcher, DeviceInfo *info) {
// Black screen (ComputeLaneCount) happened from 10.12.4
// It only affects SKL, KBL, and CFL drivers with a frame with connectors.
if (!info->reportedFramebufferIsConnectorLess &&
BaseDeviceInfo::get().cpuGeneration >= CPUInfo::CpuGeneration::Skylake &&
if (!info->reportedFramebufferIsConnectorLess && available &&
((getKernelVersion() == KernelVersion::Sierra && getKernelMinorVersion() >= 5) ||
getKernelVersion() >= KernelVersion::HighSierra)) {
enabled = info->firmwareVendor != DeviceInfo::FirmwareVendor::Apple;
Expand Down
20 changes: 18 additions & 2 deletions WhateverGreen/kern_igfx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ class IGFX {
} modTypeCCheckDisabler;

/**
* A submodule to fix the black screen on external HDMI/DVI displays
* A submodule to fix the black screen on external HDMI/DVI displays on SKL/KBL/CFL platforms
*/
class BlackScreenFix: public PatchSubmodule {
/**
Expand Down Expand Up @@ -1459,6 +1459,11 @@ class IGFX {
static bool wrapComputeLaneCountNouveau(void *controller, void *detailedTiming, int availableLanes, int *laneCount);

public:
/**
* True if the current platform is supported
*/
bool available {false};

// MARK: Patch Submodule IMP
void init() override;
void processKernel(KernelPatcher &patcher, DeviceInfo *info) override;
Expand Down Expand Up @@ -1773,10 +1778,21 @@ class IGFX {
*/
static constexpr const char* kOptimizerTime = "DBUFOptimizeTime";

/**
* The default optimizer delay is 1 second
*
* @note The community reports that the previous default delay (0 second) used v1.5.4
* may result in both internal and external displays flickering on some laptops.
* Their experiment suggests that a delay of 1 to 3 seconds seems to be safe and solves
* the underrun issue on the builtin display without having impacts on the external ones.
* @note Thanks @m0d16l14n1 for the suggestion and collecting results from other testers.
*/
static constexpr uint32_t kDefaultOptimizerTime = 1;

/**
* Specify the amount of time in seconds to delay the execution of optimizing the display data buffer allocation
*/
uint32_t optimizerTime {0};
uint32_t optimizerTime {kDefaultOptimizerTime};

/**
* Original AppleIntelFramebufferController::getFeatureControl function
Expand Down