# How to enable hardware acceleration in FreeBSD ?



## R6exe (Jun 17, 2020)

Hi, 
I posted before a computer which has some limited hardware.
It's specs are these.
AMD 64 Athlon 3000+.
Nvidia FX 5700 256MB.
512MB RAM DDR x2 = 1024MB.
I have installed on it FreeBSD 12.1 RELEASE-p6 GENERIC i386 with the LXDE Desktop.
When the LXDE desktop wants to use a screensaver which has 3D images, the CPU starts using a lot of it's resources, and even the 3D images goes like slow xd. 
I think this is a hardware acceleration problem, and I would like some help to be able to fix this if it's possible.
When I do a dmesg | grep agp, appears this.
agp0: <NVIDIA nForce3-250 AGP Controller> on hostb0.
Doing a cat /var/log/Xorg.0.log | grep "Direct Rendering" doesn't give me anything.
Thank you for your possible help, at least I would like to not stress a lot the CPU when using some graphical 3d application.
Cheers.


----------



## SirDice (Jun 17, 2020)

Install the x11/nvidia-driver (you may need to  lookup the version you need). The standard, generic scfb(4) or vesa(4) drivers have no acceleration at all.


----------



## shkhln (Jun 17, 2020)

FX is dead. Anything below 8 series is out of support.


----------



## R6exe (Jun 17, 2020)

SirDice said:


> Install the x11/nvidia-driver (you may need to  lookup the version you need). The standard, generic scfb(4) or vesa(4) drivers have no acceleration at all.


Thank you for your answer SirDice, but unfortunately the drivers that are nowadays in the ports are just for AMD64.
But thank you anyway.


----------



## R6exe (Jun 17, 2020)

shkhln said:


> FX is dead. Anything below 8 series is out of support.


Damn, well, what do you thing should I do shkln ?
 I mean really, when I move a window the CPU just gets higher until 100% of usage.
Do you thing maybe Linux hardware support could fix this ?
Regards.


----------



## shkhln (Jun 17, 2020)

Well, the question is: what are you doing with not quite retro, yet already long obsolete desktop machine?


----------



## SirDice (Jun 17, 2020)

Yeah, you probably need one of the older legacy  drivers, x11/nvidia-driver-390, x11/nvidia-driver-340 or even x11/nvidia-driver-304.


----------



## shkhln (Jun 17, 2020)

304 is not supported by Nvidia and was broken by the last Xorg update. Strictly speaking, 340 is out of support as well, however it still works. With 8 series cards, that is.


----------



## SirDice (Jun 17, 2020)

shkhln said:


> 304 is unsupported and broken by the last Xorg update.


Didn't know it was broken. It's not marked as such though. That's a shame, nobody will fix it in any case,  so I suspect it will be removed some time soon.


----------



## shkhln (Jun 17, 2020)

I think FX was dropped even before that. It's _really_ old.


----------



## SirDice (Jun 17, 2020)

It's going to be difficult finding a replacement card, there are very few AGP cards nowadays. You may need to find a second hand on eBay.


----------



## shkhln (Jun 17, 2020)

SirDice said:


> Didn't know it was broken. It's not marked as such though. That's a shame, nobody will fix it in any case,  so I suspect it will be removed some time soon.



See PR 244421, for example. The elephant in the room is that those fixed-function pipeline video cards are useless for modern desktop — they aren't just weak, they are completely at odds with current graphics programming practices.


----------



## SirDice (Jun 17, 2020)

These things happen. As you said in another thread a while back, we're not a museum. So old stuff eventually breaks and gets removed.


----------



## R6exe (Jun 17, 2020)

Then should I use another OS ? Like XP again ?
I'm trying to use these old computers as servers for my own projects that I have.
They are just machines with some Java code as back-end.
I would like to use the GUI instead of CLI because it helps me work more faster.
Using Windows XP leaves me with security holes and incompatible software, which doesn't help too much, even if the machine has the hardware requirements.
Then I thought maybe installing Linux would be a good idea, but I didn't decide to do that because Linux is dropping support for i386.
And then I found FreeBSD and like it, but unfortunately I found these problems related with the GUI.
At least what I would like to do is to not get the processor so high, when moving the windows and all that stuff.  Maybe installing a reverse-engineering Linux  driver of that graphics card could help ? Or Installing a Linux distribution ? 
I just would like to use a UNIX platform and not use Windows, but if that's the only way I can go to get things working I think I don't have another option.
Regards.


----------



## SirDice (Jun 17, 2020)

R6exe said:


> I'm trying to use these old computers as servers for my own projects that I have.


Servers don't need a working graphics card.



R6exe said:


> but I didn't decide to do that because Linux is dropping support for i386.


As 32 bit is still quite prevalent in embedded systems I highly doubt this. Your favorite distribution might drop support for 32 bit but that's not the same as Linux dropping support.


----------



## R6exe (Jun 17, 2020)

SirDice said:


> Servers don't need a working graphics card.
> 
> 
> As 32 bit is still quite prevalent in embedded systems I highly doubt this. Your favorite distribution might drop support for 32 bit but that's not the same as Linux dropping support.


I'm not an expert on servers, but I think that for example if I access into the Window Manager to make some changes in GUI mode, and the service is still running, isn't gonna get the service more slow because of the CPU using it's resources for the display while I'm doing the changes ? Isn't it more better to use the resources of the graphics card for the display of the Window manager or desktop ?
Thank you.


----------



## SirDice (Jun 17, 2020)

R6exe said:


> I'm not an expert on servers, but I think that for example if I access into the Window Manager to make some changes in GUI mode, and the service is still running, isn't gonna get the service more slow because of the CPU using it's resources for the display while I'm doing the changes ?


Look into remote X if you really want to use a GUI with some application(s). With remote  X there's no need to run anything graphical on the server itself (and thus doesn't require a working graphics card).


----------



## R6exe (Jun 17, 2020)

SirDice said:


> Look into remote X if you really want to use a GUI with some application(s). With remote  X there's no need to run anything graphical on the server itself (and thus doesn't require a working graphics card).


Thank you SirDice.
Which service are you talking about ? XRDP ? VNC ?


----------



## SirDice (Jun 17, 2020)

Search for "X forwarding". All you need is an SSH connection (with X forwarding turned on)  and a locally running X-server. 









						X11 Forwarding Tutorial
					

Does anyone Have a walkthrough On how to use/setup X11Forwarding?  I've been doing a little searching and the best thing I can find is this: http://w140.com/kurt/xauth.html  I don't understand what he means when he says in the jail? I've tried a couple different options and other pages but...




					forums.freebsd.org


----------



## kpedersen (Jun 17, 2020)

If your machine is for learning rather than production (that old NVIDIA card suggests it isn't production), rather than switching to Linux (Nouveau open-source driver) or switching to Windows, I would be tempted to suggest use an old build of FreeBSD (and relating packages and ports snapshot) from a time when the FX series was current (i.e 9.x). However just be aware that asking questions about old versions of FreeBSD is a little out of scope for these forums.

Otherwise, yeah Windows XP and the most recent version of VMware (or VirtualBox) you can find will probably get best results.
The llvmpipe based software renderer will even provide fairly decent 3D performance in a VM if your CPU is reasonable.


----------



## R6exe (Jun 17, 2020)

kpedersen said:


> If your machine is for learning rather than production (that old NVIDIA card suggests it isn't production), rather than switching to Linux (Nouveau open-source driver) or switching to Windows, I would be tempted to suggest use an old build of FreeBSD (and relating packages and ports snapshot) from a time when the FX series was current (i.e 9.x). However just be aware that asking questions about old versions of FreeBSD is a little out of scope for these forums.
> 
> Otherwise, yeah Windows XP and the most recent version of VMware (or VirtualBox) you can find will probably get best results.
> The llvmpipe based software renderer will even provide fairly decent 3D performance in a VM if your CPU is reasonable.



Yeah maybe that's a good answer kpedersen, thank you.
The only problem here is that VirtualBox or VMware most recent versions I think they are not supported by XP, and for sure those old versions could have vulnerabilities to the host, I mean maybe thanks to a buffer overflow or whatever.
Another problem is performance, I think that machine is able to virtualize, but I think in my opinion the performance it's gonna decrease like 30 % - 20 %.
Nouveau driver ? Is that compatible with FreeBSD ? I saw in the FreeBSD documentation that even some Linux executables work more better under FreeBSD, do you think that "Nouveau" driver could work under FreeBsd  ?
Thank you, regards.


----------



## shkhln (Jun 18, 2020)

kpedersen said:


> The llvmpipe based software renderer will even provide fairly decent 3D performance in a VM if your CPU is reasonable.



The software renderer about which OP was complaining in the first post should already be llvmpipe.


----------



## kpedersen (Jun 18, 2020)

R6exe said:


> Nouveau driver ? Is that compatible with FreeBSD ?



Nouveau is currently Linux only.




R6exe said:


> The only problem here is that VirtualBox or VMware most recent versions I think they are not supported by XP, and for sure those old versions could have vulnerabilities to the host, I mean maybe thanks to a buffer overflow or whatever.



If you keep your XP host offline (i.e disable TCP/IP, give it an invalid IP etc) and only allow the bridged VM through then that gets past the issue of Windows being vulnerable (not just XP, I wouldn't trust any recent version either).

As for VirtualBox / VMware having vulnerabilities, see here:





						Oracle Vm Virtualbox : List of security vulnerabilities
					

Security vulnerabilities of Oracle Vm Virtualbox : List of all related CVE security vulnerabilities. 			CVSS Scores, vulnerability details and links to full CVE details and references.



					www.cvedetails.com
				



I would say though that most (if not all of them) require local access to the machine. If you block all ports other than i.e 80, I doubt any of them could be exploited.



shkhln said:


> The software renderer about which OP was complaining in the first post should already be llvmpipe.



I was thinking that it was because of using the vesa or nv driver. For example if you run glxgears with LIBGL_ALWAYS_SOFTWARE=1 it runs fairly well when using i.e the intel or nvidia blob but still terribly with vesa. Mostly because the image gets generated but actually pushing that to the physical screen is slow. So we need to get around that.

There is the vmware GPU driver (x11-drivers/xf86-video-vmware) that should push the pixels OK. Otherwise yeah we may have to fall back to SirDice's suggestion of remote rendering.

If you use TigerVNC on the VM you will possibly get better results because as mentioned before, even though the llvmpipe renderer might be generating the image quickly the cost is often in the vesa driver actually displaying the pixels on screen (especially with larger resolutions). If you use another host (with actual GPU drivers) to do that instead (i.e the vncviewer) you can save some processing.

For some things X11 forwarding is better but for recent software these days, they all deal with images anyway which kills a lot of the benefits of a network aware protocol.


----------



## shkhln (Jun 18, 2020)

It's a roughly 2004-2005 machine with a CPU without virtualization extensions, only 1 Gb of RAM and an effectively not upgradeable video card. I don't see the point in these workarounds. No amount of effort would make the desktop experience here less horrible.

The only sensible options are:

treat this as a retro PC by installing old software and isolating it from the Internet; good for old games and maybe word processing or something.
install up-to-date Linux/*BSD there (with or without very lightweight GUI) to _occasionally_ run a specific single non-demanding task; for a 24/7 home server buying a motherboard with an integrated Atom processor would be a far better decision.


----------



## R6exe (Jun 18, 2020)

kpedersen said:


> If you keep your XP host offline (i.e disable TCP/IP, give it an invalid IP etc) and only allow the bridged VM through then that gets past the issue of Windows being vulnerable (not just XP, I wouldn't trust any recent version either).


Wow that's really smart, having no Ip address asigned to XP and with bridged adapter in the virtual machine really sounds to work. 
The only problem that I see here is the performance and the Java jdk. 
I think XP just supports jdk7. 
And I dont know if the virtual machine could support the X11 with LXDE on that machine. 
I've another machine that has the same problem as the Nvidia one, but this one has an ati 9200, do you thing there would be a driver for this one as it is from ati ? 
Thank you so much. Regards.


----------



## R6exe (Jun 18, 2020)

shkhln said:


> It's a roughly 2004-2005 machine with a CPU without virtualization extensions, only 1 Gb of RAM and an effectively not upgradeable video card. I don't see the point in these workarounds. No amount of effort would make the desktop experience here less horrible.
> 
> The only sensible options are:
> 
> ...


Heheh
Belive me I've a netbook with an atom and that thing runs very slow. I think even more slow than the amd 3000+.


----------



## shkhln (Jun 18, 2020)

I don't have to believe: https://cpu.userbenchmark.com/Compare/Intel-Pentium-N4200-vs-AMD-Athlon-64-3000-/m196248vsm5460. It also comes with a better GPU. Anyway, you don't need much performance for a home server, it's mostly about power consumption and noise.


----------



## R6exe (Jun 18, 2020)

shkhln said:


> I don't have to believe: https://cpu.userbenchmark.com/Compare/Intel-Pentium-N4200-vs-AMD-Athlon-64-3000-/m196248vsm5460. It also comes with a far better GPU. Anyway, you don't need much performance for a home server, it's mostly about power consumption and noise.





			UserBenchmark: AMD Athlon 64 3000+ vs Intel Atom N2600
		

That's the atom I have on my notebook.


----------



## kpedersen (Jun 18, 2020)

Ah forgot to add to my post. You can probably save yourself a heap of trouble and still salvage much of the machine by just ditching the nvidia card and purchasing an older radeon for ~$10. Then you can even use it as a workstation.

I have a similar spec machine and to be fair, personally I don't actually need much more power. Since the recent performance improvements that Firefox has gone through, it is even good for web browsing. It will run games up to about Quake III perfectly well.


----------



## R6exe (Jun 18, 2020)

kpedersen said:


> Ah forgot to add to my post. You can probably save yourself a heap of trouble and still salvage much of the machine by just ditching the nvidia card and purchasing an older radeon for ~$10. Then you can even use it as a workstation.
> 
> I have a similar spec machine and to be fair, personally I don't actually need much more power. Since the recent performance improvements that Firefox has gone through, it is even good for web browsing. It will run games up to about Quake III perfectly well.





			NVIDIA DRIVERS FreeBSD Display Driver – x86
		

That driver could work ? Thanks.


----------



## kpedersen (Jun 19, 2020)

R6exe said:


> NVIDIA DRIVERS FreeBSD Display Driver – x86
> 
> 
> That driver could work ? Thanks.



Not with a recent operating system.
The problem is that Nvidia do not maintain their drivers to work with current operating systems. For example the latest Xorg xserver cannot communicate with a driver designed for an older ABI.

Ideally you want to get yourself some hardware where an open-source driver exists so it is part of the FreeBSD / xorg source tree and gets maintained properly.


----------



## shkhln (Jun 19, 2020)

kpedersen said:


> The problem is that Nvidia do not maintain their drivers to work with current operating systems.



This is silly. Out of the three major GPU vendors Nvidia has the longest attention span at roughly 10 years of support.



kpedersen said:


> Ideally you want to get yourself some hardware where an open-source driver exists so it is part of the FreeBSD / xorg source tree and gets maintained properly.



Open source doesn't necessarily mean any commitment to maintenance.


----------



## kpedersen (Jun 19, 2020)

shkhln said:


> This is silly. Out of the three major GPU vendors Nvidia has the longest attention span at roughly 10 years of support.



And yet hardware from other vendors doesn't have this problem even when they get to a similar age.
This shows that a companies promise to maintain the drivers is simply not good enough. Source is the only real solution here.



shkhln said:


> Open source doesn't necessarily mean any commitment to maintenance.



Nope, but it heavily implies that the community will.


----------



## SirDice (Jun 19, 2020)

kpedersen said:


> Nope, but it heavily implies that the community will.


No, you _assume_ the community will. Old drivers for old hardware get dropped all the time. At some point the old hardware deviates too much from the newer hardware. Then the driver has to do a "split" between those two directions. And the sensible thing to do, from a maintenance perspective, is to drop the old stuff. Especially when you have to bend over sideways in order to keep that old stuff working.


----------



## kpedersen (Jun 19, 2020)

SirDice said:


> No, you _assume_ the community will.



Well I certainly can't assume that it won't.



SirDice said:


> Old drivers for old hardware get dropped all the time.



Yes, old as in many decades. Not something like a GeForce 5 series (a ~17 year old spring chicken!). You surely cannot deny that open-source drivers provide a far superior lifespan to binary blobs.


----------



## shkhln (Jun 19, 2020)

Ahem, https://freebsd.markmail.org/thread...ry:+page:1+mid:enoto7ksxqne72rs+state:results.


----------



## kpedersen (Jun 19, 2020)

shkhln said:


> Ahem, https://freebsd.markmail.org/thread...ry:+page:1+mid:enoto7ksxqne72rs+state:results.



But that last patch is looking to keep the old ati driver compiling. Yes it may not work (and from the looks of it there is no-one interested to test it) but that is a far better situation than i.e the last ATI Windows driver. What would that be for? Windows 95? The proprietary fglrx driver certainly hasn't fared any better (that thing barely worked even when it was supported)

Another example is the old xf86-video-savage driver. I certainly don't see a binary blob outliving that being maintained by S3

When it comes to lifespan and bringing life back to old tech, there really is no support other than from the community, enabled by source access.


----------



## dave01 (Jun 25, 2020)

Nvidia Legacy drivers might be what you are looking for.   

You need the 173.14 driver to support an FX 5700 card on x86.  Whether that will work with a current release of FreeBSD is another matter.   ISTR there is a page somewhere on the NVidia site showing how to install the drivers manually.


----------

