External display output does not work after suspend

I have the “Display outputs do not work after suspend” issue stated at the end of the following webpage:

https://wiki.archlinux.org/title/MSI_GS65

External HDMI display does not work after suspend. It is not detected by xrandr command as well.
My only workaround is to power off the computer, wait for around 10 seconds, then power it back on.
After this procedure, the external HDMI monitor is detected and works again.

The archlinux wikipage suggests disabling audio devices, but this is obviously not desirable.

System Info:
Laptop: MSI GS75 Stealth 9SF
GPU: NVIDIA GeForce RTX 2070 with Max-Q Design
OS: Ubuntu 22.04.1 LTS
Kernel: 5.15.0-52-generic
Graphics Driver Version: 520.56.06
Gnome Version: 42.4
Windowing System: X11

There seems to be similar issues of other people around the web, but no proposed solution have worked for me yet.
I am willing to cooperate further if any debugging on my part is required to resolve this issue.
Thanks.

Please run nvidia-bug-report.sh as root after suspend/resume and attach the resulting nvidia-bug-report.log.gz file to your post.

The resulting log file after suspend/resume is attached.

nvidia-bug-report.log.gz (826.4 KB)

Please check if setting kernel parameter (or module option)
nvidia.NVreg_PreserveVideoMemoryAllocations=1
helps.

I got help from archlinux wiki again, under the “Preserve video memory after suspend” section:
https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
I created the following file with the given contents as sudo:

$ cat /etc/modprobe.d/nvidia-power-management.conf
options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp/nvidia-tmp

I restarted the computer afterwards, and verified the current settings by using the command from the following post:

$ cat /proc/driver/nvidia/params
...output omitted...
PreserveVideoMemoryAllocations: 1
...output omitted...

I then suspend/resumed the computer, but the external monitor is not detected again.
Should I create another bug report log in the current state?

A new log is not needed, I don’t think that would yield any new info.
Did you already check for a bios update?

I checked the current BIOS version with the following command:

$ sudo dmidecode -s bios-version
E17G1IMS.111

which seems to be the latest BIOS version for my device, according to the following website:
https://www.msi.com/Laptop/GS75-STEALTH-9SF/support

Hi @generix, is there anything else I can do to help resolve this issue?
Sorry for troubling you.

Not really. The hdmi port seems to be hard disabled after resume, possibly by the system bios.
Did you already check if this is also happening while using the nouveau driver?

I tried nouveau driver after your suggestion, and yes, the issue still happens.

I have a dual boot ubuntu + windows 11 system.
The issue does not happen when using windows, I have this problem in ubuntu only.
I am assuming this would rule out the system bios as the culprit, is this a correct assumption?

For further info, this computer also had an issue regarding wifi not working after sleep.
This issue was resolved using the procedure described in the following askubuntu solution:

Could these two issues be related in any way?

Please remove the acpi_osi settings and check if the hdmi then works after resume.

Sorry for the late reply.
Removing the acpi_osi setting did not resolve the issue.
While I was at it, I also tried out some other acpi_osi settings, using the following guide.

https://iam.tj/prototype/enhancements/Windows-acpi_osi.html

I tried to use “Windows 2015” and “Windows 2013”, with and without the “acpi_osi=!” argument, with no success.

Hi @generix, do you have any other suggestions?
Sorry about the delay, I have been kind of busy with other stuff.