Bug 110856

Summary: Freesync causes in-game blackscreens when game has low fps.
Product: DRI Reporter: Arek Tumas <mokurai82>
Component: DRM/AMDgpuAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact:
Severity: critical    
Priority: high CC: nicholas.kazlauskas
Version: XOrg git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Dmesg log file
none
Xorg.0.log file
none
DMESG log with 5.2-rc4 kernel
none
Xorg.0.log file with 5.2-rc4 kernel
none
/etc/mkinitcpio.conf none

Description Arek Tumas 2019-06-07 17:03:03 UTC
When I play games on my Benq EX2303R 144hz monitor, the monitor shows blackscreens/turns of for a few seconds in low fps scenarios like in-game menus or during stutters. This is probably when the monitor exits it's VRR window. Freesync is working normally with the same hardware and software but an Acer XG270HU Freesync 1 monitor.

I have The following hardware:
an ASUS Strix Vega 64 8GB GPU
Benq EX3203r Freesync 2 Monitor
Lindy premium displayport cable.
Ryzen 7 1800x Stock clocks with SMT

Software:
MESA - 19.0.4-1
Operating System: Manjaro Linux 
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.58.0
Qt Version: 5.12.3
Kernel Version: 5.2.0-1-MANJARO
OS Type: 64-bit
Processors: 16 × AMD Ryzen 7 1800X Eight-Core Processor
Memory: 15,7 GiB of RAM

(Hi, I'm new to filing bugs so I'm not sure if this is the right place to post this.
If it's the wrong place please tell me where I can file this in.)
Comment 1 Nicholas Kazlauskas 2019-06-10 14:54:11 UTC
Please attach a full dmesg log and an Xorg log if you're using X.
Comment 2 Arek Tumas 2019-06-13 09:13:48 UTC
Created attachment 144527 [details]
Dmesg log file

This is during a Rocket League session with kernel version 5.1.4-1-MANJARO
Comment 3 Arek Tumas 2019-06-13 09:15:02 UTC
Created attachment 144528 [details]
Xorg.0.log file

This is the Xorg.0.log file during a Rocket League session with kernel version 5.1.4-1-MANJARO
Comment 4 Arek Tumas 2019-06-13 09:17:15 UTC
These are the log files during Rocket League with VRR enabled.
I recorded these with kernel version 5.1.4-1-MANJARO as the 5.2 kernel is not finished yet. If You need these with kernel 5.2-rc4 then I can also send them too.
Comment 5 Arek Tumas 2019-06-13 09:49:15 UTC
Created attachment 144530 [details]
DMESG log with 5.2-rc4 kernel
Comment 6 Arek Tumas 2019-06-13 09:50:02 UTC
Created attachment 144531 [details]
Xorg.0.log file with 5.2-rc4 kernel
Comment 7 Ropid 2019-06-13 18:17:32 UTC
I saw the same issue when I tried the BenQ EX3203R for a few days. I could work around the problem by extracting and saving the monitor's EDID in a file, and changing the VRR range in that file from the original 24-144Hz to 48-144Hz. I then overrode the monitor's EDID on the kernel command line with this parameter here:

drm_kms_helper.edid_firmware=DP-1:edid/edid-benq-xr3203r-vrr-48-144.bin

My customized EDID file is this:

$ base64 /usr/lib/firmware/edid/edid-benq-xr3203r-vrr-48-144.bin 
AP///////wAJ0WZ/RVQAABkcAQS1Rid4P901rE9FrCYQUFQlSwDR/NHo0cCzAKnAgYCBAIHAVl4A
oKCgKVAvIDUAgGghAAAaAAAA/QAwkN7ePAEKICAgICAgAAAA/ABCZW5RIEVYMzIwM1IKAAAAEAAA
AAAAAAAAAAAAAAAAAdUCA1VwUVxbWj9AEB8iISAEExIDAWFrIwkHB4MBAADiAMBtAwwAEAA4eCAA
YAECA2fYXcQBeAADbRoAAAIDMJAAA2A3CC/jBeMB5A9g/AHmBgcBYF06+OMAoKCgMlAIIJgEgGgh
AAAeB4KAUHA4TUAIIPgM4A4RAAAcAAAAAAAAqw==

If you want to try this custom EDID file I used, run that base64 encoded text I shared here through "base64 --decode > filename.bin" to get the binary file.

For the kernel parameter, the output ports are named differently than in Xorg. You can get the output port name where the monitor is connected like this:

$ grep . /sys/class/drm/card*-*/status
/sys/class/drm/card0-DP-1/status:connected
/sys/class/drm/card0-DP-2/status:disconnected
...

About how I created the EDID file, it was with a Windows tool named "Custom Resolution Utility". It can extract the EDID from the monitor/driver and save it in a file, and can customize the VRR data structure in there.

I only tried 48Hz for minimum VRR range and this worked fine, there were no black screens anymore. I don't know what other values work with the EX3203R.
Comment 8 Arek Tumas 2019-06-13 20:50:51 UTC
I've tried it but it did not work. I made a custom edid.bin file through CRU on windows, but in rocket League when I click on menus the screen resets/flashes black (as in the monitors hardware does). Also when I select the frame rate target below the vrr window it stays black. It does happen less in in-game 3d scenes I think, but that may be subjective. This happens all the time in Witcher 2.
I've been on this for hours. I also tried advice from the following sites later on:
https://forum.manjaro.org/t/solved-setting-custom-resolution-for-second-monitor-via-xorg-conf/83693/18

https://kodi.wiki/view/Creating_and_using_edid.bin_via_xorg.conf#Configure_xorg_to_read_custom_EDID_file

I of course adjusted it for amdgpu purposes.

I've tried these settings in /usr/share/X11/xorg.conf.d/10-amdgpu.conf  according to those tutorials:

Section "OutputClass"
	Identifier "AMDgpu"
	MatchDriver "amdgpu"
	Driver "amdgpu"
EndSection
Section "Device"
    Identifier "AMD"
    Driver "amdgpu"
    Option  "ConnectedMonitor" "DP-2"
    Option  "CustomEDID" "DP-2:/etc/X11/edid.bin"
    Option  "IgnoreEDID" "false"
    Option  "UseEDID" "true"
    Option  "VariableRefresh" "true"
    Option  "TearFree" "on"
    Option  "DRI" "3"
#    Option "AccelMethod" "glamor"
EndSection
Comment 9 Arek Tumas 2019-06-13 21:03:34 UTC
Created attachment 144534 [details]
/etc/mkinitcpio.conf

I also changed this file to point to my custom edid.bin file
Comment 10 Ropid 2019-06-13 23:02:07 UTC
Those Xorg config options you tried to use do not exist on the xf86-video-amdgpu driver (I mean "CustomEDID" etc.). Those EDID options you used are unique Nvidia driver config options and do not exist in any other driver.

If you are intersted, you can find a list about possible Xorg options for amdgpu by running "man 4 amdgpu", and then there's more general stuff documented in "man xorg.conf". There is sadly nothing about EDID anywhere.

For the open drivers that use kernel-mode-setting, you need to tell the driver about your EDID file on the kernel command line. That's the only way to do it.

In the /etc/mkinitcpio.conf file you shared, you made a mistake on the "MODULES=..." line. You need to remove that "drm_kms_helper..." text from that line. That text you added there has to go onto the kernel command line, not into mkinitcpio.conf.

The only thing you have to do in /etc/mkinitcpio.conf is what you already did on the "FILES=..." line.

About that "drm_kms_helper..." kernel command line parameter, where you have to add it is your boot loader's configuration file. I don't know how that works on Manjaro.
Comment 11 Arek Tumas 2019-06-14 06:31:21 UTC
Alright! The workaround is now working. To summarize:
All I needed to do is put the custom edid.bin file (that i made on windows with the custom resolution utility with the minimum VRR set to 48 instead of 24) in /lib/firmware/edid
Then edid /etc/default/grub with the following line:
GRUB_CMDLINE_LINUX_DEFAULT="drm.edid_firmware=DP-2:edid/edid.bin quiet" 
(You need to change DP-2 to whatever you get with  "grep . /sys/class/drm/card*-*/status" )
After that I did "sudo update-grub" and rebooted the machine.

It's working flawlessly :) The upside of this method is that it is permanent.

Thank You for Your time and effort to help me Nicholas! Your pointers were priceless!

Also I don't know if it's feasible but it would be nice if this workaround wouldn't be needed in the first place.
Comment 12 Arek Tumas 2019-06-14 06:33:30 UTC
Oh and Ropid - Many Thanks to You too! I meant to thank both of You guys!
Comment 13 Martin Peres 2019-11-19 09:30:11 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/813.

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.