2

So, I'm trying to tackle a rather odd issue. I'm fairly new with virtualization (the most I've managed is isolating some applications with Docker and VirtualBox, which isn't hard to do). I am more questioning how the X display server works compared to actually asking for help virtualizing, though that would be appreciated.

I'm attempting to set up a host machine that uses an X display server provided by a different virtualized system. I am going to have the host machine virtualize two Linux systems.

The first Linux system is planned to host an X display server. Now, this should be rather simple to do in the end, but I'm looking for solutions that delve a bit deeper than "this works". However, I did realize other issues. I intend to run slightly graphical intensive applications on this virtualized system. Which machine should the video card be dedicated to?

The second system isn't going to be nearly as special, but there is a rather weird network confliction (not a bug; it's how I have to set things up). There won't be an X server or anything else.

My ultimate question: Would I need to utilize actual hardware for both instances, just the "host" of the X server (the virtualized system), or just the "client" of the X server (the host machine)? I would also like to ask how I might be able to accomplish this, though that's a little outside the scope of the question.

  • But [you already answered your own question](http://serverfault.com/a/732926/126632)! – Michael Hampton Oct 31 '15 at 05:50
  • @MichaelHampton Not quite. For that, I mentioned doing PCIe passthrough "in general". This is more a question about how the X display server works, *not* how to virtualize hardware. I don't know much in the way of how to passthrough hardware, but I know you can do it. Again, as I mentioned about, "that's a little outside the scope of the question", meaning I can probably research it but a link or two would be appreciated. Here I am asking if the virtualized machine running the X display server should use the video card, or if it should be the "client" host machine. – Mythical Juggernaut Oct 31 '15 at 06:00
  • "*I intend to run slightly graphical intensive applications on this virtualized system*": are you referring to the host o client system in this sentence? Do you intend using 3D applications (3D libraries circumvent the X display stack to address directly the graphic card)? – WhiteWinterWolf Nov 02 '15 at 08:42
  • 1
    @WhiteWinterWolf The client system. My intention was to utilize it for things like HD video and whatnot. It's going to function more as an entertainment suite (again, this is the client system). My whole goal with the passthrough is to offload as much of the workload onto the GPU as possible, since the CPU is going to be rather busy a lot of the time and I'd rather not sacrifice performance. – Mythical Juggernaut Nov 04 '15 at 04:00
  • I tried to answer your question, however I wonder if it wouldn't be more suited on [unix.se]. – WhiteWinterWolf Nov 04 '15 at 15:44

1 Answers1

1

To summarize my understanding of your situation: you need to play HD videos in a virtualized guest system acting as client to an X Server located in another virtualized guest.

Your question is mainly to which guest you should dedicate you GPU in order to lower the CPU load as much as possible and have a general overview how the display will actually work.

Most chances are that the GPU will have to be handled by the guest running the X Server. I indeed see no way how a client would send video frames directly to the graphic card without knowing anything about the containing window handled on server side.

For information, you may also want to consider using Linux framebuffer which can allow you to play videos right from the command prompt without X at all.

As to understand how it works, the trick here is that there is not a single way to play videos in an X environment, and depending on your platform details, some may be faster, some may show glitches with certain video files, some may not work at all.

I recommend you to use VLC media player to proceed with your tests. It is available in most Linux distributions repositories and allows you to manually select which way it will use to display the video (from the menu, go in Tools > Preferences > Video, then select you choice in the Output drop-down widget).

Whatever way is used, it will always generate a lot of traffic between the X client (the video player) and the X Server, so if both virtualized guests are running on the same host you will most likely prefer to ensure that there is no encryption occurring on their exchange. In other words, you may most likely leave SSH-tunneling out and prefer to use an old-fashioned X display redirection:

  • On the server host, ensure that the X server listens on an external interface (the exact configuration step is distribution dependent, if manually modifying a file ensure it will not get overwritten by some automatic configuration, you may also need to adapt your firewall rules) and allow incoming X connections from the guest environment using the xhost command:

    $ xhost +<XCLIENT_IP>
    
  • On the client host, export the $DISPLAY variable before launching VLC:

    $ export DISPLAY=<XSERVER_IP>:0.0
    $ vlc
    

Certain output modes will make VLC to go through the X stack, while some other will make VLC to circumvent it and directly contact the underlying video hardware through some library. In your situation, only the former will work. Trying to use the wrong output type will make VLC to either display no video (while still playing sound) or crash when opening the file.

Best candidates will therefore be Xvideo (an X extension dedicated to video playback, it replaces the older but still available X11 output), GLX and OpenGL (both make VLC to rely on a API interfacing OpenGL and X display system).

WhiteWinterWolf
  • 268
  • 5
  • 14
  • Well, I was intending to host the X server in a virtualized environment. The *host machine itself* would be what is actually connecting to the X server. Regardless, this applies still. My overall intentions were to run an entire desktop environment and not just HD video. I **did** intend to use it for things like Firefox and I generally want it to be as feature-rich as I can get it. You did provide a bit of food for thought and I'll definitely see what I can do based off of that. I got quite a bit out of this. Thank you! :) – Mythical Juggernaut Nov 05 '15 at 08:03