gallium: move framebuffer utility functions into a new file