PDA

View Full Version : [SOLVED] Ubuntu 20.04 on MacBook Pro 5,4: Screen flickering with Nvidia-340 driver



scorp123
August 28th, 2020, 08:20 PM
Posting this here in the hopes that it might prove useful to someone, e.g. if you stumble over this via a Google search.

So I have an old MacBook Pro 5,4 that is in perfect shape hardware-wise (e.g. I upgraded it to 8 GB RAM and I replaced the disk with an 1 TB SSD; the laptop feels and performs as if it were fresh from the factory) ... and Apple does no longer support it, it is not possible to install "vanilla" macOS on this machine. I've used Ubuntu on this laptop in the past (e.g. Ubuntu 16.04 and 18.04) so I assumed that Ubuntu 20.04 would also work without problems...

But no, it does not :(

The open source "nouveau" graphics driver does select the correct refresh rate, frequency and the correct resolution ... but the performance is rather "meh". :mad: ... So I decided to use the "Software" settings and install the proprietary Nvidia-340 driver that is suggested for my ancient graphics card (Nvidia GeForce 9400M).

The installation works without problems but upon reboot I can see that the bottom ~20 pixels flicker like mad. It's as if it's 1982 again and you're sitting in front of a Commodore C64 that is connected over a flaky cable to a bad old TV. :shock:

I've found threads from other Linux distributions that describe the same problem there, but nothing specific to Ubuntu 20.04 and my exact setup. :sad:

What helped me in the end was this thread from "Elementary OS":
https://github.com/elementary/gala/issues/161

If you have the same issue with your ancient Nvidia-based graphics card in your old Mac, try setting the "Underscan" option to 1 or 2. This causes the Nvidia driver to switch into a meta-mode of 1438 x 898 instead of the 1440 x 900 the screen actually has. Whatever this really does ... the flickering stops and everything looks clean again like it did with previous Ubuntu versions. \\:D/

Screenshot:
https://user-images.githubusercontent.com/51542239/75643300-2fcfe600-5c04-11ea-8b18-d18c17493527.png

My /etc/X11/xorg.conf file thus looks like this:



# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 440.82

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Apple"
HorizSync 30.0 - 75.0
VertRefresh 59.9
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 9400M"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "metamodes" "nvidia-auto-select +0+0 {viewportout=1438x898+1+0}"
Option "SLI" "Off"
Option "MultiGPU" "Off"
Option "BaseMosaic" "off"
SubSection "Display"
Depth 24
EndSubSection
EndSection


I hope that whoever runs into the same issue and is forced to google for a solution to this may find this useful.

Good luck ):P

soloneff
February 25th, 2021, 09:13 AM
This solution also works with Elementary OS.

Thank you!