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 not supported then the only valid value for this
attribute is VA_ATTRIB_NOT_SUPPORTED.  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 intel#362.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
  • Loading branch information
fhvwy committed Mar 8, 2018
1 parent bb92421 commit 7294d6c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/i965_drv_video.c
Expand Up @@ -1431,8 +1431,23 @@ 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))
vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
if (enc_packed_attribs == VA_ATTRIB_NOT_SUPPORTED) {
if (attrib_found->value != 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 7294d6c

Please sign in to comment.