# Startup vs. terminal Xorg



## crbenesch (Sep 3, 2018)

Hi guys and gals,

Been using FreeBSD for almost a decade now, and I rarely use X on it.  However, with the setup I am running now, I want to have it display my security camera's RTSP on an HDMI port.

I'm running dual 2 core xeons (soon to upgrade to quad cores) a little light on frequency (2.3 GHz) but otherwise good little CPUs, 16 gb ram, a Radeon M220 card which is supported by the native ati driver.  I've got xorg and the right drivers and opengl / opencl installed.  I am trying to run cvlc on a spectrwm display.

When I boot up, log in and startx it all works.  7% cpu usage, which is acceptable and expected.

The problem is when I put it into rc.local to su to the cam user and start X, Xorg is using 112% CPU.

Does anyone know why X would be using so much CPU on rc.local compared to from a login terminal?  I checkced Xorg.0.log and dont see anything about missing drivers or trying ot use vesa or anything.

Stumped.


----------



## Martin Paredes (Sep 16, 2018)

What did you put in rc.local?



crbenesch said:


> Does anyone know why X would be using so much CPU on rc.local compared to from a login terminal?



Maybe it is because the process get nicer priority (it run as root).

The manual for rc(8) implies tha rc.local is going out.



> Typically, the /usr/local/etc/rc.d/ mechanism is used instead of rc.local these days but if you want to use rc.local, it is still supported.


----------



## kpedersen (Sep 16, 2018)

Is it to do with DRM? If you run just xterm from your rc.local and then execute the program do you see something like 


```
libGL error: failed to open drm device: Permission denied
```


----------



## NapoleonWils0n (Sep 16, 2018)

crbenesch said:


> Hi guys and gals,
> 
> Been using FreeBSD for almost a decade now, and I rarely use X on it.  However, with the setup I am running now, I want to have it display my security camera's RTSP on an HDMI port.
> 
> ...


HI Mate

Have you added yourself to the video group
replace username with your username


```
sudo pw usermod username -G video
```

check which groups your user is in


```
groups username
```

im in these groups
username wheel operator video

try adding yourself to the video group and then do a reboot to pick up the change
then check top again and see if the cpu usage is reduced

hope that helps


----------



## kpedersen (Sep 16, 2018)

Also, I cannot find this officially documented anywhere but for my radeon to work I needed the following in /etc/rc.conf


```
kld_list="radeonkms"
```

To load the radeonkms kernel module. Otherwise you are stuck with vesa and non accelerated rendering.


----------

