c/direct: Move common direct mode code to comp_window_direct.
Create code file for common direct mode code.
Make common functions take generic parameters.
Use common code in randr and nvidia back ends.
Remove redunant includes.
authored by