# problems with LibGL "failed loading driver"



## ColdfireMC (Oct 8, 2014)

i have problems with all programs that use graphics/libGL 

in example, the emulators/mame output
`$mame cninja`

```
Invalid video value default; reverting to software
Invalid prescale option, reverting to '1'
libGL error: failed to load driver: r600
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
sound_init: option 1 not found switching to auto
Average speed: 99.98% (368 seconds)
Speaker ":mono" - max = 40283 (gain *= 0.813420) - 0% samples clipped
3657335 tagmap lookups
```

my OS version
`$ uname -a`

```
FreeBSD casav 10.0-STABLE FreeBSD 10.0-STABLE #0 r270258: Thu Aug 21 01:43:05 CLT 2014     root@casav:/usr/obj/usr/src/sys/GENERIC  amd64
```

i don't know if /etc/X11/xorg.confwill be useful, but here it is


```
Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
                Option  "AutoAddDevices"        "Off"
EndSection

Section "Files"
        ModulePath   "/usr/local/lib/xorg/modules"
        FontPath     "/usr/local/lib/X11/fonts/misc/"
        FontPath     "/usr/local/lib/X11/fonts/TTF/"
        FontPath     "/usr/local/lib/X11/fonts/OTF/"
        FontPath     "/usr/local/lib/X11/fonts/Type1/"
        FontPath     "/usr/local/lib/X11/fonts/100dpi/"
        FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
        Load    "i2c"
        Load  "dbe"
        Load  "dri"
        Load  "dri2"
        Load  "extmod"
        Load  "record"
        Load  "glx"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/sysmouse"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection



Section "Device"
        Identifier  "Card0"
        Driver      "radeon"
        BusID       "PCI:3:0:0"
EndSection

Section "Device"
        Identifier  "Card1"
        Driver      "fbdev"
        BusID       "PCI:3:0:0"
EndSection

Section "Device"
        Identifier  "Card2"
        Driver      "vesa"
        BusID       "PCI:3:0:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Viewport   0 0
                Depth     1
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     8
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     15
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     16
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection
```

thanks


----------



## radish (Oct 8, 2014)

A /etc/X11/xorg.conf is not strictly needed for most cases. If you made one without actually knowing it was needed you might try renaming it to xorg.conf.bkup and see if it fixes your driver errors. If you do need the config to have a working setup, please ignore this.

Otherwise I would suggest re-running the command with LIBGL_DEBUG=verbose in front as it mentioned. See if the verbose output sheds any light. Also, install graphics/mesa-demos and run this command to find opengl info and post the information here.

```
glxinfo | grep -i opengl
```

Thanks!


----------



## ColdfireMC (Oct 9, 2014)

radish said:
			
		

> A /etc/X11/xorg.conf is not strictly needed for most cases. If you made one without actually knowing it was needed you might try renaming it to xorg.conf.bkup and see if it fixes your driver errors. If you do need the config to have a working setup, please ignore this.
> 
> Otherwise I would suggest re-running the command with LIBGL_DEBUG=verbose in front as it mentioned. See if the verbose output sheds any light. Also, install graphics/mesa-demos and run this command to find opengl info and post the information here.
> 
> ...



Done, output is 
`$ glxdemo`

```
libGL: OpenDriver: trying /usr/local/lib/dri/r600_dri.so
libGL error: failed to open drm device: Permission denied
libGL error: failed to load driver: r600
libGL: OpenDriver: trying /usr/local/lib/dri/swrast_dri.so
libGL: Can't open configuration file /home/Coldfire/.drirc: No such file or directory.
```

i don't own video? How I can own it?


----------



## ColdfireMC (Oct 9, 2014)

I partially(?) fixed the problem. Made `#chmod 777 /dev/dri/card0` and now I, and everybody I think, have permission to use /dev/dri/card0. That boosted overall video performance.

Thanks for the 
	
	



```
LIBGL_DEBUG=verbose
```
 advice  :e


----------



## Grenouille (Oct 28, 2016)

Hello !

I have a similar problem.
Running `# chmod 777 /dev/dri/card0` works fine, but after reboot it doesn't work anymore so I have to run it again.
What should I do ?
Why isn't a normal user allowed to run the driver by default ?


----------



## ASX (Oct 28, 2016)

Grenouille said:


> I have a similar problem.
> Running  # chmod 777 /dev/dri/card0 works fine, but after reboot it doesn't work anymore so I have to run it again.
> What should I do ?



You should add your user to the wheel or video groups.

https://www.freebsd.org/doc/handbook/x-config.html


----------



## Grenouille (Oct 28, 2016)

It is already in wheel. So should I add it to video ?


----------



## ASX (Oct 28, 2016)

If you are running 11.x I think yes, you should add your user to video group.


----------



## Grenouille (Oct 28, 2016)

Thanks, I did it and it works fine now


----------

