}
p = ProfileToPipe(profile);
- if (p == PIPE_VIDEO_PROFILE_UNKNOWN)
+ if (p == PIPE_VIDEO_PROFILE_UNKNOWN ||
+ (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4 &&
+ !debug_get_option_mpeg4()))
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
pscreen = VL_VA_PSCREEN(ctx);
if (!config)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
- if (profile == VAProfileNone && entrypoint == VAEntrypointVideoProc) {
+ if (profile == VAProfileNone) {
+ if (entrypoint != VAEntrypointVideoProc)
+ return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_UNKNOWN;
config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
supported_rt_formats = VA_RT_FORMAT_YUV420 |
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
}
+ } else {
+ /*other attrib_types are not supported.*/
+ FREE(config);
+ return VA_STATUS_ERROR_INVALID_VALUE;
}
}
}
p = ProfileToPipe(profile);
- if (p == PIPE_VIDEO_PROFILE_UNKNOWN) {
+ if (p == PIPE_VIDEO_PROFILE_UNKNOWN ||
+ (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4 &&
+ !debug_get_option_mpeg4())) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
}
switch (entrypoint) {
case VAEntrypointVLD:
+ supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_SUPPORTED)) {
FREE(config);
- return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_BITSTREAM;
break;
case VAEntrypointEncSlice:
+ supported_rt_formats = VA_RT_FORMAT_YUV420;
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE,
PIPE_VIDEO_CAP_SUPPORTED)) {
FREE(config);
- return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_ENCODE;
}
config->profile = p;
- supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
if (pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P010, p,
config->entrypoint) ||
pscreen->is_video_format_supported(pscreen, PIPE_FORMAT_P016, p,
supported_rt_formats |= VA_RT_FORMAT_YUV420_10BPP;
for (int i = 0; i <num_attribs ; i++) {
+ if (attrib_list[i].type != VAConfigAttribRTFormat &&
+ entrypoint == VAEntrypointVLD ) {
+ FREE(config);
+ return VA_STATUS_ERROR_INVALID_VALUE;
+ }
if (attrib_list[i].type == VAConfigAttribRateControl) {
if (attrib_list[i].value == VA_RC_CBR)
config->rc = PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT;
else if (attrib_list[i].value == VA_RC_VBR)
config->rc = PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE;
- else
+ else if (attrib_list[i].value == VA_RC_CQP)
config->rc = PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE;
+ else {
+ FREE(config);
+ return VA_STATUS_ERROR_INVALID_VALUE;
+ }
}
if (attrib_list[i].type == VAConfigAttribRTFormat) {
if (attrib_list[i].value & supported_rt_formats) {
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
}
}
+ if (attrib_list[i].type == VAConfigAttribEncPackedHeaders) {
+ if (attrib_list[i].value != 0) {
+ FREE(config);
+ return VA_STATUS_ERROR_INVALID_VALUE;
+ }
+ }
}
/* Default value if not specified in the input attributes. */
vlVaContext *context;
vlVaConfig *config;
int is_vpp;
+ int max_supported_width,max_supported_height;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
config = handle_table_get(drv->htab, config_id);
mtx_unlock(&drv->mutex);
+ if (!config)
+ return VA_STATUS_ERROR_INVALID_CONFIG;
+
is_vpp = config->profile == PIPE_VIDEO_PROFILE_UNKNOWN && !picture_width &&
!picture_height && !flag && !render_targets && !num_render_targets;
if (is_vpp) {
context->decoder = NULL;
} else {
+ if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_UNKNOWN) {
+ max_supported_width = drv->vscreen->pscreen->get_video_param(drv->vscreen->pscreen,
+ config->profile, config->entrypoint,
+ PIPE_VIDEO_CAP_MAX_WIDTH);
+ max_supported_height = drv->vscreen->pscreen->get_video_param(drv->vscreen->pscreen,
+ config->profile, config->entrypoint,
+ PIPE_VIDEO_CAP_MAX_HEIGHT);
+
+ if (picture_width > max_supported_width || picture_height > max_supported_height)
+ return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED;
+ }
context->templat.profile = config->profile;
context->templat.entrypoint = config->entrypoint;
context->templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;