How can I get 4k @ 60Hz at 4:2:0 working in Ubuntu 16.04?

I was having a similar problem with an LG 4k TV, but it turns out that I had to enable the option "HDMI ULTRA HD Deep Colour" on the tv to make it work.


For any of you facing a similar issue, a workaround has been found until nvidia releases their next driver and it works its way into repos.
With this workaround, you will lose the option to display 1080p at 120Hz.

First, please see:
https://devtalk.nvidia.com/default/topic/939971/linux/4k-60hz-works-in-windows-not-in-linux-workaround-found-/post/4959257/#4959257

Download the edid from that post. Note where you store it.

Note: It is possible to break your display manager if this is done incorrectly, or if your monitor isn't the same as mine. Be ready to start in recovery to remove this next file we create to reverse the issue.

If you are on 16.04 like myself, there is no xorg.conf file and if you make one, it has a mind to vanish with every system update. Instead, navigate to:

cd /usr/share/X11/xorg.conf.d

Next, create a new file here. It's important that you use superuser permissions. Personally, I just sudo gedit, others tell me I'm bad for it.

sudo gedit 50-nvidia.conf

Paste the following into it:
If you do not have a Vizio M43-C1, please create your own xorg settings through the nvidia control panel and add the last Option to yours. You only need the Monitor section. I will bold what you need to add.

#Not First Line
Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "VIZ M43-C1"
    HorizSync       15.0 - 140.0
    VertRefresh     25.0 - 76.0
    Option         "DPMS"
    Option         "CustomEDID" "HDMI-0:/path/to/edid.txt"
EndSection
#Not Last Line

Option "CustomEDID" "HDMI-0:/path/to/edid.txt"
This is the workaround.

Note that HDMI-0 needs to be replaced with your current display.
To find yours, run:

xrandr

From the output, find the one that says connected. For example,

HDMI-0 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm

Shows my display is HDMI-0, so this is what I use in my 50-nvidia.conf.

After you're done, simply reboot. If all done correctly, you should be able to login normally and set 4k @60Hz 4:2:0 with no problem.

Again, this is just a workaround. Hopefully no one will ever need to do this in a few months when the new driver is released.