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

Fix the issue that the builtin display remains garbled after the system boots on ICL platforms #92

Merged
merged 4 commits into from
Oct 2, 2021

Conversation

0xFireWolf
Copy link
Contributor

Abstract

This pull request contains 1 new feature and closes acidanthera/bugtracker#1329 and acidanthera/bugtracker#1805.

Display Data Buffer (DBUF) is critical for display pipes and planes to function properly. The graphics driver allocates the buffer by writing a <start, end> pair to the plane buffer configuration register. Apple expects that the firmware has allocated an adequate amount of buffer for the Pipe A that drives the builtin display, so the driver can optimize the allocation later to provide better display residency in memory low power modes.

However, the buffer allocated by the BIOS on Ice Lake-based laptops seems to be not enough for the plane running in the mode configured by the driver, resulting in a garbled display that lasts for about 7 to 15 seconds when the system finishes booting and presents the login window. This issue will disappear when the function that optimizes the buffer allocation is fired by a timer enabled at the end of mode setting.

The default delay of executing the optimizer function is 15 seconds which is hard-coded in the framebuffer controller's startup routine. Fortunately, we can change the delay by injecting the property "DBUFOptimizeTime" to the feature control dictionary. By specifying a delay of 0 second, we can invoke the optimizer function as soon as the graphics driver completes the modeset for the builtin display, thus fixing the garbled builtin screen issue on Ice Lake platforms without having any negative impacts on external monitors.

-- FireWolf
Oct 2, 2021

@vit9696 vit9696 merged commit 3c9a77e into acidanthera:master Oct 2, 2021
@vit9696
Copy link
Collaborator

vit9696 commented Oct 2, 2021

Very nice, thanks for finishing it off :)

@hoseinrez
Copy link

Great job !
Thank you @0xFireWolf
My 1005G1 graphics glitch on boot is now solved ... 😍

@idalin
Copy link

idalin commented Nov 26, 2021

I have a laptop Lenovo C940 with CPU is 1065G7 and a 4k internal Display. It doesn't result a garbled display but black screen. It will recover to normal by closing the lid and then open it.
This patch doesn't fix this problem. But the log shows Internal cached DBuf values are not set. Failed to distribute DBufs, so I think maybe they are the same reason.
igfb.log

[IGFB][LOG ][MODESET ] FB0: setting up params for pipe A [IGFB][LOG ][MODESET ] TRANS_CLK_SEL = 0x0 [IGFB][LOG ][MODESET ] PIPE_SRCSZ = 0xd1f0761 [IGFB][LOG ][MODESET ] Encoder bits per color is 10 [IGFB][LOG ][MODESET ] Pixel encoding is RGB [IGFB][LOG ][MODESET ] TRANS_MSA_MISC = 0x41 [IGFB][LOG ][MODESET ] Dither is enabled in pipe misc [IGFB][LOG ][DISPLAY ] FB0: pixelClock=533280000, linkSymbolClock=540000000, colorDepth=30, noLanes=4 [IGFB][LOG ][DISPLAY ] DataM value: 0x7681b5 [IGFB][LOG ][DISPLAY ] LinkM value: 0x7e683 [IGFB][LOG ][DISPLAY ] Calculated -> DataM1=0x7e7681b5, DataN1=0x800000, LinkM1=0x7e683, LinkN1=0x80000 [IGFB][LOG ][MODESET ] FB0:Path not active, needs full modeset for pipe 0 [IGFB][INFO ][MODESET ] FB0: Complete modeset [IGFB][LOG ][MODESET ] Disable display called for without sw dc6 support [IGFB][LOG ][DISPLAY ] FB0: Disabling Pipe A [IGFB][LOG ][MODESET ] Lighting up eDP [IGFB][LOG ][DISPLAY ] Enabling clocks for DDI = 0 [IGFB][LOG ][LINK_TRAINING] DDI = 0, PortType = 0 [IGFB][LOG ][LINK_TRAINING] NumberOfLanes=4, BitRate=20, EnhancedFraming=1, ASR=1, Downspread=0, CR=65000, EQ=65000 [IGFB][ERROR][LINK_TRAINING] Phase 1 of link training failed - notifying AGDC to take display offline [IGFB][ERROR][DISPLAY ] Internal cached DBuf values are not set. Failed to distribute DBufs [IGFB][LOG ][DISPLAY ] FB0: Enabling pipe 0 [IGFB][LOG ][DISPLAY ] FB0: EDP DisplayPipe property set to 0 [IGFB][ERROR][MODESET ] Modeset is unsuccessful. Disabling display [IGFB][LOG ][DISPLAY ] FB0: Disabling Pipe A [IGFB][LOG ][DISPLAY ] FB0: Disabling clocks [IGFB][LOG ][DISPLAY ] Disabling clocks on DDI = 0

@sunrenjie
Copy link

Sorry to hijack this.
@idalin and any one affected too even after upgarding to the latest of WhateverGreen:
It may be fixed by injecting edid to AAPL00,override-no-connect. See dortania/bugtracker#17 (comment)

@regiswicaksono
Copy link

Great job ! Thank you @0xFireWolf My 1005G1 graphics glitch on boot is now solved ... 😍

Hi. Do you mind sharing the step on how to do it?

@m0d16l14n1
Copy link

Great job ! Thank you @0xFireWolf My 1005G1 graphics glitch on boot is now solved ... 😍

Hi. Do you mind sharing the step on how to do it?

Read README

image

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

Successfully merging this pull request may close these issues.

Black screen on boot / Some weird glitch
7 participants