We use GdkImage to manage the rendering buffer for us. It supports automatic detection and usage of MIT-ShM, so we don't have to worry about it beyond synchronising the screen before rendering.