Solution Update
The answer below was updated to include my solution to screen tearing, that is, vsync activation with PRIME Synchronization in a laptop with a dual GPU setting (intel integrated graphics and nvidia GPU).
The horizontal lines problem doesn't happen anymore in Ubuntu 18.04, probably due to the extinction of Unity and the comeback of GNOME.
I have a MSI GS60 2PC Ghost Pro equipped with integrated Intel Graphics and a NVIDIA GeForce GTX 860M and I have Windows 10 and Ubuntu 16.04 on dual boot. I have absolutely no problems with the graphics on Windows, but I have visible horizontal lines going down the screen and a very annoying screen tearing while playing HD videos or games on Ubuntu.
I am using NVIDIA driver version 381.09 and the same happened using the version 375.39. NVIDIA X Server doesn't seem to be helpful at all to me, since no changes can be done there. I also installed Bumblebee, but I'm not sure how to use it (should I uninstall X Server first?).
I have tried this, this, this, this and this one with no success, but I believe the last link is the one closest to be my answer.
My /etc/X11/xorg.conf is the following (after modifying it as people suggested):
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0@0:2:0"
Option "AccelMethod" "None"
Option "TearFree" "True"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1@0:0:0"
Option "ConstrainCursor" "off"
Option "TripleBuffer" "True"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration" "on"
Option "IgnoreDisplayDevices" "CRT"
EndSection
But nothing changed after that. This is really annoying and it really strains my eyes, and I think it even got worse compared to when I first installed Ubuntu on this machine. I just didn't try formatting my whole system yet, but I might do so, since I am also having problems with the wifi and bluetooth drivers (or firmwares) between the OSes.
Any suggestions? If any other outputs are necessary, just tell me and I'll edit the question.
Update: I noticed that switching to the Intel GPU on NVIDIA X Server using the xorg.conf attached to the post solved the issue, but the problem persists when using the NVIDIA GPU. I also tried increasing the refresh rate on CompizConfig Settings Manager (under Composite), but it didn't get rid of the horizontal lines moving. When I put my screen brightness to the max, I couldn't really see the lines anymore although I'm pretty sure they're still there.