Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 7c5820d

Browse files
fhvwyxhaihao
authored andcommitted
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 <[email protected]>
1 parent 65ee298 commit 7c5820d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/i965_drv_video.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,21 @@ i965_CreateConfig(VADriverContextP ctx,
14321432
if (attrib_found) {
14331433
uint32_t enc_packed_attribs = i965_get_enc_packed_attributes(ctx, profile, entrypoint);
14341434

1435-
if (!(attrib_found->value & enc_packed_attribs))
1435+
if (enc_packed_attribs == VA_ATTRIB_NOT_SUPPORTED) {
1436+
i965_log_info(ctx, "vaCreateConfig: invalid EncPackedHeaders attribute %#x: "
1437+
"packed headers are not supported.\n", attrib_found->value);
14361438
vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
1439+
} else if (attrib_found->value == 0) {
1440+
i965_log_info(ctx, "vaCreateConfig: setting the EncPackedHeaders attribute to zero to "
1441+
"indicate that no packed headers will be used is deprecated.\n");
1442+
} else {
1443+
if (attrib_found->value & ~enc_packed_attribs) {
1444+
i965_log_info(ctx, "vaCreateConfig: invalid EncPackedHeaders attribute %#x: "
1445+
"some packed headers are not supported (supported set %#x).\n",
1446+
attrib_found->value, enc_packed_attribs);
1447+
vaStatus = VA_STATUS_ERROR_INVALID_VALUE;
1448+
}
1449+
}
14371450
}
14381451
}
14391452

0 commit comments

Comments
 (0)