summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Rosca <david.rosca@amd.com>2024-07-12 10:54:32 +0200
committerMarge Bot <emma+marge@anholt.net>2024-07-16 22:08:31 +0000
commite040ee1098fa0f327fa65e683aa88da2a6518afd (patch)
tree29705b745a65671c8ecd96ffd317095b1843ce11 /src
parentf6099903c1c072e09b737e22e3f7d32fcde3117e (diff)
frontends/va: Support frame rate per temporal layer for AV1
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30149>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/frontends/va/picture_av1_enc.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gallium/frontends/va/picture_av1_enc.c b/src/gallium/frontends/va/picture_av1_enc.c
index 8ba4d1a783b..2677b997d90 100644
--- a/src/gallium/frontends/va/picture_av1_enc.c
+++ b/src/gallium/frontends/va/picture_av1_enc.c
@@ -799,15 +799,24 @@ vlVaHandleVAEncPackedHeaderDataBufferTypeAV1(vlVaContext *context, vlVaBuffer *b
VAStatus
vlVaHandleVAEncMiscParameterTypeFrameRateAV1(vlVaContext *context, VAEncMiscParameterBuffer *misc)
{
+ unsigned temporal_id;
VAEncMiscParameterFrameRate *fr = (VAEncMiscParameterFrameRate *)misc->data;
- for (int i = 0; i < ARRAY_SIZE(context->desc.av1enc.rc); i++) {
- if (fr->framerate & 0xffff0000) {
- context->desc.av1enc.rc[i].frame_rate_num = fr->framerate & 0xffff;
- context->desc.av1enc.rc[i].frame_rate_den = fr->framerate >> 16 & 0xffff;
- } else {
- context->desc.av1enc.rc[i].frame_rate_num = fr->framerate;
- context->desc.av1enc.rc[i].frame_rate_den = 1;
- }
+
+ temporal_id = context->desc.av1enc.rc[0].rate_ctrl_method !=
+ PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE ?
+ fr->framerate_flags.bits.temporal_id :
+ 0;
+
+ if (context->desc.av1enc.seq.num_temporal_layers > 0 &&
+ temporal_id >= context->desc.av1enc.seq.num_temporal_layers)
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+
+ if (fr->framerate & 0xffff0000) {
+ context->desc.av1enc.rc[temporal_id].frame_rate_num = fr->framerate & 0xffff;
+ context->desc.av1enc.rc[temporal_id].frame_rate_den = fr->framerate >> 16 & 0xffff;
+ } else {
+ context->desc.av1enc.rc[temporal_id].frame_rate_num = fr->framerate;
+ context->desc.av1enc.rc[temporal_id].frame_rate_den = 1;
}
return VA_STATUS_SUCCESS;