# Nvidia driver causes Xorg lockups and strange issues with flash video.



## torcod (Aug 21, 2011)

About two days ago I finally updated my nvidia driver to 270.41.19.

This caused the following problems:

When viewing a webpage that contains a flash object, if I scroll the page down with the object still running the object will leave the application. As a example the browser will still be running only the flash object will be visible above the web browser on the root window of the desktop.

Also if a browser tab is closed with a flash object running on that tab there is about a 33% chance of it locking up the entire X server.

After lots of searching I found that similar issues were happening if WITHOUT_NOUVEAU wasn't defined in /etc/make.conf. I defined that and rebuilt all of the packages that depended on Xorg/dri/nvidia-driver/etc this did not fix any issues though.

I also modified the port to try the latest driver version (280) from nvidia's site but that did not help either.

A downgrade to 256.x.x does make the problem go away however that also breaks all forms of GPU decoding. (vdpau, flash on gpu etc)

Does anyone have any ideas? Some snippets from log files are below.

I'm running FreeBSD 8.2 on amd64. The card is a nvidia 9800gtx+.

Right as the X server becomes unresponsive these messages show up in /var/log/Xorg.log


```
[mi] EQ overflowing. The server is probably stuck in an infinite loop.
[mi] EQ overflowing. The server is probably stuck in an infinite loop.
```

Whenever a flash object "leaves" a window these lines appear in /var/log/messages


```
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 0000080c 20000000 00000004 00000084
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000810 000c00e0 00000004 00000084
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000280 00000280 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000284 00040100 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000288 00000001 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 0000028c 00080104 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000290 00000000 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000294 00ffffff 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 00000298 00040080 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 0000029c 00000000 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002a0 000400c0 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002a4 b0ef1029 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002a8 000c0088 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002ac 00000b1d 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002b0 00000b1e 00000003 00000000
Aug 21 14:08:01 m5 kernel: NVRM: Xid (0000:02:00): 56, CMDre 00000003 000002b4 00000000 00000003 00000000
```


----------



## falkman (Aug 22, 2011)

I've had similar issues with FreeBSD-9.0 built with clang, I haven't used BSD for a while now, so I'm not sure if I still have the issue. I'll check it out on Wednesday and try to find a fix.

Did you ever find a way to replicate it easily? It seemed fairly random for me, which would make testing very hard.


----------



## torcod (Aug 22, 2011)

For me it's simple to replicate. I have all of my packages up to date (at least as of 8/21/) and the problem can be triggered with all browsers that I've tested (firefox, chrome, opera) So I'm assuming it is definitely a issue with either the driver or some Xorg package that I may have built improperly.

So that's not to helpful I guess....

If you have problems testing it and need any help just reply back to this thread and I can run some things on my system to see.


----------



## falkman (Aug 22, 2011)

I'll check it out on Wednesday. I should be able to replicate it quick enough to check it out. Are you having issues where flash videos/programs leak through into other tabs too? Since I build FreeBSD head with clang, it's very hard for me to differ a clang bug from a true bug in the code. Clearly this NVIDIA issue is probably Xorg or the NVIDIA driver.

-- Anyone out there with a different GPU who can confirm this is a NVIDIA only bug? I guess that wouldn't tell us for sure that it's not Xorg, but I doubt NVIDIA does much testing with stuff like flash.


----------



## dh (Aug 22, 2011)

I'm also experiencing similar problems - flash video appearing in xterm windows, browser freezing upon focus, xorg lockups. I'm using also nvidia driver 270.41.19 (on FreeBSD 8.2-RC3).
It doesn't happen always, but in 2 times out of 3 with youtube videos for example and following message is logged to Xorg.0.log:

```
nvLock: client timed out, taking the lock
```


----------



## falkman (Aug 22, 2011)

@dh: Is that all you have logged? Do you get the issue where it talks about an infinite loop?

I'm going to try to compose something to send off to NVIDIA if I can find a fix.


----------



## dh (Aug 22, 2011)

falkman said:
			
		

> @dh: Is that all you haev logged? Do you get the issue where it talks about an infinite loop?



I restarted Xorg with -logverbose 10 and now I do get infinite loop message too.


----------



## rabfulton (Aug 23, 2011)

I get the same issues.

nvidia 8600, freebsd 8.2 with latest flash and nvidia driver.


```
[mi] EQ overflowing. The server is probably stuck in an infinite loop.
```

I also get bleed through to other apps/tabs when playing flash videos.


----------



## windscape (Aug 23, 2011)

Hi All,

I have a NVIDIA GeForce 210 in my FreeBSD 8.2-STABLE amd64 PC and had the same strange flash issues, in both FreeBSD and Arch Linux with both Firefox and Google Chrome. I resolved it by right-clicking on a flash video and opening the settings page. There, in the first tab was an option called something like "Enable video hardware acceleration". Once that was unchecked (disabled), the settings saved, and the page refreshed or the browser re-opened (can't remember quite what it was and am at work currently), then the "flash bleed through" issue was resolved.

I haven't had any Xorg lockups yet on 270.14.19 *knocks on wood*

I hope this helps someone.


----------



## windscape (Aug 23, 2011)

windscape said:
			
		

> I haven't had any Xorg lockups yet on 270.14.19 *knocks on wood*



When I typed 270.14.19, I actually meant the current 270 driver, 270.41.19. I can't figure out how to edit my own posts yet. Perhaps I need to post more before I can do that.


----------



## dh (Aug 24, 2011)

Thanks windscape, disabling hw acceleration is a good enough workaround for now.


----------



## vertexSymphony (Aug 26, 2011)

I don't know if this is related, but I'll report it if anyone is having the same issues...
Recently I compiled a newer revision of -CURRENT and suddenly everything froze every time I saw a flash video ... the culprit ? 

Well, basically the prototype of fget changed (apparently, from 3 args to 4), something which is used by nvidia_linux.c
I'm terribly noob when it comes to FreeBSD sources, so, forgive me if I make a mistake, but these 3 commits seems to be the offenders:

https://github.com/freebsd/freebsd-...0d1a902c43f1e6b09b6def8da55ef2#sys/sys/file.h
https://github.com/freebsd/freebsd-...b5461a1fdde0e8547637880d41f381#sys/sys/file.h
https://github.com/freebsd/freebsd-head/commit/a644c5f1fbc512af7f005c8f71f5a4a95448e0d2#L50R179 <-

If I would compiled the driver after the update, compilation should fail, but as I didn't ... flash tried to use that codepath (naturally, flash is run through that) and you can imagine the rest of the story.
Â¿Solution? disable Linux support & re-install x11/nvidia-driver, or add the needed capability (maybe CAP_IOCTL?).

Cheers.


----------



## torcod (Aug 27, 2011)

vertexSymphony said:
			
		

> I don't know if this is related, but I'll report it if anyone is having the same issues...
> Recently I compiled a newer revision of -CURRENT and suddenly everything froze every time I saw a flash video ... the culprit ?
> 
> Well, basically the prototype of fget changed (apparently, from 3 args to 4), something which is used by nvidia_linux.c
> ...



Removing the linux emulation support fixed it.

Thanks!


----------



## dh (Aug 29, 2011)

FYI: Without linux support in nvidia-driver MineCraft client doesn't work.


----------



## vertexSymphony (Aug 30, 2011)

In my case, I play Heroes of Newerth, so I need acceleration ... I solved it this way :


```
cd /usr/ports/x11/nvidia-driver
make config # enable linux support
make extract
ee ./work/NVIDIA*/src/nvidia_linux.c # or your favorite editor
```

Then I add this at the top of the file (with the other headers):


```
#include <sys/capability.h>
```

and, lower in the file, I change this:


```
if ((error = fget(td, args->fd, &fp)) != 0)
```

to this :


```
if ((error = fget(td, args->fd, CAP_IOCTL, &fp)) != 0)
```

Then you can do the normal make [deinstall/install/clean] stuff.
If you need more help, tell me ...

Cheers.


----------



## om (Aug 31, 2011)

```
#include <sys/capability.h>
```
 doesn't work for me

I did your two fixes in ./work/NVIDIA*/src/nvidia_linux.c and get this:


```
[root@ /usr/ports/x11/nvidia-driver]# make install clean

nvidia_linux.c:11:28: error: sys/capability.h: No such file or directory
*** Error code 1

Stop in /usr/ports/x11/nvidia-driver/work/NVIDIA-FreeBSD-x86_64-270.41.19/src.
*** Error code 1
```

Please post a fix. Thanks [:


----------



## om (Sep 25, 2011)

Well I can't figure out how to fix this and it's ridiculously annoying. I can't be the only one experiencing this problem...


----------

