Linux kernel 6.0-rcX and Nvidia 515.65.1

NOTE 1: This procedure is for those who are using .run Nvidia driver installer on Ubuntu 22.04

NOTE 2: This process was tested by me on my own desktop computer, but I do not guarantee that it will work for you.

WARNING: Use at your own risk!

If you booted kernel 6.0-rcX, you most probably are welcomed with limited graphics capabilities. Go to TTY2 (CTRL+ALT+F2), login using your username and password, and stop gdm service:
sudo systemctl stop gdm

Now uninstall Nvidia driver if you have it already installed via .run installer:
sudo nvidia-uninstall

Next step is to extract file:

sh -x

After this is finished, go into NVIDIA-Linux-x86_64-515.65.01 folder:
cd NVIDIA-Linux-x86_64-515.65.01/

Now open file kernel/nvidia-drm/nvidia-drm-helper.c
nano kernel/nvidia-drm/nvidia-drm-helper.c

And somewhere around line 30, for example, after line:
#include "nvidia-drm-helper.h"

add this:
#include <drm/drm_framebuffer.h>

Save the file, and start the installer with:
sudo sh

Follow the instruction on screen as usual, to complet the installation.

After the installation is finished, just start gdm service again using sudo systemctl start gdm and login to your desktop environment.