diff options
author | Boyuan Zhang <[email protected]> | 2018-01-25 14:18:09 -0500 |
---|---|---|
committer | Leo Liu <[email protected]> | 2018-02-05 09:16:18 -0500 |
commit | ecc39443440dd1512b68d427b6b2ecd939a42173 (patch) | |
tree | fea6be57b8b21b54d0d2f4cffeb22e8fbb1f3451 /src/gallium/state_trackers/va | |
parent | 9393b53c2937a810bec1b150880a22f4b84cb0e3 (diff) |
st/va: add HEVC picture desc
Add HEVC picture desc, and add codec check when creating and destroying
context.
Signed-off-by: Boyuan Zhang <[email protected]>
Acked-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/va')
-rw-r--r-- | src/gallium/state_trackers/va/context.c | 26 | ||||
-rw-r--r-- | src/gallium/state_trackers/va/va_private.h | 1 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c index 78e1f19ab7d..f03b326ff18 100644 --- a/src/gallium/state_trackers/va/context.c +++ b/src/gallium/state_trackers/va/context.c @@ -284,8 +284,18 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, context->desc.base.profile = config->profile; context->desc.base.entry_point = config->entrypoint; if (config->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { - context->desc.h264enc.rate_ctrl.rate_ctrl_method = config->rc; - context->desc.h264enc.frame_idx = util_hash_table_create(handle_hash, handle_compare); + switch (u_reduce_video_profile(context->templat.profile)) { + case PIPE_VIDEO_FORMAT_MPEG4_AVC: + context->desc.h264enc.rate_ctrl.rate_ctrl_method = config->rc; + context->desc.h264enc.frame_idx = util_hash_table_create(handle_hash, handle_compare); + break; + case PIPE_VIDEO_FORMAT_HEVC: + context->desc.h265enc.rc.rate_ctrl_method = config->rc; + context->desc.h265enc.frame_idx = util_hash_table_create(handle_hash, handle_compare); + break; + default: + break; + } } mtx_lock(&drv->mutex); @@ -314,8 +324,16 @@ vlVaDestroyContext(VADriverContextP ctx, VAContextID context_id) if (context->decoder) { if (context->desc.base.entry_point == PIPE_VIDEO_ENTRYPOINT_ENCODE) { - if (context->desc.h264enc.frame_idx) - util_hash_table_destroy (context->desc.h264enc.frame_idx); + if (u_reduce_video_profile(context->decoder->profile) == + PIPE_VIDEO_FORMAT_MPEG4_AVC) { + if (context->desc.h264enc.frame_idx) + util_hash_table_destroy (context->desc.h264enc.frame_idx); + } + if (u_reduce_video_profile(context->decoder->profile) == + PIPE_VIDEO_FORMAT_HEVC) { + if (context->desc.h265enc.frame_idx) + util_hash_table_destroy (context->desc.h265enc.frame_idx); + } } else { if (u_reduce_video_profile(context->decoder->profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) { diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index eef75c6bdae..9b526ea68a4 100644 --- a/src/gallium/state_trackers/va/va_private.h +++ b/src/gallium/state_trackers/va/va_private.h @@ -270,6 +270,7 @@ typedef struct { struct pipe_h265_picture_desc h265; struct pipe_mjpeg_picture_desc mjpeg; struct pipe_h264_enc_picture_desc h264enc; + struct pipe_h265_enc_picture_desc h265enc; } desc; struct { |