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>
This commit is contained in:
David Rosca 2023-09-23 13:11:57 +02:00 committed by Marge Bot
parent 49e471de70
commit c970a9b663

View File

@ -824,6 +824,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;
@ -849,8 +850,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]);
@ -883,10 +892,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;