GitLab will be down for maintenance this Sunday 13th June, from approx 7-11am UTC. This is for a PostgreSQL migration. See the tracker issue for more informations.

Commit 1fd25b65 authored by Thong Thai's avatar Thong Thai
Browse files

fix libva-util tests va context errors

parent fd2d21a1
Pipeline #253209 waiting for manual action with stages
......@@ -226,6 +226,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
}
}
if (attrib_list[i].type == VAConfigAttribEncPackedHeaders) {
FREE(config);
return VA_STATUS_ERROR_INVALID_VALUE;
}
}
/* Default value if not specified in the input attributes. */
......@@ -248,7 +252,13 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
switch (entrypoint) {
case VAEntrypointVLD:
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
if (p == PIPE_VIDEO_PROFILE_NONE) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
if (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4 ||
!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
PIPE_VIDEO_CAP_SUPPORTED)) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
......@@ -258,7 +268,15 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
break;
case VAEntrypointEncSlice:
if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE,
if (u_reduce_video_profile(p) != PIPE_VIDEO_FORMAT_MPEG4 &&
u_reduce_video_profile(p) != PIPE_VIDEO_FORMAT_MPEG4_AVC &&
u_reduce_video_profile(p) != PIPE_VIDEO_FORMAT_HEVC) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
if (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4 ||
!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE,
PIPE_VIDEO_CAP_SUPPORTED)) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
......@@ -268,12 +286,30 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
break;
default:
if (u_reduce_video_profile(p) == PIPE_VIDEO_FORMAT_MPEG4) {
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
}
FREE(config);
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
config->profile = p;
supported_rt_formats = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_YUV422;
supported_rt_formats = VA_RT_FORMAT_YUV420;
if (config->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
switch (p) {
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422: {
supported_rt_formats |= VA_RT_FORMAT_YUV422;
break;
}
default:
break;
}
}
else
supported_rt_formats |= 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,
......@@ -282,12 +318,21 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
for (int i = 0; i <num_attribs ; i++) {
if (attrib_list[i].type == VAConfigAttribRateControl) {
if (attrib_list[i].value == VA_RC_CBR)
switch (attrib_list[i].value) {
case VA_RC_CBR:
config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT;
else if (attrib_list[i].value == VA_RC_VBR)
break;
case VA_RC_VBR:
config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE;
else
break;
case VA_RC_CQP:
config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE;
break;
default: {
FREE(config);
return VA_STATUS_ERROR_INVALID_VALUE;
}
}
}
if (attrib_list[i].type == VAConfigAttribRTFormat) {
if (attrib_list[i].value & supported_rt_formats) {
......@@ -297,6 +342,14 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
}
}
if (attrib_list[i].type == VAConfigAttribEncPackedHeaders) {
if (attrib_list[i].value > 1 ||
config->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE) {
FREE(config);
return VA_STATUS_ERROR_INVALID_VALUE;
}
break;
}
}
/* Default value if not specified in the input attributes. */
......
......@@ -226,6 +226,9 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
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;
......
......@@ -233,7 +233,7 @@ ProfileToPipe(VAProfile profile)
case VAProfileVP9Profile2:
return PIPE_VIDEO_PROFILE_VP9_PROFILE2;
case VAProfileNone:
return PIPE_VIDEO_PROFILE_UNKNOWN;
return PIPE_VIDEO_PROFILE_NONE;
default:
return PIPE_VIDEO_PROFILE_UNKNOWN;
}
......
......@@ -48,6 +48,7 @@ enum pipe_video_format
enum pipe_video_profile
{
PIPE_VIDEO_PROFILE_UNKNOWN,
PIPE_VIDEO_PROFILE_NONE,
PIPE_VIDEO_PROFILE_MPEG1,
PIPE_VIDEO_PROFILE_MPEG2_SIMPLE,
PIPE_VIDEO_PROFILE_MPEG2_MAIN,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment