Finally got it to work. I added the working xorg.conf for nvidia prime as an attachment. Maybe it will help someone else too. Please tell me if you see anything in it that shouldn't be there. Thanks to all who helped me with this.
-- Linux-gentoo-x86_64-Intel-R-_Core-TM-_i5-7400_CPU_@_3.00GHzCOMMON_FLAGS="-O3 -pipe -march=native -ftree-vectorize -ffast-math -funswitch-loops -fuse-linker-plugin -flto -fdevirtualize-at-ltrans -fno-plt -fno-semantic-interposition -fno-common -falign-functions=32 -fgraphite-identity -floop-nest-optimize"
USE="-* git verify-sig rsync-verify man alsa X grub ssl ipv6 lto libressl olde-gentoo asm native-symlinks threads jit jumbo-build minimal strip system-man"
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /lib/udev /usr/share/icons /usr/share/applications /usr/share/gtk-3.0/emoji"
# nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 525.147.05 Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" Screen 0 "Screen1" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "Files" EndSection Section "InputDevice" # generated from default Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/input/mice" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" # generated from default Identifier "Keyboard0" Driver "kbd" EndSection Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" Option "DPMS" EndSection Section "Device" Identifier "Device0" Driver "modesetting" VendorName "NVIDIA Corporation" ChipId 0x0 ChipRev 0x0 IRQ 0 EndSection Section "Device" Identifier "Device1" Driver "nvidia" VendorName "NVIDIA Corporation" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection Option "metamodes" "1920x1080 +0+0 {ForceCompositionPipeline=On}" EndSection Section "Screen" Identifier "Screen1" Device "Device1" Monitor "Monitor0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection Option "metamodes" "1920x1080 +0+0 {ForceCompositionPipeline=On}" EndSection