radeonsi: Report surface alignment for AV1 encode

This is also useful for AV1 to allow applications to use container crop.

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33083>
This commit is contained in:
David Rosca 2025-01-17 10:25:57 +01:00 committed by Marge Bot
parent ad0f197c6c
commit 604fb68876
2 changed files with 19 additions and 16 deletions

View file

@ -80,12 +80,6 @@ enum radeon_micro_mode
#define RADEON_SURF_PREFER_64K_ALIGNMENT (1ull << 37)
#define RADEON_SURF_VIDEO_REFERENCE (1ull << 38)
enum radeon_enc_hevc_surface_alignment
{
RADEON_ENC_HEVC_SURFACE_LOG2_WIDTH_ALIGNMENT = 6,
RADEON_ENC_HEVC_SURFACE_LOG2_HEIGHT_ALIGNMENT = 4,
};
struct legacy_surf_level {
uint32_t offset_256B; /* divided by 256, the hw can only do 40-bit addresses */
uint32_t slice_size_dw; /* in dwords; max = 4GB / 4. */

View file

@ -470,18 +470,27 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil
}
else
return 0;
case PIPE_VIDEO_CAP_ENC_SURFACE_ALIGNMENT:
if (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN ||
profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10) {
union pipe_enc_cap_surface_alignment attrib;
attrib.value = 0;
attrib.bits.log2_width_alignment = RADEON_ENC_HEVC_SURFACE_LOG2_WIDTH_ALIGNMENT;
attrib.bits.log2_height_alignment = RADEON_ENC_HEVC_SURFACE_LOG2_HEIGHT_ALIGNMENT;
return attrib.value;
case PIPE_VIDEO_CAP_ENC_SURFACE_ALIGNMENT: {
union pipe_enc_cap_surface_alignment attrib = {0};
if (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN ||
profile == PIPE_VIDEO_PROFILE_HEVC_MAIN_10) {
/* 64 x 16 */
attrib.bits.log2_width_alignment = 6;
attrib.bits.log2_height_alignment = 4;
} else if (profile == PIPE_VIDEO_PROFILE_AV1_MAIN) {
if (sscreen->info.vcn_ip_version < VCN_5_0_0) {
/* 64 x 16 */
attrib.bits.log2_width_alignment = 6;
attrib.bits.log2_height_alignment = 4;
} else {
/* 8 x 2 */
attrib.bits.log2_width_alignment = 3;
attrib.bits.log2_height_alignment = 1;
}
}
else
return 0;
return attrib.value;
}
case PIPE_VIDEO_CAP_ENC_RATE_CONTROL_QVBR:
if (sscreen->info.vcn_ip_version >= VCN_3_0_0 &&