Skip to content

Commit

Permalink
Fix packed headers attribute test in vaCreateConfig()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fhvwy authored and xhaihao committed Mar 15, 2018
1 parent 65ee298 commit 7c5820d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/i965_drv_video.c
Expand Up @@ -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;
}
}
}
}

Expand Down

0 comments on commit 7c5820d

Please sign in to comment.