[Mesa-dev] [PATCH 9/9] st/va: enable h264 VAAPI encode
Boyuan Zhang
boyuan.zhang at amd.com
Thu Jul 21 23:40:22 UTC 2016
Enable H.264 VAAPI encoding through config. Currently only H.264 baseline is supported. Encode entrypoint is not accepted by driver.
Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
---
src/gallium/state_trackers/va/config.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c
index be151c8..aab01a0 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -74,6 +74,7 @@ vlVaQueryConfigEntrypoints(VADriverContextP ctx, VAProfile profile,
{
struct pipe_screen *pscreen;
enum pipe_video_profile p;
+ int va_status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -90,12 +91,18 @@ vlVaQueryConfigEntrypoints(VADriverContextP ctx, VAProfile profile,
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
pscreen = VL_VA_PSCREEN(ctx);
- if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED))
- return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
-
- entrypoint_list[(*num_entrypoints)++] = VAEntrypointVLD;
+ if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED)) {
+ entrypoint_list[(*num_entrypoints)++] = VAEntrypointVLD;
+ va_status = VA_STATUS_SUCCESS;
+ }
+ if (pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED) &&
+ p == PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE) {
+ entrypoint_list[(*num_entrypoints)++] = VAEntrypointEncSlice;
+ entrypoint_list[(*num_entrypoints)++] = VAEntrypointEncPicture;
+ va_status = VA_STATUS_SUCCESS;
+ }
- return VA_STATUS_SUCCESS;
+ return va_status;;
}
VAStatus
@@ -114,7 +121,7 @@ vlVaGetConfigAttributes(VADriverContextP ctx, VAProfile profile, VAEntrypoint en
value = VA_RT_FORMAT_YUV420;
break;
case VAConfigAttribRateControl:
- value = VA_RC_NONE;
+ value = VA_RC_CQP | VA_RC_CBR;
break;
default:
value = VA_ATTRIB_NOT_SUPPORTED;
@@ -161,17 +168,20 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
pscreen = VL_VA_PSCREEN(ctx);
- if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED))
- return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
-
- if (entrypoint != VAEntrypointVLD)
+ if (entrypoint == VAEntrypointVLD) {
+ if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED))
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ }
+ else if (entrypoint == VAEntrypointEncSlice) {
+ if (!pscreen->get_video_param(pscreen, p, PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
+ }
+ else
return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
-#if 0
if (entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointEncPicture)
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_ENCODE;
else
-#endif
config->entrypoint = PIPE_VIDEO_ENTRYPOINT_BITSTREAM;
config->profile = p;
--
2.7.4
More information about the mesa-dev
mailing list