v4l2: work around a strange x11 exception during XFreePixmap

terminate vaapi before XFreePixmap work around the exception;
otherwise there is "BadDrawable" exception though the Pixmap is valid.

maybe driver 'lock' the Pixmap at that time, or dri protocol issue.
add encode test. add recursion test, you can test h264,vp8,jpg decode and h264 encode one time.