From cccf2a3c61b3cdc4836ee6a0a30db436fcc6ffe5 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 19 Jan 2018 13:48:56 +0800 Subject: Check the flags of the packed headers when creating a config Signed-off-by: Xiang, Haihao --- src/i965_drv_video.c | 63 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 24e0d15c..9b54597c 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -1000,6 +1000,36 @@ i965_get_rc_attributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint ent return rc_attribs; } +static uint32_t +i965_get_enc_packed_attributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoint) +{ + uint32_t enc_packed_attribs = VA_ATTRIB_NOT_SUPPORTED; + + if (entrypoint == VAEntrypointEncSlice || + entrypoint == VAEntrypointEncSliceLP || + entrypoint == VAEntrypointFEI) { + enc_packed_attribs = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE | VA_ENC_PACKED_HEADER_MISC; + + if (profile == VAProfileH264ConstrainedBaseline || + profile == VAProfileH264Main || + profile == VAProfileH264High || + profile == VAProfileH264StereoHigh || + profile == VAProfileH264MultiviewHigh || + profile == VAProfileHEVCMain || + profile == VAProfileHEVCMain10) { + enc_packed_attribs |= (VA_ENC_PACKED_HEADER_RAW_DATA | VA_ENC_PACKED_HEADER_SLICE); + + } else if (profile == VAProfileVP9Profile0) + enc_packed_attribs = VA_ENC_PACKED_HEADER_RAW_DATA; + + } else if (entrypoint == VAEntrypointEncPicture) { + if (profile == VAProfileJPEGBaseline) + enc_packed_attribs = VA_ENC_PACKED_HEADER_RAW_DATA; + } + + return enc_packed_attribs; +} + VAStatus i965_GetConfigAttributes(VADriverContextP ctx, VAProfile profile, @@ -1031,27 +1061,7 @@ i965_GetConfigAttributes(VADriverContextP ctx, break; case VAConfigAttribEncPackedHeaders: - if (entrypoint == VAEntrypointEncSlice || - entrypoint == VAEntrypointEncSliceLP || - entrypoint == VAEntrypointFEI) { - attrib_list[i].value = VA_ENC_PACKED_HEADER_SEQUENCE | VA_ENC_PACKED_HEADER_PICTURE | VA_ENC_PACKED_HEADER_MISC; - if (profile == VAProfileH264ConstrainedBaseline || - profile == VAProfileH264Main || - profile == VAProfileH264High || - profile == VAProfileH264StereoHigh || - profile == VAProfileH264MultiviewHigh || - profile == VAProfileHEVCMain || - profile == VAProfileHEVCMain10) { - attrib_list[i].value |= (VA_ENC_PACKED_HEADER_RAW_DATA | - VA_ENC_PACKED_HEADER_SLICE); - } else if (profile == VAProfileVP9Profile0) - attrib_list[i].value = VA_ENC_PACKED_HEADER_RAW_DATA; - break; - } else if (entrypoint == VAEntrypointEncPicture) { - if (profile == VAProfileJPEGBaseline) - attrib_list[i].value = VA_ENC_PACKED_HEADER_RAW_DATA; - } else if (entrypoint == VAEntrypointStats) - attrib_list[i].value = VA_ATTRIB_NOT_SUPPORTED; + attrib_list[i].value = i965_get_enc_packed_attributes(ctx, profile, entrypoint); break; @@ -1380,6 +1390,17 @@ i965_CreateConfig(VADriverContextP ctx, } } + if (vaStatus == VA_STATUS_SUCCESS) { + VAConfigAttrib *attrib_found = i965_lookup_config_attribute(obj_config, VAConfigAttribEncPackedHeaders); + + if (attrib_found) { + uint32_t enc_packed_attribs = i965_get_enc_packed_attributes(ctx, profile, entrypoint); + + if (!(attrib_found->value & enc_packed_attribs)) + vaStatus = VA_STATUS_ERROR_INVALID_VALUE; + } + } + if (vaStatus == VA_STATUS_SUCCESS) { VAConfigAttrib attrib; attrib.type = VAConfigAttribEncMaxSlices; -- cgit v1.2.1