Ubuntu 22.04 driver problems

So I am currently using Ubuntu 22.04 (dual boot) and having some strange behaviour of GPU and monitor.
I run my laptop with the latest kernel 5.15.0-53 and latest autoinstalled driver 510. Laptop starts with the black screen half of which is flickering. BUT then I connect second monitor via HDMI it works just fine (only second monitor) I am able to use nvidia-smi etc. and use nvidia-settings, but still I cant make primary laptop’s monitor to work.
Then I restart system with older kernel and my native screen works!! BUT brightness doesn’t work, display is “Unclaimed/unknown” and if I check with inxi -G it says driver: N/A
I really appreciate not reinstalling the whole system , but this issue is annoying. Spent so many days searching installing/reinstalling drivers without result
P.s secure boot is OFF

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

nvidia-bug-report.log.gz (273.7 KB)
Please find attached Nvidia report made on my latest kernel (with primary display not working and secondary working fine )

It’s the rare case where the nvidia driver incorrectly detects the display as make “NVIDIA” with a resolution of 640x480 which doesn’t work.
This is either due to broken display edid/firmware or a driver bug.
Please uninstall the nvidia driver so nouveau gets used, then post the output of
xrandr --verbose

please clarify: switching to nouveau in “Software &Updates” is enough or uninstalling Nvidia using --purge is necessary as well?

Switching to nouveau in Software&Updates should be sufficient.

Please see xrandr --verbose output:

xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080
default connected primary 1920x1080+0+0 (0x522) normal (normal) 0mm x 0mm
	Identifier: 0x521
	Timestamp:  28669
	Subpixel:   unknown
	Clones:    
	CRTC:       0
	CRTCs:      0
	Transform:  1.000000 0.000000 0.000000
	            0.000000 1.000000 0.000000
	            0.000000 0.000000 1.000000
	           filter: 
	_MUTTER_PRESENTATION_OUTPUT: 0 
	non-desktop: 0 
		supported: 0, 1
  1920x1080 (0x522) 159.667MHz *current
        h: width  1920 start    0 end    0 total 1920 skew    0 clock  83.16KHz
        v: height 1080 start    0 end    0 total 1080           clock  77.00Hz

Looks like the panel’s edid is broken/missing. Please attach a dmesg output.
sudo dmesg >dmesg.txt

Please see dmesg output:
dmesg.txt (96.3 KB)

Please remove nomodeset kernel parameter as this disabled nouveau. The attach both outputs again.

So I removed nomodeset and now I have completely black screen on boot and even second screen is not recognized, thus can’t generate those reports. Switching to older kernel make screen freezed as below :

Ok, please reinstall the nvidia driver and download this edid file:

save it in /etc/X11 and create /etc/xorg.conf.d/nvidia-edid.conf

Section "OutputClass"
    Identifier "nvidia-edid"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "CustomEDID" "DFP-1:/etc/X11/1920x1080.bin"
EndSection

Then check if the internal screen works after reboot.

Or try this edid
1920x1080.zip (296 Bytes)
This is generated from
https://github.com/linuxhw/EDID/blob/master/Digital/AU%20Optronics/AUO52ED/42B4D974D1A6
which is most likely the panel built into your laptop model (at least I guess so).

WOW OMG it really worked!!
concerning the second bin file you suggested - it didn’t work - it actually didnt recognize my primary display at all!
I have one small request yet. I cant change refresh rate now - it is just 60 hz. before I could. is there any way to get it back ?

Which refresh rates did you have before?
Did you unzip the attached edid before moving it to /etc/X11?

I think before it was 47-49… and 60 (two options to choose incl 60)
I tried zip - I unzip and moved bin file same way as above one - it made it worse - primary display wasn’t recognized at all. I will try again to make sure

Ok, then the edid I attached is wrong, it’s for a P7xxDM2-G notebook with a 120Hz panel. Seems yours only has a 60Hz panel built in.
Unfortunately, I couldn’t find any matching edid. Difficult without knowing the exact manufacturer/model.

Should I provide more info model/manufacturer or is there a place where I can search this myself?
actually P7xxDM2-G is correct it is only 60 Hz built in

Difficult, I guess you’ll have to ask the vendor (pc specialist) which exact model they used for it. If they still know it after 8 years. And then find the edid for it.
Otherwise, you’d have to disassemble the top of your notebook to access the panel and look on the sticker.

that is no problem for me. I can do it. Just give me sometime please