Bug 189231

Summary: Macbook pro 11,5 screen flicker when AC adapter plugged in
Product: ACPI Reporter: Tom B (tom)
Component: Power-BatteryAssignee: Zhang Rui (rui.zhang)
Severity: normal CC: rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.8.10 Tree: Mainline
Regression: No

Description Tom B 2016-11-27 18:56:24 UTC
As of recent kernels (Sorry I don't have the exact number but at least 4.8.8) there is problem with the screen flickering on a Macbook Pro 11,5.

There's an ongoing discussion here: https://bbs.archlinux.org/viewtopic.php?id=219442 

Machine specs:

Macbook Pro 11,5 (Retina)
Intel i7 4870HQ
Radeon  M370X (radeon graphics driver, amdgpu does not seem to be supported so I couldn't see if its' a gpu driver issue)

I can record a video using a camera if it would be useful, but it looks like graphical corruption, it looks like windows are being drawn at the wrong XY coordinates on some frames, this is made worse when a window is dragged around the screen or something on the screen requires frequent repaints such as watching a video. 

This is something to do with the power connector. If the AC adapter is plugged in when the machine boots or resumes from suspend or the screen turns on the problem occurs and the flicker will happen. Removing the AC adapter does not remove the flicker, however, if the screen turns on without the AC adapter present then the AC adapter can be attached without causing the flicker issue.

I need to verify this but I think the flicker happens consistently if the laptop is in a state of "Charging" with the AC adapter plugged in, too. If it's "Charged" but the machine is suspended/resumed without the cable in then plugged in, then the flicker is gone. This may be simply that no power is actually going to the battery because it's flagged as "charged". It's certainly a power related issue.

This may also be a related issue: When the power connector is attached the laptop's temperature is very high even when idle. Without the power cable connected, the laptop will idle around 50C (as reported by sensors). With the power cable connected (regardless of whether the charge is 0% or 100%) the cpu temperature will be 60-65C. The temperature issue does not correlate with the flicker. Regardless of whether the flicker is happening, the temperature seems unusually high while the AC adapter is connected.
Comment 1 Tom B 2016-11-28 15:24:54 UTC
additional information: I can turn on/off the flicker using radeon dynamic power management:

echo battery > /sys/class/drm/card0/device/power_dpm_state

No flicker

echo performance > /sys/class/drm/card0/device/power_dpm_state

Flicker starts

By changing the power state to performance the flicker happens. Using "battery" the flicker does not so it seems to be power related but not obvious. On "balanced" dpm, the flicker sometimes happens which is probably down to the power state.

Changing the power state does not seem to affect the temperature at all. 

Adapter: PCI adapter
temp1:        +60.0°C  (crit = +120.0°C, hyst = +90.0°C)

Regardless of the power state the temperature is almost always exactly 60.0, sometimes it's 59.0 but there is no noticeable temperature difference between "battery" and "performance" and the clock speed does not seem to change

Regardless of power state, the output of `cat /sys/kernel/debug/dri/0/radeon_pm_info` shows:

uvd    vclk: 0 dclk: 0
power level 0    sclk: 30000 mclk: 30000 vddc: 900 vddci: 850 pcie gen: 3
Comment 2 Zhang Rui 2016-11-29 08:53:01 UTC
This is a graphics issue, please file a bug at freedesktop instead.
Comment 3 Tom B 2016-11-29 10:59:07 UTC
For reference: freedesktop bug report: https://bugs.freedesktop.org/show_bug.cgi?id=98897