Prev |  | Next

## 1. Introduction

Spice is an open remote computing solution, providing client access to remote displays and devices (e.g. keyboard, mouse, audio). The main use case is to get remote access to virtual machines, although other use cases are possible and in various development stage.

Spice provides a desktop-like user experience, while trying to offload most of the intensive CPU and GPU tasks to the client. The basic building blocks of Spice are:

- Spice Server
- Spice Client
- Spice Protocol

The following sections provide basic information on Spice components and features, obtaining, building installing and using Spice.

### 1.1. Spice and Spice-related components

#### Spice Server

Spice server is implemented in libspice, a VDI pluggable library. Currently, the main user of this library is QEMU. QEMU uses spice-server to provide remote access to virtual machines through the Spice protocol. Virtual Device Interface (VDI) defines a set of interfaces that provide a standard way to publish virtual devices (e.g. display device, keyboard, mouse) and enables different Spice components to interact with those devices. On one side, the server communicates with the remote client using the Spice protocol and on the other side, it interacts with the VDI host application (e.g QEMU).

#### Spice Client

The Spice client is a program which is used by the end user to access remote systems through Spice. The recommended client is remote-viewer (which is shipped with virt-viewer). GNOME Boxes can also be used as a Spice client. spicec is an obsolete legacy client, and spicy is only a test application.

#### QXL Device and Drivers

Spice server supports the QXL VDI interface. When libspice is used with QEMU, a specific video PCI device can be used for improving remote display performance and enhancing the graphic capabilities of the guest graphic system. This video device is called a QXL device and requires guest QXL drivers for full functionality. However, standard VGA is supported when no driver exists.

#### Spice Agent

The Spice agent is an optional component for enhancing user experience and performing guest-oriented management tasks. For example, the agent injects mouse position and state to the guest when using client mouse mode. It also enables you to move cursor freely between guest and client. Other features of agent are shared clipboard (copy and paste between guest and host) and aligning guest resolution with client when entering fullscreen mode.

#### VDI Port Device

The Spice protocol supports a communication channel between the client and the agent on the server side. When using QEMU, Spice agent resides on the guest. VDI port is a QEMU PCI device used for communication with the agent.

#### Spice Protocol

The Spice protocol defines the messages and rules for the communication between the various Spice components.

### 1.2. Features

#### Multiple Channels

The server and client communicate via channels. Each channel is dedicated to a specific type of data. The available channels are the following:

Main
  control and configuration
Display
  graphics commands images and video streams
Inputs
  keyboard and mouse inputs
Cursor
  pointer device position and cursor shape
Playback
  audio received from the server to be played by the client
Record
  audio captured on the client side
Smartcard
  passthrough of smartcard data from the client machine to the guest OS
USB
  redirection of USB devices plugged into the client to the guest OS

#### Image Compression

Spice offers several image compression algorithms, which can be chosen on server initiation and dynamically at run-time. Quic is a Spice proprietary image compression technology based on the SFALIC algorithm. The Lempel-Ziv (LZ) algorithm is another option. Both Quic and LZ are local algorithms encoding each image separately. Global LZ (GLZ) is another proprietary Spice technology that uses LZ with history-based global dictionary. GLZ takes advantage of repeating patterns among images to shrink the traffic and save bandwidth, which is critical in a WAN environment. Spice also offers an automatic mode for compression selection per image, where the choice between LZ/GLZ and Quic is heuristically based on image properties. Conceptually, synthetic images are better compressed with LZ/GLZ and real images are better with Quic.

#### Video Compression

Spice uses loss-less compression for images sent to the client. However, video streams are handled differently. Spice server heuristically identifies video areas and sends them as a video stream coded using M-JPEG. This handling saves a lot of traffic, improving Spice performance, especially in a WAN environment. However, in some circumstances the heuristic behavior might cause low quality images (e.g. identifying updated text area as a video stream). Video streaming can be chosen on server initiation and dynamically at run-time.

#### Mouse modes

Spice supports two mouse modes: server and client. The mode can be changed dynamically and is negotiated between the client and the server.

Server mouse
  When a user clicks inside the Spice client window, the client mouse is captured and set invisible. In this mode, the server controls the mouse position on display. However, it might be problematic on WAN or on a loaded server, where mouse cursor might have some latency or non-responsiveness.
Client mouse
  Not captured and is used as the effective pointing device. To enable client mouse, the VDI host application must register an absolute pointing device (e.g. USB tablet in QEMU). This mode is appropriate for WAN or for a loaded server, since cursor has smooth motion and responsiveness. However, the cursor might lose synchronization (position and shape) for a while.

#### Other Features

Multiple Monitors
  any number of monitors is supported
Arbitrary Resolution
  when using the QXL driver, the resolution of the guest OS will be automatically adjusted to the size of the client window.
USB Redirection
  Spice can be used to redirect USB devices that are plugged in the client to the guest OS. This redirection can either be automatic (all newly plugged devices are redirected), or manual (the user selects which devices (s)he wants to redirect).
Smartcard Redirection
  data from smartcard that are inserted into the client machine can be passed through to the guest OS. The smartcard can be used by both the client OS and the guest OS.
Bidirectional Audio
  Spice supports audio playback and recording. Playback is compressed using the OPUS algorithm
Lip-sync
  between video and audio. Available only when video streaming is enabled.
Migration
  switching channel connectivity for supporting server migration
Pixmap and Palette caching
  image data is cached on the client to avoid sending the same data

Prev |  | Next
| Home |