Re: can't get NVIDIA driver working SOLVED

From: Graham Menhennitt <graham_at_menhennitt.com.au>
Date: Wed, 15 Jun 2022 09:58:41 UTC
On 12/6/22 01:30, Pete Wright wrote:
> On Fri, Jun 10, 2022 at 03:36:03PM +1000, Graham Menhennitt wrote:
>> Hello FreeBSD-X11 people,
>>
>> I've just installed 13.1-Release on an AMD-64 machine with an GeForce GT545
>> card. Xorg starts ok but it it doesn't seem to recognise the NVIDIA driver
>> and so I only get VGA resolution. I'd like some help getting the higher
>> resolution and acceleration from the driver, please.
>>
>> After a basic FreeBSD installation, I've done:
>>
>>      pkg install xorg kde5 sddm nvidia-driver-390
>>
>> In rc.conf, I loaded the nvidia driver and started sddm. I then rebooted.
>> The system comes up and starts sddm but at only 1024 x 768 resolution.
>>
>> See below for the output from nvidia-debugdump, nvidia-smi, kldstat. Also,
>> the relevant sections from rc.conf and the contents of /var/log/Xorg.0.log.
>
> a couple things that may be worth testing:
>
> 1. do you get the same results when loading the "nvidia-modeset" vs "nvidia"
> 2. what does "pciconf -lv" report the PCI id for your nvidia device as?  for
>     example here is how it is reporting on one of my systems:
>
> vgapci1@pci0:60:0:0:	class=0x030200 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1d34 subvendor=0x17aa subdevice=0x22a2
>      vendor     = 'NVIDIA Corporation'
>      device     = 'GP108GLM [Quadro P520]'
>      class      = display
>      subclass   = 3D
>
>     note this is one of those weird optimus hybrid GPU systems, but pciconf
>     should point you to the correct device.
>
> 3. do you have the same issues when using the newer 470 or 510 nvidia drivers?
>
>
> I think ideally Xorg should correctly auto-detect your device so no configs
> will be needed to get you working, but hopefully some of these debug steps
> will help.
>
> -pete
>
Thanks very much for replying, Pete.

I finally got it working with two of your hints.

Yes, I need nvidia-modeset rather than just nvidia. And I do need the 
390 version of the driver for my card.

As I suspected, the second problem was the two video cards (one on the 
motherboard and on the PCI bus). Running "pciconf -lv |grep -B3 display" 
gives:

vgapci0@pci0:16:0:0:    class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de 
device=0x1243 subvendor=0x1462 subdevice=0x2315
    vendor     = 'NVIDIA Corporation'
    device     = 'GF116 [GeForce GT 545]'
    class      = display
-- 
vgapci1@pci0:48:0:0:    class=0x030000 rev=0xc9 hdr=0x00 vendor=0x1002 
device=0x1638 subvendor=0x1002 subdevice=0x1636
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Cezanne'
    class      = display

So I added the following to 
/usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf to force it to use the 
Nvidia card:

Section "Device"

         Identifier "Card0"

         Driver     "nvidia"

         BusID    "PCI:16:0:0"

EndSection


And it all works!

Thanks again for your help.

Graham