Module: Mesa Branch: staging/23.2 Commit: 136be4a64d4c2f454553461b27d1b2298e995c65 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=136be4a64d4c2f454553461b27d1b2298e995c65
Author: David Rosca <[email protected]> Date: Sat Sep 23 13:11:57 2023 +0200 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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25355> (cherry picked from commit c970a9b6634d22d8b9b7567aff8708dc58ba9e81) --- .pick_status.json | 2 +- src/gallium/frontends/va/picture.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e32842a109e..8bb08a0e9b2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -154,7 +154,7 @@ "description": "frontends/va: Process VAEncSequenceParameterBufferType first in vaRenderPicture", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/va/picture.c b/src/gallium/frontends/va/picture.c index 737a1d1b301..3e9eb8c5f88 100644 --- a/src/gallium/frontends/va/picture.c +++ b/src/gallium/frontends/va/picture.c @@ -775,6 +775,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; @@ -800,8 +801,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]); @@ -834,10 +843,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;
