Compositor helper funcs
I noticed there were quite a few places in the compositor where we weren't using the helper functions we were recommending. In one case (fd version of create_swapchain helper), a new helper function could be added to reduce duplicated code and improve safety by preventing miscellaneous code from performing unchecked downcasts.
There were a few other places where the downcast helper was in the header, but only used in the implementation file, so I moved it there to avoid temptation.
Builds on !365 (merged) . The first 3 commits might be eligible for squashing together.