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>
This commit is contained in:
Mike Blumenkrantz
2019-05-29 17:14:32 -04:00
committed by Kenneth Graunke
parent 338a29b08f
commit 7404833c2e
8 changed files with 328 additions and 84 deletions

View File

@@ -309,6 +309,9 @@ update_shader_samplers(struct st_context *st,
switch (st_get_view_format(stObj)) {
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_P016:
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_UYVY:
/* we need one additional sampler: */
extra = u_bit_scan(&free_slots);
states[extra] = sampler;