[Tutorial] [Completed] 3D graphics acceleration and OpenCL support in VMware guests

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
MikeNovember
Level 7
Level 7
Posts: 1856
Joined: Fri Feb 28, 2020 7:37 am
Location: Nice, Paris, France

[Tutorial] [Completed] 3D graphics acceleration and OpenCL support in VMware guests

Post by MikeNovember »

Hi,

This tutorial applies to: VMware Workstation Player, for Linux or for Windows (both are proprietary software, free for personal use).

It has been tested with VMware Workstation Player 16.2.1.

Prerequisite: a running installation of VMware Workstation Player on Linux or Windows host.

This tutorial will show how to enable 3D graphics acceleration and OpenCL support on the guest, Linux or Windows.

1) Host settings and prerequisites:

- Windows host prerequisite: a graphic card (GPU) or chipset supporting DirectX 9 to DirectX 12.

Update GPU drivers to their latest available revision.

Test DirectX presence with DXDIAG, it will tell if Direct X is enabled and what version is installed. Under "Display", check that acceleration is activated for Direct3D, DirectDraw and AGP.

For Windows 7, 8, and old versions of Windows 10, enable permanent hardware acceleration: Right-click the desktop and select Personalize > Screen resolution > Advanced Settings > Troubleshoot > Change settings and move the Hardware Acceleration slider to the Full position.
NB: this setting has disappeared and is no longer necessary on the latest versions of Windows 10 (tested on 21H2).

- Linux host prerequisite: The latest NVIDIA proprietary drivers are required to have 3D graphics acceleration in the guest. For Linux hosts, AMD devices are not supported
The host has a video card that supports accelerated OpenGL 2.0 if you want to use DirectX 9, or OpenGL 3.3 if you want to use DirectX 10 or DirectX 10.1, OpenGL 4.5 if you want to use DirectX 11 or DirectX 12.

Recent Vulkan driver can be used.

With your system report, check the availability of OpenGL and Nvidia GPU with its proprietary drivers:
example on my computer,
Graphics: Device-1: NVIDIA GF116M [GeForce GT 560M] vendor: ASUSTeK driver: nvidia v: 390.144
bus-ID: 01:00.0 chip-ID: 10de:1251
Device-2: IMC Networks Integrated Webcam type: USB driver: uvcvideo bus-ID: 1-1.2:4
chip-ID: 13d3:5134
Display: x11 server: X.Org 1.20.11 driver: loaded: nvidia
unloaded: fbdev,modesetting,nouveau,vesa resolution: 1920x1080~60Hz s-dpi: 128
OpenGL: renderer: GeForce GTX 560M/PCIe/SSE2 v: 4.6.0 NVIDIA 390.144 direct render: Yes
Last line means OpenGL 4.6 is available, with direct (hardware) render from the GPU GeForce GTX 560M, with NVIDIA 390.144 driver.
You can also check that direct rendering is enabled with:

Code: Select all

glxinfo | grep direct
First line output confirms direct rendering:
direct rendering: Yes
Finally you can check visually that 3D apps function by running:

Code: Select all

glxgears
If you see geared wheels running in a small window, all is OK!

2) VMware Workstation Player settings:

Launch VMware Workstation Player from your menu. Select an installed virtual guest, don't run it. On the right, click on "Edit virtual machine settings". Go to "Display", and select on the right "Accelerate 3D graphics". On the same place adjust the allocated Graphics memory: recommended value is 1GB; if you intend to run an application demanding more graphics RAM, increase this value.

Close the settings window, your virtual machine is now ready to be launched with hardware acceleration.

Note that this is a guest system level setting. Apps launched within the guest OS will use 3D graphics or not, will allow editing app settings for 3D graphics or not. See your app user manual.

Don't expect to have the same graphics performance in the guest than in the host: GPU is not used directly but through software, and it is still in use on the host.

3) Testing your guest 3D capability:

- Windows guest: same as in 1), run DXDIAG to see if DirectX is enabled and what is its version; complete it with some test program for OpenGL, such as "GPU_Caps_Viewer" downloaded from https://www.geeks3d.com/dl/show/657, and run it to check that OpenGL is activated and what is its version.

- Linux guest: same as in 1) system report (inxi), "glxinfo | grep direct" or "glxgears" commands will allow you to check that OpenGL is activated and what is its version.

An example: on my host (see signature of this message), with NVIDIA GeForce GTX 560M, OpenGL 4.6 is activated; within my Windows 10 Pro 21H2 guest, DirectX 12 and OpenGL 3.3 are activated (more precisely: OpenGL 3.3 is activated with 225 extensions, some being OpenGL 4.5 ones).

4) OpenCL support:

In the VM, GPU is simulated through software and, as a consequence, no OpenCL support can be installed for the GPU.

However, OPenCL support can be installed for the microprocessor or, for Windows 10 guest, with the OpenCL and OpenGL Compatibility Pack.

a) Linux Mint / Ubuntu / Debian guests:

Microprocessor OpenCL support can be simply done by installing libopcl2, and clinfo to check after installation:

Code: Select all

sudo apt-get install libpocl2 clinfo
Users with Intel microprocessors might prefer the use of Intel CPU Runtime for OpenCL, that can be downloaded from this page (free registration needed): https://www.intel.com/content/www/us/en ... rview.html
(choose Linux version)

b) Windows guests:

Intel provides a CPU runtime for its microprocessors, while AMD has dropped support for its OpenCL SDK, leaving its microprocessors without any OpenCL support.

"Intel CPU Runtime for OpenCL" can be downloaded from this page (free registration needed): https://www.intel.com/content/www/us/en ... rview.html
(choose Windows version)

In Windows 10 guests, an alternative solution is to install the "OpenCL and OpenGL Compatibility Pack" from the Windows Store.
This compatibility pack allows more of your favorite OpenCL™ and OpenGL® apps to run on a Windows 10 PC that doesn't have OpenCL and OpenGL hardware drivers installed by default. If a DirectX 12 driver is installed, supported apps will run with hardware acceleration for better performance. This package supports apps that use OpenCL version 1.2 and earlier and OpenGL version 3.3 and earlier.
Once installed, OpenCL presence can be tested with "GPU Caps Viewer", downloaded from https://www.geeks3d.com/dl/show/657

An example for my computer (see in the signature): after installation of Intel CPU Runtime for OpenCL in Windows 10 21H2 guest, OpenCL 3.0 is available.


Feel free to comment or complete this tutorial.

Regards,

MN
_____________________________
Linux Mint 21.3 Mate host with Ubuntu Pro enabled, VMware Workstation Player with Windows 10 Pro guest, ASUS G74SX (i7-2670QM, 16 GB RAM, GTX560M with 3GB RAM, 1TB SSD).
Post Reply

Return to “Tutorials”