[Libva] [Libva-intel-driver][PATCH] decoder/h264: don't assert on invalid parameter

Sean V Kelley seanvk at posteo.de
Fri Aug 5 17:37:29 UTC 2016


On Fri, 2016-08-05 at 13:25 +0800, Xiang, Haihao wrote:
> Remove redundant checking on input parameters as well.
> 
> > This avoids assertion failure in https://bugs.freedesktop.org/show_bu
g.cgi?id=94007,
> > but the upper library should check why are the invalid paramters
passed to libva.


While I agree with that sentiment, we are really not vetting much at
all at the upper library level.  Unfortunately, that means we may
require more changes like this until we start doing more general param
vetting.

Separately, we've started working on some test integration plans for
future experimentation.  That sort of testing at the driver level will
better help us to scope and define what sort of param checking we
want/need at the upper driver level.

Applied.

Thanks,

Sean

> > 
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/i965_decoder_utils.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/i965_decoder_utils.c b/src/i965_decoder_utils.c
index df0abe2..640fd14 100644
--- a/src/i965_decoder_utils.c
+++ b/src/i965_decoder_utils.c
@@ -953,17 +953,9 @@ intel_decoder_check_avc_parameter(VADriverContextP ctx,
     VASliceParameterBufferH264 *slice_param, *next_slice_param, *next_slice_group_param;
     int j;
 
-    assert(!(pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID));
-    assert(pic_param->CurrPic.picture_id != VA_INVALID_SURFACE);
-
-    if (pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID ||
-        pic_param->CurrPic.picture_id == VA_INVALID_SURFACE)
-        goto error;
-
-    assert(pic_param->CurrPic.picture_id == decode_state->current_render_target);
-
-    if (pic_param->CurrPic.picture_id != decode_state->current_render_target)
-        goto error;
+    ASSERT_RET(!(pic_param->CurrPic.flags & VA_PICTURE_H264_INVALID), VA_STATUS_ERROR_INVALID_PARAMETER);
+    ASSERT_RET((pic_param->CurrPic.picture_id != VA_INVALID_SURFACE), VA_STATUS_ERROR_INVALID_PARAMETER);
+    ASSERT_RET((pic_param->CurrPic.picture_id == decode_state->current_render_target), VA_STATUS_ERROR_INVALID_PARAMETER);
 
     if ((h264_profile != VAProfileH264Baseline)) {
        if (pic_param->num_slice_groups_minus1 ||
@@ -1002,7 +994,7 @@ intel_decoder_check_avc_parameter(VADriverContextP ctx,
     }
 
     for (j = 0; j < decode_state->num_slice_params; j++) {
-        assert(decode_state->slice_params && decode_state->slice_params[j]->buffer);
+        ASSERT_RET((decode_state->slice_params && decode_state->slice_params[j]->buffer), VA_STATUS_ERROR_INVALID_PARAMETER);
         slice_param = (VASliceParameterBufferH264 *)decode_state->slice_params[j]->buffer;
 
         if (j == decode_state->num_slice_params - 1)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libva/attachments/20160805/8d4fbb1f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/libva/attachments/20160805/8d4fbb1f/attachment.sig>


More information about the Libva mailing list