Module: Mesa Branch: main Commit: 44c53786a0de22084ccc53e82322af970a56b6f7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=44c53786a0de22084ccc53e82322af970a56b6f7
Author: Sil Vilerino <[email protected]> Date: Sat Apr 15 16:09:58 2023 -0400 frontend/va: Allow distinction for HRD params sent from app and frontend defaults Reviewed-by: Boyuan Zhang <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22530> --- src/gallium/frontends/va/picture_h264_enc.c | 4 ++++ src/gallium/frontends/va/picture_hevc_enc.c | 4 ++++ src/gallium/include/pipe/p_video_state.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/gallium/frontends/va/picture_h264_enc.c b/src/gallium/frontends/va/picture_h264_enc.c index 0ba2bafac42..86ee3f9a6d8 100644 --- a/src/gallium/frontends/va/picture_h264_enc.c +++ b/src/gallium/frontends/va/picture_h264_enc.c @@ -339,6 +339,10 @@ vlVaHandleVAEncMiscParameterTypeHRDH264(vlVaContext *context, VAEncMiscParameter if (ms->buffer_size) { context->desc.h264enc.rate_ctrl[0].vbv_buffer_size = ms->buffer_size; context->desc.h264enc.rate_ctrl[0].vbv_buf_lv = (ms->initial_buffer_fullness << 6 ) / ms->buffer_size; + context->desc.h264enc.rate_ctrl[0].vbv_buf_initial_size = ms->initial_buffer_fullness; + /* Distinguishes from the default params set for these values in other + functions and app specific params passed down via HRD buffer */ + context->desc.h264enc.rate_ctrl[0].app_requested_hrd_buffer = true; } return VA_STATUS_SUCCESS; diff --git a/src/gallium/frontends/va/picture_hevc_enc.c b/src/gallium/frontends/va/picture_hevc_enc.c index 14013a6c738..5d900e7bd52 100644 --- a/src/gallium/frontends/va/picture_hevc_enc.c +++ b/src/gallium/frontends/va/picture_hevc_enc.c @@ -412,6 +412,10 @@ vlVaHandleVAEncMiscParameterTypeHRDHEVC(vlVaContext *context, VAEncMiscParameter if (ms->buffer_size) { context->desc.h265enc.rc.vbv_buffer_size = ms->buffer_size; context->desc.h265enc.rc.vbv_buf_lv = (ms->initial_buffer_fullness << 6 ) / ms->buffer_size; + context->desc.h265enc.rc.vbv_buf_initial_size = ms->initial_buffer_fullness; + /* Distinguishes from the default params set for these values in other + functions and app specific params passed down via HRD buffer */ + context->desc.h265enc.rc.app_requested_hrd_buffer = true; } return VA_STATUS_SUCCESS; diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index f06e88d66e0..2cb5985e135 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -409,6 +409,8 @@ struct pipe_h264_enc_rate_control unsigned frame_rate_den; unsigned vbv_buffer_size; unsigned vbv_buf_lv; + unsigned vbv_buf_initial_size; + bool app_requested_hrd_buffer; unsigned target_bits_picture; unsigned peak_bits_picture_integer; unsigned peak_bits_picture_fraction; @@ -612,6 +614,8 @@ struct pipe_h265_enc_rate_control unsigned quant_b_frames; unsigned vbv_buffer_size; unsigned vbv_buf_lv; + unsigned vbv_buf_initial_size; + bool app_requested_hrd_buffer; unsigned target_bits_picture; unsigned peak_bits_picture_integer; unsigned peak_bits_picture_fraction;
