Thursday, April 18, 2013

What is RemoteFX on Windows 2012 Hyper-V and Deploying a Win 8 Virtual Desktop

Updated 2/3/2017 for Windows Server 2016 and Windows 10!

RemoteFX is Microsoft's advanced desktop RDP solution based on technology acquired from Calista Technologies. It allows for the following functionality above and beyond standard RDP:

This Article Written in RemoteFX. It's... amazing?

Server 2008r2 Based:

Virtualized 3d GPU: you can split a single GPU into multiple virtual GPUs for VDI VMs. This allows for 3d accelerated apps to run in the RDP session.

RemoteFX Codec: A more advanced version of the RDP compression scheme that allows for more efficient streaming of both video and audio. While it works fine for text, you can always get groceries in a Yugo.

USB Device redirection: Now you can finally use your USB Scan Toaster on your remote desktop!

Hardware Requirements:

DX11 (WDDM 1.2) Compatible GPU; All made for purpose DX11 GPUs from NVIDIA and AMD work, and for testing I've been using a consumer grade NVIDIA 650 in my lab without issue.

Software Requirements:

Server: Server 2012/2016 (core preferred, see next section)

Client: Windows 8/10 Enterprise, and Enterprise only. Pro won't work. Additionally, I found that re-keying a Win8 Pro to Enterprise install will not work either. While it will report that all is well, and it will install the RemoteFX graphics adapter, when you try to connect it will report "error during licensing protocol" in the final stage of connection negotiation.

Setup

Assumptions

You have a fully functional HyperV Host that meets the hardware requirements listed above.

You're using server core. You can do this on standard, but you should be using core for performance and patching (or lack thereof) reasons. The commands I relay assume core.

Prepare the Host

Patch it up; make sure you're fully up to date.

Install the graphics drivers for your GPU on the host. This may pose some issues on server core, but fortunately I've got a guide for NVIDIA GPUs to help. The procedure is most likely similar for AMD GPUs. Bounce the host after driver install regardless of if it tells you to do so or not.

Install the Remote Desktop Virtualization Host feature. Either use the server manager remotely to do so, or execute the following directly on the Hyper-V host: "Install-WindowsFeature –name RDS-Virtualization -source j:\sources\sxs" where J: is the DVD-ROM or image with the 2012 install bits. You can use other sources if desired, for more information see this post.

Reboot the server.

Enable the Adapter for use with the Hyper-V host by opening the Hyper-V management console, right click the server->Hyper-V Settings....

Select "Physical GPUs"

If configured correctly, you should see your adapter listed. Check the "Use this GPU with RemoteFX" box and click "OK".

Alternatively for steps 5 through 7 you can use the following powershell cmdlets:

Start up the VM. You now will need to logon via RDP, as the Hyper-V remoting will be locked out. The machine should notify of new hardware being installed that requires a reboot. If it does not, re-install the integration services. Reboot the VM.

To ensure the VM is operating with the adapter open device manager and look under "Display Adapters". You should see "Microsoft RemoteFX Graphics Device - WDDM"

Adjust Settings via GPO

Microsoft makes some RemoteFX settings "Tweakable" via GPO. These settings can be found here:

Computer Configuration->Policies->Administrative Templates->Windows Components->Remote Desktop Services->
Remote Desktop Connection Client->RemoteFX USB Device Redirection
-Allow RDP redirection of other supported RemoteFX USB devices from this computer
Remote Desktop Session Host->Remote Session Environment
-Configure compression for RemoteFX data
-Configure image quality for RemoteFX Adaptive Graphics
-Enable RemoteFX encoding for RemoteFX clients designed for WindowServer 2008r2 SP1
-Configure RemoteFX Adaptive Graphics (Tweak if using only on a LAN)
RemoteFX for Windows Server 2008 R2
-Configure RemoteFX (this just allows for disabling RemoteFX via GPO)
-Optimize visual experience when using RemoteFX (Tweak this one if using only on a LAN)
-Optimize visual experience for Remote Desktop Service Sessions (Change to "Text" if you setup RemoteFX so Bobby can do his spreadsheets. Why did you setup RemoteFX again?)

Troubleshooting

Sound isn't working on the youtubes! : Seems like flash doesn't work correctly with audio redirection. HTML5 works though! Switch to the HTML 5 beta by going here.

Seems Slow: Make sure your color depth is set to 32bit. Based on my testing it seems that the codec favors full 32 bit color.

FAQ (By me of myself @ least, and by frequently I mean once until I answered them)

Q: Should I want to, what can I use to benchmark this thing? A: PassMark works great; I must admit that watching DX11 accelerated 3d benchmarks through an RDP session is kind of cool. :)

Q: Does RemoteFX work through an RDP gateway? What versions? A: Yup, it works through a gateway running on 2008, 2008R2, or 2012.

Q: Is GPU performance good enough to run intensive applications or GPU computation tasks? A: In most cases, no. The RemoteFX solution virtualizes the GPU and exposes it as a Microsoft "GPU", essentially translating all requests through a proxy driver. While that solution allows for splitting the GPU across multiple VMs, it also makes for reduced functionality/performance of the card since the OS isn't exposed directly to the native driver. Additionally, framerate is limited by the RDP protocol itself.

Q: Does RemoteFX support accelerated OpenGL? A: No, it is done in software.

Q: Can RemoteFX do GPU direct passthrough? A: No, only Xenserver Enterprise or higher can do that right now.

Q: How do I know how much memory on my GPU is being used by my VMs? A: You can find the answer on the Hyper-V/Physical GPUs page for each server. The memory stats are listed right under GPU Details->Summary.

Q: Can I deploy RemoteFX in a VDI environment? A: Yeah, though note your max simultaneous RemoteFX sessions will be limited by available GPU memory. (See above post) Fortunately for you, I have a guide on how to setup Hyper-V based VDI!

Q: Will this VMWare tweak help up the framerate on Hyper-V/RemoteFX? A: In my testing, it did not. I suspect this is because the HyperV NICs probably don't support interrupt coalescing. It looks like one could enable interrupt coalescing on the host with the following instructions and perhaps that would change the answer depending on how the packets are handled from the RemoteFX machine.

2 comments:

Some questions..Do you have any idea about if i can increase VRAM up to 1GB for each virtual machine. I'm using windows server 2012R2, with NVIDIA Quadro 5000 (2.5GB), and my guest operative system is windows 8.1, my application requiere high video performance (more than 800MB).

Excellent question; unfortunately I don't know of any way to get that much allocated to a given VM. The most I've been able to confirm having associated with a given VM is 265MB, which can be done by changing the #/Size of the maximum monitors setting in the VM settings to 2/2560x1600. You can then check the actual video memory by looking at the details of the host after starting the VM (right click host->Hyper V settings->Physical GPUs->Summary), or by using the PowerShell command Get-VMRemoteFXPhysicalVideoAdapter on the host and checking the "AvailableVideoMemory" after starting the VM in question.

I've been looking for a more functional way to do this myself but have yet to find anything. There are a couple articles on the 'net referencing a VM based registry setting, but that looks to be a non-functional value. Should I find a way, I'll make sure to update the article.

For the record, here is memory allocation associated with a few monitor configurations: