frontends/va: Process VAEncSequenceParameterBufferType first in vaRenderPicture

The encoder is created in handleVAEncSequenceParameterBufferType and it
also sets some default parameters, so we need to make sure to handle
this buffer first because application may have already set those
parameters from earlier buffers.

This fixes setting HRD parameters with gstreamer vah264enc/vah265enc
when PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL is supported.

Cc: mesa-stable
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25355>
(cherry picked from commit c970a9b663)
This commit is contained in:
David Rosca 2023-09-23 13:11:57 +02:00 committed by Eric Engestrom
parent 61129036fe
commit 58f52f8b4e
2 changed files with 10 additions and 5 deletions

View File

@ -922,7 +922,7 @@
"description": "frontends/va: Process VAEncSequenceParameterBufferType first in vaRenderPicture",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@ -721,6 +721,7 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
unsigned i;
unsigned slice_idx = 0;
vlVaBuffer *seq_param_buf = NULL;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@ -746,8 +747,16 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
if (buf->type == VAProtectedSliceDataBufferType)
handleVAProtectedSliceDataBufferType(context, buf);
else if (buf->type == VAEncSequenceParameterBufferType)
seq_param_buf = buf;
}
/* Now process VAEncSequenceParameterBufferType where the encoder is created
* and some default parameters are set to make sure it won't overwrite
* parameters already set by application from earlier buffers. */
if (seq_param_buf)
vaStatus = handleVAEncSequenceParameterBufferType(drv, context, seq_param_buf);
for (i = 0; i < num_buffers && vaStatus == VA_STATUS_SUCCESS; ++i) {
vlVaBuffer *buf = handle_table_get(drv->htab, buffers[i]);
@ -780,10 +789,6 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
vaStatus = vlVaHandleVAProcPipelineParameterBufferType(drv, context, buf);
break;
case VAEncSequenceParameterBufferType:
vaStatus = handleVAEncSequenceParameterBufferType(drv, context, buf);
break;
case VAEncMiscParameterBufferType:
vaStatus = handleVAEncMiscParameterBufferType(context, buf);
break;