Features/Surfaces

From Spice

Contents

Surfaces

Summary

The older spice protocol drew directly on the frame buffer. The surfaces work lets the driver draw on an offscreen surface, and then use that surface as a source when drawing.

This is a requirement for an efficient implementation of an X driver, as offscreen pixmaps are a very common thing in X. It is also very useful for Windows 7, as it lets Windows use a surface for every toplevel window which leads to much reduced redrawing and thus bandwidth use.

Owner

Current Status

Description

Commands are added to create multiple surfaces in addition to the normal (called Primary) surface that represents the framebuffer. All drawing operations are extended by adding a destination surface fields that tells spice which surface to draw on. Additionally all operations that take some form of image source are also extended to support having a surface as the source.

The server code is extended to allow multiple surfaces, using a tree per surface, and recording dependencies between the various surfaces in the tree.

As part of this change the way surfaces are stored in spice changed from always being in 32bit mode to being stored in the actual pixel format specified by the guest driver.

An additional complication is how the high byte is handled in 32bit mode. This byte is never used on the framebuffer surface, but for offscreen surfaces it can sometimes be used to specify the alpha channel in a drawing operation. This means that we need to always preserve the high byte when dealing with 32bit images. We do this by checking for non-zero high bytes when drawing images and automatically converting such images to RGBA.