v3d: Enables DRM_FORMAT_MOD_BROADCOM_SAND128 support
It enables SAND modifier with columns 128-bytes-wide support for NV12 format. When a DRM_FORMAT_MOD_BROADCOM_SAND128 is enabled an imported NV12 texture format has a different layout. Luma and Chroma planes layout is interleaved for every 128-bytes-wide columns. Although TFU was supposed to convert a NV12 with SAND_COL128 modifier from YUV to sRGB color space, it expects a particular swizzle that is not the one provided by the video decoder available at the Raspberry Pi 4. This patch follows a similar approach to VC4 YUV blit, using a custom blit shader that transforms a NV12 texture with SAND_COL128 modifier with the two interleaved planes to two not-interleaved textures with UIF format, as it was a regular NV12 format texture. To reduce the number of texture-fetch operations during the blit, we are reading and writing the textures in pixel groups of 32-bits. This implies some swizzling of the pixels to meet the particularities of the different micro-tile layouts for 8bpp, 16bpp and 32bpp. With this approach, we are not adding a new format that could be named "NV12_SAND128". We are just enabling a format modifier. v2: Rework checks for supported modifiers (Alejandro Piñeiro) Destroy custom shaders on context destroy (Alejandro Piñeiro) Add more comments (Alejandro Piñeiro) SAND128 in query_dmabuf_modifiers should report external_only true. Reviewed-by:Alejandro Piñeiro <apinheiro@igalia.com> Part-of: <!10051>
- src/gallium/drivers/v3d/v3d_blit.c 287 additions, 0 deletionssrc/gallium/drivers/v3d/v3d_blit.c
- src/gallium/drivers/v3d/v3d_context.c 7 additions, 0 deletionssrc/gallium/drivers/v3d/v3d_context.c
- src/gallium/drivers/v3d/v3d_context.h 4 additions, 0 deletionssrc/gallium/drivers/v3d/v3d_context.h
- src/gallium/drivers/v3d/v3d_resource.c 12 additions, 4 deletionssrc/gallium/drivers/v3d/v3d_resource.c
- src/gallium/drivers/v3d/v3d_resource.h 1 addition, 0 deletionssrc/gallium/drivers/v3d/v3d_resource.h
- src/gallium/drivers/v3d/v3d_screen.c 19 additions, 2 deletionssrc/gallium/drivers/v3d/v3d_screen.c