mesa: deduplicate format code
@kwg had reported regressions in the mesa/st part of !2018 (merged) -- but there's a ton of code deletion that I think we can manage even without the last bit of the st changes. Hopefully intel can run it through CI and we can push this subset.