Remote Desktop Session Host, RemoteFX, GPU e novità in Windows Server 2016

Nel corso delle varie edizioni il supporto di RemoteFX da parte del ruolo Remote Desktop Session Host è cambiato e in Windows Server 2016 è stata introdotta anche una significativa novità riguardante l’uso delle GPU. Di seguito vedremo in maniera schematica l’evoluzione del supporto a RemoteFX e l’utilizzo delle GPU da parte del ruolo Remote Desktop Session Host nelle varie versioni di Windows Server.

Windows Server 2008 R2 SP1

In Windows Server 20098 R2 SP1 il supporto a RemoteFX è stato chiarito nel post https://blogs.technet.microsoft.com/enterprisemobility/2011/03/25/qa-microsoft-remotefx-and-remote-desktop-session-host-servers/ sull’Enterprise Mobility and Security Blog di seguito in sintesi le features supportate e quelle non disponibili in un server col ruolo Remote Desktop Session Host:

  • La feature RemoteFX advanced bitmap acceleration è supportata
  • RemoteFX vGPU non è supportata (è supportata solo sul ruolo Remote Desktop Virtualization Host)
  • RemoteFX USB redirection non è supportata (è supportata solo sul ruolo Remote Desktop Virtualization Host) in quanto è correlato al supporto a RemoteFX vGPU
  • Le RemoteApp non supportano RemoteFX perché richiedono drawing orders
  • Anche se il server col Remote Desktop Session Host è virtuale non potrà utilizzare la GPU virtuale, ma le applicazioni DirectX funzioneranno

Per informazioni sulla configurazione di RemoteFX in un Remote Desktop Session Host WS2008 R2 SP1 si veda Deploying Microsoft RemoteFX on a Remote Desktop Session Host Server Step-by-Step Guide, in sintesi per usare RemoteFX  occorre impostare sul Remote Desktop Session Host le seguenti Group Policy:

  • Limit Maximum Color Depth a 32 Bits in Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment
  • Configure RemoteFX a Enabled in Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment
  • Optimize visual experience when using RemoteFX a Enabled in Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment impostando la proprietà Screen capture rate (frames per second) e Screen Image quality a Highest (best quality)

Quindi in Windows Server 2008 R2 SP1 il ruolo  Remote Desktop Session Host non trae vantaggi dalla presenza sull’host di una GPU sia che il ruolo sia installato sul computer fisico o in una macchina virtuale.

Windows Server 2012

In Windows Server 2012 sono state introdotte molte novità per quanto riguarda RemoteFX una di queste riguarda la feature RemoteFX USB Redirection che come riportato nel post RemoteFX USB Redirection in Windows Server 2012 and Windows 8 sull’Enterprise Mobility and Security Blog in Windows Server 2012 è stato migliorato e scorrelato dalla funzionalità the RemoteFX vGPU rendendo quindi possibile il supporto della RemoteFX USB Redirecticion in  Remote Desktop Session Host fisici e virtuali.

Inoltre in Windows Server 2012 è stata introdotta la policy Use the hardware default graphics adapter for all Remote Desktop Services sessions in Computer Configuration\Administrator Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment che se abilitata consente l’utilizzo della GPU acceleration nelle sessioni RDP quando ci si connette remotamente da una macchina fisica anche se con alcune limitazioni. Per la precisione abilitando tale impostazione tutte le Remote Desktop Services sessions sull’RD Session Host server utilizzeranno l’hardware graphics renderer invece del Microsoft Basic Render Driver come default adapter, ma tale impostazione riguarda solo la default GPU nel caso sul computer siano installate più di una GPU.

Di seguito quanto riportato nell’help della policy:

“This policy setting enables system administrators to change the graphics rendering for all Remote Desktop Services sessions.

If you enable this policy setting, all Remote Desktop Services sessions use the hardware graphics renderer instead of the Microsoft Basic Render Driver as the default adapter.

If you disable this policy setting, all Remote Desktop Services sessions use the Microsoft Basic Render Driver as the default adapter.

If you do not configure this policy setting, Remote Desktop Services sessions on the RD Session Host server use the Microsoft Basic Render Driver as the default adapter. In all other cases, Remote Desktop Services sessions use the hardware graphics renderer by default.

NOTE: The policy setting affects only the default graphics processing unit (GPU) on a computer with more than one GPU installed. All additional GPUs are considered secondary adapters and used as hardware renderers. The GPU configuration of the local session is not affected by this policy setting.”

A riguardo si veda anche la risposta di Jeroen van Eesteren (Sr. Program Manager Remote Desktop Services fino al giugno 2016 e ora Sr. Program Manager Intune) nel tread WMS2012 RDSH ==> does a GPU in the host really help for graphics performance? in cui oltre dare indicazioni più precise circa le limitazioni di questa policy chiarisce come non possa essere applicata nel caso della RemoteFX vGPU in una VM col ruolo Remote Desktop Session Host in quanto la GPU è para-virtualizzata.

“In Windows Server 2012 there was a Group Policy added which allows GPU acceleration in RDP sessions where you are remoting to a physical machine. RDSH can take advantage of this however you should carefully test since your scale will be limited due to GPU contention. In addition not all API’s (DX/OpenGL/OpenCL) may be available and will depend on your Graphics card/driver support by the GPU vendor.

Note 2: This group policy does not work with RemoteFX vGPU, since the GPU is para-virtualized.

Un’altra interessante novità riguarda il supporto di RemoteFX (ad esclusione di RemoteFX vGPU) da parte delle RemoteApp, a riguardo si veda RemoteFX Features for Windows 8 and Windows Server 2012:

“Client computers (the endpoint PC that you are accessing the remote computer from) running any edition of Windows 8 or Windows Server 2012 support all RemoteFX features, including the ability to connect to RemoteApp, redirect USB devices by using RemoteFX USB Redirection, and support WAN networks.”

In Windows Server 2012 il ruolo  Remote Desktop Session Host installato su computer fisico può utilizzare la GPU, mentre se installato in una macchina virtuale non trae vantaggi dalla presenza sull’host di una GPU.

 Windows Server 2012 R2

Sebbene in Windows Server 2012 R2 siano state introdotte una serie di migliorie nella funzionalità RemoteFX vGPU come descritto nel post RemoteFX vGPU Improvements in Windows Server 2012 R2  sull’Enterprise Mobility and Security Blog anche in questa versione del sistema operativo server la RemoteFX vGPU non è supportata dal ruolo Remote Desktop Session Host (a riguardo si veda il post Understanding and Evaluating RemoteFX vGPU on Windows Server 2012 R2).

In Windows Server 2012 R2 è stata introdotta la policy Use advanced RemoteFX graphics for RemoteApp in Computer Configuration\Administrator Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment che permette di disabilitare RemoteFX per le RemoteApp se non necessaria, a riguardo si veda RemoteApp improvements in Windows Server 2012 R2:

“In some scenarios, for example if users keep multiple applications maximized that have continuous screen updates, the features mentioned in this blog could lead to an increase in memory and bandwidth usage, which could impact high scalability. If performance is more important than these improvements and this is a core scenario for your users, it is possible to disable these improvements by setting the following Group Policy setting to Disable”

Quindi anche in Windows Server 2012 R2 il ruolo  Remote Desktop Session Host installato su computer fisico può utilizzare la GPU, mentre se installato in una macchina virtuale non trae vantaggi dalla presenza sull’host di una GPU.

Windows Server 2016

In Windows Server 2016 oltre a RemoteFX è stata introdotta la funzionalità Discrete Device Assignment (DDA) che permette di rendere disponibili alcuni device PCI Express alle macchine virtuali (in maniera analoga a quanto faceva SR-IOV permettendo a schede di rete PCI Express di separare gli accessi alle sue risorse tra più Hyper-V child partition).

DDA va ad aggiungersi alla funzionalità RemoteFX vGPU, ma con un differente approccio che comporta la possibilità di rendere disponibile il driver nativo della GPU nella VM:

  • RemoteFX vGPU consente la condivisione di 1 o più GPU’s a più VM e supporta OpenGL 4.4/OpenCL
  • Discrete Device Assignment consente di assegnare 1 o più GPU ad una VM
A riguardo si veda la risposta di Jeroen van Eesteren (Sr. Program Manager Remote Desktop Services

fino al giugno 2016 e ora Sr. Program Manager Intune) nel thread WMS2012 RDSH ==> does a GPU in the host really help for graphics performance?

“With Hyper-V there are two options for Graphics Virtualization with Windows Server 2016 Technical Preview:

1. RemoteFX vGPU: Enables sharing of 1 or more GPU’s with many VM’s, and supports OpenGL 4.4/OpenCL

1.1 with Win10 guest VM: http://social.technet.microsoft.com/wiki/contents/articles/31771.experience-guide-for-enabling-opengl-support-for-vgpu-in-server-2016.aspx (RemoteFX vGPU was originally introduced in Hyper-V/Remote Desktop Virtualization Host with Windows Server 2008 R2 SP1)

2. Discrete Device Assignment: Enables ability to assign 1 or more GPU’s to 1 VM. This is new in Windows Server 2016 Technical Preview 4. The benefit is that you get maximum performance but your scale will be limited by the number of GPU’s you have in the server. Another benefit is that the native driver for the GPU can used inside the Guest VM. More information can be found here: https://blogs.technet.microsoft.com/virtualization/2015/11/23/discrete-device-assignment-gpus/

Inoltre sempre nel nel thread WMS2012 RDSH ==> does a GPU in the host really help for graphics performance? Jeroen van Eesteren precisa invece che la policy Use the hardware default graphics adapter for all Remote Desktop Services sessions, introdotta in Windows Server 2012, può essere applicata nel caso si utilizzi DDA ad una VM col ruolo RD Session Host dal momento la GPU viene esposta utilizzando il driver nativo.

“Note 1: Discrete Device Assignment (DDA) in Windows Server 2016 Technical Preview exposes the GPU using native driver, and therefore the group policy will apply. Though note that GPU vendors may block certain functionality depending on card and driver when used in a remote session, so careful testing is recommended.”

La funzionalità DDA come riportato in System requirements for Hyper-V on Windows Server 2016 Technical Preview richiede i seguenti requisiti:

  • Processore con supporto a Intel Extended Page Table (EPT) o AMD Nested Page Table (NPT)
  • Chipset con supporto a:
      • Interrupt remapping ovvero Intel VT-d con funzionalità Interrupt Remapping (VT-d2) o una qualunque versione della AMD I/O Memory Management Unit (I/O MMU)
      • DMA remapping ovvero Intel VT-d con funzionalità Queued Invalidations o una qualunque versione della AMD I/O MMU
      • Access control services (ACS) sulle PCI Express root ports
    • Le firmware tables devono esporre l’I/O MMU a Hyper-V (questa funzionalità potrebbe disabilitata per default nel UEFI o nel BIOS)

DDA è al momento utilizzabile due tipi di device:

  • GPU con supporto a DDA
  • Non-volatile memory express (NVMe)

Per semplificare il processo di verifica di compatibilità dell’host e dei device è possibile utilizzare lo script PowerShell scritto da Sarah Cooley (Program Manager dell’Hyper-V team in Microsoft) disponibile al seguente https://github.com/Microsoft/Virtualization-Documentation/tree/master/hyperv-samples/benarm-powershell/DDA.

Come indicato da Ned Pyle (Principal Program Manager Windows Server) il 2 settembre 2016 nel thread RemoteFX + OpenGL guest support in Windows Server 10 Hyper-V sul forum https://windowsserver.uservoice.com/ DDA è supportato anche sull’Hyper-V nella Windows 10 Anniversary Update oltre che Windows Server 2016:

“Hyper-V in Windows 10 Anniversary Update and in Windows Server 2016 has the ability to do Discrete Device Assignment, where a device like a GPU can be directly mapped into the address space of a guest VM. This is supported for Windows guests and for Linux guests. For Linux guests, the needed kernel device drivers are in the latest upstream Linux kernel as part of the Hyper-V Linux Integration Services (LIS). These drivers are now flowing downstream into individual Linux distros releases. Ubuntu 16.04 has the drivers, and we’re working with Red Hat to get the drivers into future RHEL updates, which of course will cover CentOS as well. With the GPU mapped into the Linux guest, you can use whatever user space libraries, like OpenGL/OpenCL and others, that are needed by your computational application.

We don’t have any plans to offer RemoteFX for Linux guests.”

Per utilizzare DDA occorre abilitare la policy Use the hardware default graphics adapter for all Remote Desktop Services sessions in Computer Configuration\Administrator Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment che in Windows Server 2016 consente l’uso della GPU nei seguenti scenari:

  • Server fisico dotato di GPU col ruolo Remote Desktop Session Host
  • VM col ruolo Remote Desktop Session Host con GPU assegnata tramite Discrete Device Assignment

Per meglio comprendere la correlazione tra il ruolo Remote Desktop Session Host e la tecnologia DDA finalizzato all’utilizzo della GPU si vedano le precisazioni di Ned Pyle (Principal Program Manager Windows Server) il 2 settembre 2016 nel thread WMS2012 RDSH ==> does a GPU in the host really help for graphics performance?:

1. so DDA will work with WMS2016 in RDSH mode? (although DDA is mentioned under the heading RDVH in your first post).

Yes it will work (with the group policy enabled) though note that you should test this given that GPU resources aren’t governed for each RDSH session, meaning that one user could take all the rendering resources.

2. If this is the case: will the WMS2016 server need to run as a physical machine, or should it be run (virtualized) on Hyper-V, where the Hyper-V host has assigned the GPU to the VM running WMS2016.

Discreet Device Assignment (DDA) is a Hyper-V specific technology, however the Group Policy I mentioned also works with physical machine.

3. If both methods work I suppose physical is the better option if you only intend to use the server for the WMS role?

Yes, given that you will not have the overhead of the host/Hypervisor.

4. If you choose to virtualize WMS2016, can this be a gen 2 VM?

Yes

5. If you use DDA does this exclude RFX technologies and advantages (such as being able to work over WAN or environments with a lot of latency)? And will the RDP client of thin clients need to be adapted to take advantage of this?

DDA is separate from the RDP Protocol. RemoteFX is referring to various technologies used by Remote Desktop Services (RemoteFX vGPU, Adaptive Graphics, USB redirection etc), DDA enables you to have the GPU acceleration with a GPU directly mapped to the VM, while RDP  features (adaptive graphics etc) are provided by the OS running inside the VM

6. How will we know if the driver of the GPU in the server will support all necessary features, will there be a list or compatibility page from Microsoft? You mention contacting the manufacturer but in my experience few support staff know what RFX is about (in any detail)…

The general question to the manufacturer is whether GPU’s are supported in VDI/Remoting Environment. In general the GPU’s that are supported are the server/workstation class GPU’s (NVidia Quadro/Grid, AMD FirePro, etc.). However you should verify with the GPU manufacturer and test

Will RemoteFX vGPU ever be enabled for multisession RDSH?

Can’t comment on the future, however running a Windows Server 2016 Technical Preview RDSH VM with RemoteFX vGPU enabled is not supported with multiple sessions. RemoteFX vGPU however will work with a single user with Windows Server 2016


To get GPU acceleration for RDSH with Hyper-V, you can leverage Windows Server 2016 VM and use DDA to assign the GPU to the VM. See my notes earlier in this thread.

Sinteticamente i passi da seguire per assegnare una GPU in una VM sono i seguenti descritti in Discrete Device Assignment — GPUs:

  1. Verificare che l’host Hyper-V abbia i prerequisti enetualmente utilizzando lo script survey-dda.ps1
  2. Installare i driver della GPU nell’host Hyper-V
  3. Assicurarsi di non usare la tramite RemoteFX in Hyper-V la GPU che si vuole assegnare tramite DDA
  4. Sconnettere la GPU dall’host perché non la utilizzi, a tal fine è necessario prima eseguire una query PowerShell per ricavare l’elenco delle GPU sull’host tramite il comando:
    $pnpdevs = Get-PnpDevice | Where-Object {$_.Present -eq $true} | Where-Object {$_.Class -eq “Display”}
  5. Disabilitare sull’host la GPU che si intende assegnare alla VM tramite il comando PowerShell seguente (nell’esempio si disabilita la seconda GPU):
    Disable-PnpDevice -InstanceId $pnpdevs[1].InstanceId -Confirm:$false
  6. Verificare che la GPU sia effettivamente disabilitata sull’host tramite la seguente query PowerShell controllando che lo status della GPU sia impostato ad Error e che sia disattivata nell’applet Device Manager:
    $pnpdevs = Get-PnpDevice | Where-Object {$_.Present -eq $true} | Where-Object {$_.Class -eq “Display”}
  7. Eseguire il dismount della GPU nell’host tramite i seguenti comandi PowerShell (nell’esempio si esegue il dismount della seconda GPU):
    $locationpath = ($pnpdevs[1] | Get-PnpDeviceProperty DEVPKEY_Device_LocationPaths).data[0] $locationpath Dismount-VmHostAssignableDevice -locationpath $locationpath –force
  8. Verificare che la GPU sia effettivamente sconnessa sull’host tramite la seguente query PowerShell controllando che non venga più elencata e che non sia più presente nell’applet Device Manager:
    $pnpdevs = Get-PnpDevice | Where-Object {$_.Present -eq $true} | Where-Object {$_.Class -eq “Display”}
  9. Impostare l’arresto automatico della VM a Shutdown e non a Saved in quando questa impostazione impedisce l’utilizzo della DDA
  10. Abilitare DDA sulla VM (nell’esempio VMTestDDA) eseguendo sull’host il seguente comando PowerShell:
    Add-VMAssignableDevice -locationpath $locationpath -VMname VMTestDDA
  11. Verificare che la GPU sia effettivamente stata connessa alla VM controllando sia presente nell’applet Device Manager nella VM nel ramo Device Adapters come Microsoft Basic Dispaly Adapters
  12. Installare nella VM il driver della GPU, ovvero lo stesso driver che era stato installato sull’host al passo 2 e verificare nell’applet Device Manager nella VM nel ramo Device Adapters sia ora elencata correttamente in base alla Marca e Modello della GPU

Per uno sytep-by-step di questa procedura si veda la White Paper Introduction to Windows Server 2016 Hyper-V Discrete Device Assignment pubblicata da Lenovo.

Tramite la KB3133690 Update to add Discrete Device Assignment support for Azure that runs on Windows Server 2012 R2-based guest VMs anche le VM WS2012R2 on-premises o in Azure potranno utilizzare DDA.

Riassumendo in Windows Server 2016 il ruolo Remote Desktop Session Host in una macchina virtuale può utilizzate tramite DDA la GPU presente sull’host di una GPU. Nel caso in cui il ruolo Remote Desktop Session Host sia installato su un computer fisico può utilizzare la GPU abilitando la policy Use the hardware default graphics adapter for all Remote Desktop Services sessions.

Anche se utilizzando DDA non è possibile utilizzare la RemoteFX vGPU, sarà comunque possibile utilizzare altre funzionalità di RemoteFX quali RemoteFX Adaptive Graphics, RemoteFX for WAN, RemoteFX Multi-Touch e RemoteFX Media Redirection API dal momento che queste funzionalità sono gestite dall’implementazione del protocollo RPP nel sistema operativo della VM.

Anche in Windows Server 2016 RemoteFX vGPU non supportata in RD SH e RemoteApp dal momento che non supporta sessioni multiple, ma è utilizzabile solo con un singolo utente ovvero in scenari VDI.

Per maggiori informazioni si vedano:

Per feedback e suggerimenti riguardanti i Remote Desktop Services si veda il forum https://remotedesktop.uservoice.com/.

Se siete interessati ad approfondire l’utilizzo dei Remote Desktop Services e le novità introdotte in Windows Server 2016 io e Roberto Massa vi aspettiamo ai Community Days 2016 alla nostra sessione ITP12 – Remote Desktop Services: novità e stato dell’arte con Azure e Windows Server 2016 Venerdì 7 ottobre alle ore 18.00 in sala Sala 5 (Teatro 3).