Mesa (main): frontends/va: add num_temporal_layers check

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 19 15:15:25 UTC 2021


Module: Mesa
Branch: main
Commit: 8e5e70bb3de7f75ab1b039e2cec2975ba59e4af7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e5e70bb3de7f75ab1b039e2cec2975ba59e4af7

Author: Boyuan Zhang <boyuan.zhang at amd.com>
Date:   Wed Aug 18 22:47:05 2021 -0400

frontends/va: add num_temporal_layers check

Fixes: 51935d59

temporal_id check is valid only if the num_temporal_layers is set (>0).
When num_temporal_layers is 0, we shouldn't check temporal_id and return
error.

Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
Reviewed-by: Thong Thai <thong.thai at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12463>

---

 src/gallium/frontends/va/picture_h264_enc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/va/picture_h264_enc.c b/src/gallium/frontends/va/picture_h264_enc.c
index 18890aed7a2..466b920c9bc 100644
--- a/src/gallium/frontends/va/picture_h264_enc.c
+++ b/src/gallium/frontends/va/picture_h264_enc.c
@@ -157,7 +157,8 @@ vlVaHandleVAEncMiscParameterTypeRateControlH264(vlVaContext *context, VAEncMiscP
       context->desc.h264enc.rate_ctrl[temporal_id].target_bitrate =
          rc->bits_per_second * (rc->target_percentage / 100.0);
 
-   if (temporal_id >= context->desc.h264enc.num_temporal_layers)
+   if (context->desc.h264enc.num_temporal_layers > 0 &&
+       temporal_id >= context->desc.h264enc.num_temporal_layers)
       return VA_STATUS_ERROR_INVALID_PARAMETER;
 
    context->desc.h264enc.rate_ctrl[temporal_id].peak_bitrate = rc->bits_per_second;



More information about the mesa-commit mailing list