pan: Teach libpanfrost about YU08/Y010
This is just a matter of adding a few entries to existing arrays/switch-statements, the rest of the logic stays unchanged. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35318>
This commit is contained in:
committed by
Boris Brezillon
parent
f2093b137e
commit
fddd455e9c
@@ -278,6 +278,8 @@ panfrost_lower_yuv_format(struct panfrost_device *dev,
|
||||
SINGLE_RES(NV20, R10_G10B10_422_UNORM)
|
||||
SINGLE_RES(IYUV, R8_G8_B8_420_UNORM)
|
||||
SINGLE_RES(YV12, R8_B8_G8_420_UNORM)
|
||||
SINGLE_RES(Y8U8V8_420_UNORM_PACKED, R8G8B8_420_UNORM_PACKED)
|
||||
SINGLE_RES(Y10U10V10_420_UNORM_PACKED, R10G10B10_420_UNORM_PACKED)
|
||||
|
||||
#undef SINGLE_RES
|
||||
|
||||
@@ -390,6 +392,12 @@ panfrost_walk_dmabuf_modifiers(struct pipe_screen *screen,
|
||||
native_mods[i] == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED)
|
||||
continue;
|
||||
|
||||
/* Some formats only work with AFBC. */
|
||||
if ((native_mods[i] == DRM_FORMAT_MOD_LINEAR ||
|
||||
native_mods[i] == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED) &&
|
||||
!pan_u_tiled_or_linear_supports_format(format))
|
||||
continue;
|
||||
|
||||
if (test_modifier != DRM_FORMAT_MOD_INVALID &&
|
||||
test_modifier != native_mods[i])
|
||||
continue;
|
||||
|
||||
@@ -376,6 +376,10 @@ pan_afbc_format(unsigned arch, enum pipe_format format, unsigned plane_idx)
|
||||
case PIPE_FORMAT_R10_G10B10_422_UNORM:
|
||||
return plane_idx == 0 ? PAN_AFBC_MODE_YUV422_1C10
|
||||
: PAN_AFBC_MODE_YUV422_2C10;
|
||||
case PIPE_FORMAT_R8G8B8_420_UNORM_PACKED:
|
||||
return PAN_AFBC_MODE_YUV420_6C8;
|
||||
case PIPE_FORMAT_R10G10B10_420_UNORM_PACKED:
|
||||
return PAN_AFBC_MODE_YUV420_6C10;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,9 @@ const struct pan_format GENX(pan_pipe_format)[PIPE_FORMAT_COUNT] = {
|
||||
|
||||
FMT_YUV(R10_G10B10_420_UNORM, Y10_UV10_420, YUVA, NO_SWAP, CENTER, _T___),
|
||||
FMT_YUV(R10_G10B10_422_UNORM, Y10_UV10_422, YUVA, NO_SWAP, CENTER_422, _T___),
|
||||
/* special internal formats */
|
||||
FMT_YUV(R8G8B8_420_UNORM_PACKED, Y8_UV8_420, YUVA, NO_SWAP, CENTER, _T___),
|
||||
FMT_YUV(R10G10B10_420_UNORM_PACKED, Y10_UV10_420, YUVA, NO_SWAP, CENTER, _T___),
|
||||
#endif
|
||||
|
||||
FMTC(ETC1_RGB8, ETC2_RGB8, RGBA8_UNORM, RGB1, L),
|
||||
|
||||
@@ -93,6 +93,19 @@
|
||||
((mod >> 52) == \
|
||||
(DRM_FORMAT_MOD_ARM_TYPE_AFRC | (DRM_FORMAT_MOD_VENDOR_ARM << 4)))
|
||||
|
||||
static inline bool
|
||||
pan_u_tiled_or_linear_supports_format(enum pipe_format format)
|
||||
{
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_R8G8B8_420_UNORM_PACKED:
|
||||
case PIPE_FORMAT_R10G10B10_420_UNORM_PACKED:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Formats */
|
||||
|
||||
static inline unsigned
|
||||
|
||||
@@ -210,6 +210,7 @@ pan_linear_or_tiled_row_align_req(unsigned arch, enum pipe_format format,
|
||||
|
||||
switch (format) {
|
||||
/* For v7+, NV12/NV21/I420 have a looser alignment requirement of 16 bytes */
|
||||
case PIPE_FORMAT_R8G8B8_420_UNORM_PACKED:
|
||||
case PIPE_FORMAT_R8_G8B8_420_UNORM:
|
||||
case PIPE_FORMAT_G8_B8R8_420_UNORM:
|
||||
case PIPE_FORMAT_R8_G8_B8_420_UNORM:
|
||||
@@ -218,6 +219,7 @@ pan_linear_or_tiled_row_align_req(unsigned arch, enum pipe_format format,
|
||||
case PIPE_FORMAT_R8_B8G8_422_UNORM:
|
||||
return 16;
|
||||
/* the 10 bit formats have even looser alignment */
|
||||
case PIPE_FORMAT_R10G10B10_420_UNORM_PACKED:
|
||||
case PIPE_FORMAT_R10_G10B10_420_UNORM:
|
||||
case PIPE_FORMAT_R10_G10B10_422_UNORM:
|
||||
return 1;
|
||||
|
||||
@@ -310,7 +310,7 @@ pan_mod_u_tiled_match(uint64_t mod)
|
||||
static bool
|
||||
pan_mod_u_tiled_supports_format(uint64_t mod, enum pipe_format format)
|
||||
{
|
||||
return true;
|
||||
return pan_u_tiled_or_linear_supports_format(format);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
@@ -431,7 +431,7 @@ pan_mod_linear_match(uint64_t mod)
|
||||
static bool
|
||||
pan_mod_linear_supports_format(uint64_t mod, enum pipe_format format)
|
||||
{
|
||||
return true;
|
||||
return pan_u_tiled_or_linear_supports_format(format);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
||||
@@ -275,8 +275,10 @@ pan_clump_format(enum pipe_format format)
|
||||
case PIPE_FORMAT_R8_B8G8_420_UNORM:
|
||||
case PIPE_FORMAT_R8_G8_B8_420_UNORM:
|
||||
case PIPE_FORMAT_R8_B8_G8_420_UNORM:
|
||||
case PIPE_FORMAT_R8G8B8_420_UNORM_PACKED:
|
||||
return MALI_CLUMP_FORMAT_Y8_UV8_420;
|
||||
case PIPE_FORMAT_R10_G10B10_420_UNORM:
|
||||
case PIPE_FORMAT_R10G10B10_420_UNORM_PACKED:
|
||||
return MALI_CLUMP_FORMAT_Y10_UV10_420;
|
||||
case PIPE_FORMAT_R10_G10B10_422_UNORM:
|
||||
return MALI_CLUMP_FORMAT_Y10_UV10_422;
|
||||
|
||||
@@ -603,7 +603,15 @@ format_can_do_mod(unsigned arch, enum pipe_format format, unsigned plane_idx,
|
||||
assert(modifier == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED ||
|
||||
modifier == DRM_FORMAT_MOD_LINEAR);
|
||||
|
||||
return true;
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_R8G8B8_420_UNORM_PACKED:
|
||||
case PIPE_FORMAT_R10G10B10_420_UNORM_PACKED:
|
||||
/* Those are only supported with AFBC. */
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,10 @@ panvk_image_can_use_mod(struct panvk_image *image, uint64_t mod)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Some formats can only be used with AFBC. */
|
||||
if (!pan_u_tiled_or_linear_supports_format(pfmt))
|
||||
return false;
|
||||
|
||||
if (mod == DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED) {
|
||||
/* Multiplanar YUV with U-interleaving isn't supported by the HW. We
|
||||
* also need to make sure images that can be aliased to planes of
|
||||
|
||||
Reference in New Issue
Block a user