Bug 96326 - Heavy screen flickering in OpenGL apps on R9 390
Summary: Heavy screen flickering in OpenGL apps on R9 390
Status: RESOLVED MOVED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Radeon (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-02 14:51 UTC by Jan Ziak (http://atom-symbol.net)
Modified: 2019-11-19 09:16 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
dmesg (linux kernel git 2016-jul-29 with custom patches) (127.32 KB, text/plain)
2016-07-29 18:57 UTC, Jan Ziak (http://atom-symbol.net)
no flags Details
Xorg.0.log (xorg-server-1.17.4, no custom patches) (60.90 KB, text/x-log)
2016-07-29 18:59 UTC, Jan Ziak (http://atom-symbol.net)
no flags Details

Description Jan Ziak (http://atom-symbol.net) 2016-06-02 14:51:49 UTC
GPU: R9 390
GPU manufacturer: Gigabyte
Kernel: 4.5, 4.6, etc
Firmware: both hawaii_smc.bin and hawaii_k_smc.bin

Hello,

I am experiencing heavy LCD screen flickering in OpenGL apps when automatic GPU power management is enabled.

The flickering is related to mclk transitions. Forcing mclk=1.5GHz, and letting sclk be controlled by DPM, removes the flickering.

Related issues:
http://bugs.freedesktop.org/show_bug.cgi?id=91880
http://bugs.freedesktop.org/show_bug.cgi?id=92302
Comment 1 Vedran Miletić 2016-06-17 13:50:42 UTC
Confirmed by lilleman on #radeon: https://people.freedesktop.org/~cbrill/dri-log/?channel=radeon&date=2016-06-17
Comment 2 Jan Ziak (http://atom-symbol.net) 2016-07-29 10:26:41 UTC
The flickering disappears after switching from X11 to Linux console (Ctrl+Alt+F1) and back (Ctrl+Alt+F7). mclk transitions 150MHz <-> 1500MHz no longer cause monitor flickering after that.

The code in the Linux kernel executed during the switch to Linux console and back fixes the issue, we just need to pinpoint the code lines responsible for the fix.
Comment 3 Alex Deucher 2016-07-29 14:20:09 UTC
Please attach your xorg log and dmesg output.  What resolution and refresh rate are you using on your monitor?  Also are you using radeon or amdgpu?
Comment 4 Jan Ziak (http://atom-symbol.net) 2016-07-29 18:57:59 UTC
Created attachment 125424 [details]
dmesg (linux kernel git 2016-jul-29 with custom patches)
Comment 5 Jan Ziak (http://atom-symbol.net) 2016-07-29 18:59:20 UTC
Created attachment 125425 [details]
Xorg.0.log (xorg-server-1.17.4, no custom patches)
Comment 6 Jan Ziak (http://atom-symbol.net) 2016-07-29 19:08:47 UTC
(In reply to Alex Deucher from comment #3)
> Please attach your xorg log and dmesg output.

Upstream Linux kernel does not support variable mclk on R9 390. I enabled variable mclk by patching some code in drivers/gpu/drm/amd/amdgpu/ (mostly ci_dpm.c).

dmesg output contains some logging messages I added to my copy of Linux kernel source code.

> What resolution and refresh rate are you using on your monitor?

1920x1080 60Hz

> Also are you using radeon or amdgpu?

Currently amdgpu.ko, radeon.ko in the past.
Comment 7 Alex Deucher 2016-08-01 13:52:50 UTC
(In reply to Jan Ziak from comment #6)
> (In reply to Alex Deucher from comment #3)
> > Please attach your xorg log and dmesg output.
> 
> Upstream Linux kernel does not support variable mclk on R9 390. I enabled
> variable mclk by patching some code in drivers/gpu/drm/amd/amdgpu/ (mostly
> ci_dpm.c).

What patch(es) did you use?

> 
> dmesg output contains some logging messages I added to my copy of Linux
> kernel source code.
> 
> > What resolution and refresh rate are you using on your monitor?
> 
> 1920x1080 60Hz
> 
> > Also are you using radeon or amdgpu?
> 
> Currently amdgpu.ko, radeon.ko in the past.
Comment 8 Jan Ziak (http://atom-symbol.net) 2016-08-01 14:04:10 UTC
(In reply to Alex Deucher from comment #7)
> (In reply to Jan Ziak from comment #6)
> > (In reply to Alex Deucher from comment #3)
> > > Please attach your xorg log and dmesg output.
> > 
> > Upstream Linux kernel does not support variable mclk on R9 390. I enabled
> > variable mclk by patching some code in drivers/gpu/drm/amd/amdgpu/ (mostly
> > ci_dpm.c).
> 
> What patch(es) did you use?

I added a function based on ci_dpm_force_state_mclk() in ci_dpm.c.

mask is 0x3.

----
static int ci_dpm_force_state_mclk_mask(struct amdgpu_device *adev, u32 mask) {
    struct ci_power_info *pi = ci_get_pi(adev);

    if (!pi->mclk_dpm_key_disabled) {
        PPSMC_Result smc_result = amdgpu_ci_send_msg_to_smc_with_parameter(adev, PPSMC_MSG_MCLKDPM_SetEnabledMask, mask);
            printk("[atomsymbol] %s:%d: mask=0x%X, ok=%d\n", __FUNCTION__, __LINE__, mask, smc_result == PPSMC_Result_OK);
            if (smc_result != PPSMC_Result_OK)
                return -EINVAL;
    }
    return 0;
}
----

/sys/class/drm/card?/device/power_dpm_force_performance_level is set to "auto".
Comment 9 Martin Peres 2019-11-19 09:16:50 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/drm/amd/issues/720.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.