Switch to SDL2 and add threaded frameskip.

 - Unity/Compiz with Nouveau sometimes blocks for a long time (e.g. with
   the translucent Ubuntu menu open) when uploading frames, which slows
   down emulation and messes up audio. To solve this, use separate
   emulation and SDL threads. The SDL thread drop a new frame if the
   previous frame hasn't finished uploading (using a form of triple
   buffering), giving automatic frameskip in general.

 - Scaling is now done in SDL, using hardware acceleration if available.

 - SDL events are now always processed at frame boundaries.

 - Closing the emulator during automatic test ROM running now exits
   gracefully.

 - Misc. minor polishing piggy-backed.