frontends/va: rework VAConfigAttribEncPackedHeaders query

to make it easy to add new values.
enable av1 meta data as the input packed header

Reviewed-by: David Rosca <david.rosca@amd.com>
Signed-off-by: David Rosca <david.rosca@amd.com>
Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30237>
This commit is contained in:
Ruijing Dong
2024-07-16 21:32:55 -04:00
committed by Marge Bot
parent aa86c3a235
commit fc4abbe27d
2 changed files with 18 additions and 10 deletions

View File

@@ -289,11 +289,12 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
case VAConfigAttribEncPackedHeaders:
value = VA_ENC_PACKED_HEADER_NONE;
if ((u_reduce_video_profile(ProfileToPipe(profile)) == PIPE_VIDEO_FORMAT_MPEG4_AVC))
value |= VA_ENC_PACKED_HEADER_SEQUENCE;
value |= ENC_PACKED_HEADERS_H264;
if ((u_reduce_video_profile(ProfileToPipe(profile)) == PIPE_VIDEO_FORMAT_HEVC))
value |= VA_ENC_PACKED_HEADER_SEQUENCE;
value |= ENC_PACKED_HEADERS_HEVC;
else if (u_reduce_video_profile(ProfileToPipe(profile)) == PIPE_VIDEO_FORMAT_AV1)
value |= (VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE);
value |= ENC_PACKED_HEADERS_AV1;
break;
case VAConfigAttribEncMaxSlices:
{
@@ -731,14 +732,15 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
}
}
if (attrib_list[i].type == VAConfigAttribEncPackedHeaders) {
uint32_t attrib_value = attrib_list[i].value;
if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE ||
(((attrib_list[i].value != 0)) &&
((attrib_list[i].value != 1) || u_reduce_video_profile(ProfileToPipe(profile))
!= PIPE_VIDEO_FORMAT_MPEG4_AVC) &&
((attrib_list[i].value != 1) || u_reduce_video_profile(ProfileToPipe(profile))
!= PIPE_VIDEO_FORMAT_HEVC) &&
((attrib_list[i].value > 3) || u_reduce_video_profile(ProfileToPipe(profile))
!= PIPE_VIDEO_FORMAT_AV1))) {
(((attrib_value != 0)) &&
((attrib_value & ENC_PACKED_HEADERS_H264) != attrib_value ||
u_reduce_video_profile(ProfileToPipe(profile)) != PIPE_VIDEO_FORMAT_MPEG4_AVC) &&
((attrib_value & ENC_PACKED_HEADERS_HEVC) != attrib_value ||
u_reduce_video_profile(ProfileToPipe(profile)) != PIPE_VIDEO_FORMAT_HEVC) &&
((attrib_value & ENC_PACKED_HEADERS_AV1) != attrib_value ||
u_reduce_video_profile(ProfileToPipe(profile)) != PIPE_VIDEO_FORMAT_AV1))) {
FREE(config);
return VA_STATUS_ERROR_INVALID_VALUE;
}

View File

@@ -85,6 +85,12 @@
#define VBAQ_DISABLE (0)
#define VBAQ_AUTO (1)
#define ENC_PACKED_HEADERS_H264 (VA_ENC_PACKED_HEADER_SEQUENCE)
#define ENC_PACKED_HEADERS_HEVC (VA_ENC_PACKED_HEADER_SEQUENCE)
#define ENC_PACKED_HEADERS_AV1 (VA_ENC_PACKED_HEADER_SEQUENCE | \
VA_ENC_PACKED_HEADER_PICTURE | \
VA_ENC_PACKED_HEADER_MISC)
static inline enum pipe_video_chroma_format
ChromaToPipe(int format)
{