Make surfaces serializable

This is needed for multiprocess/sandboxing.