gallium: add handling for YUV planar surfaces
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 29 May 2019 21:14:32 +0000 (17:14 -0400)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 31 Jul 2019 16:50:06 +0000 (09:50 -0700)
commit7404833c2e3227b61f53ad93b0e3a1a4d545c05f
tree05ca13aada923987187442d9137b62d2b4b747f7
parent338a29b08fe69aa91ad0318d54da1670f40307f0
gallium: add handling for YUV planar surfaces

st/dri:
this adds a table (similar to the one in i965) which provides
mappings for turning various planar formats into multiple sampler views.
whereas only NV12 and IYUV were supported, now many more formats are
supported here:
* P0XX
* YUV4XX
* YVU4XX
* AYUV
* XYUV
* YUYV
* UYVY

the table is used directly to handle image creation, simplifying
a lot of code and resolving related TODO/FIXME items where workarounds were
previously in place to manage NV12 and IYUV formats exclusively

st/mesa:
the changes here relate to setting up samplers for the planar formats.
this requires:
* checking for driver support for all the sampler formats
* creating the samplers with the corresponding formats and swizzling
* running nir_lower_tex with the appropriate options to trigger the lowering
  for each plane->sampler

fixes kwg/mesa#36

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/dri/dri_screen.c
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_eglimage.c
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_program.h
src/mesa/state_tracker/st_sampler_view.c