summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-02-13 19:44:54 +0000
committerXiang, Haihao <haihao.xiang@intel.com>2018-03-15 08:59:33 +0800
commit7c5820d07db4c686be0866e17d27c1e798f784f0 (patch)
tree5783e5f6859395d640a75d1a1501fe6bf64b4a67
parent65ee29822ca2d077540118d194767ca73b4fe83b (diff)
downloadlibva-intel-driver-7c5820d07db4c686be0866e17d27c1e798f784f0.tar.gz
Fix packed headers attribute test in vaCreateConfig()
If packed headers are supported, then the provided value must be some (possibly empty) subset of the supported headers. This fixes config creation with an empty packed header set, which the user may pass if they don't want to provide any packed headers. This pattern is used in at least libavcodec, where VP9 encoding is broken prior to this change. Since there is intent to deprecate this behaviour in future, also add warnings to this case and the other possible failure modes here. Fixes #362. Signed-off-by: Mark Thompson <sw@jkqxz.net>
-rw-r--r--src/i965_drv_video.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index d87cdc15..0104a92f 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -1432,8 +1432,21 @@ i965_CreateConfig(VADriverContextP ctx,
if (attrib_found) {
uint32_t enc_packed_attribs = i965_get_enc_packed_attributes(ctx, profile, entrypoint);
- if (!(attrib_found->value & enc_packed_attribs))
+ if (enc_packed_attribs == VA_ATTRIB_NOT_SUPPORTED) {
+ i965_log_info(ctx, "vaCreateConfig: invalid EncPackedHeaders attribute %#x: "
+ "packed headers are not supported.\n", attrib_found->value);
vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
+ } else if (attrib_found->value == 0) {
+ i965_log_info(ctx, "vaCreateConfig: setting the EncPackedHeaders attribute to zero to "
+ "indicate that no packed headers will be used is deprecated.\n");
+ } else {
+ if (attrib_found->value & ~enc_packed_attribs) {
+ i965_log_info(ctx, "vaCreateConfig: invalid EncPackedHeaders attribute %#x: "
+ "some packed headers are not supported (supported set %#x).\n",
+ attrib_found->value, enc_packed_attribs);
+ vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
+ }
+ }
}
}