glx: Refactor and simplify context creation