From 10c1cc47a6adba9ea83d4df5c154c07f95ac3a40 Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Thu, 21 Jul 2016 19:40:17 -0400 Subject: [PATCH] st/va: get rate control method from configattrib v2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Rate control method is passed from app to driver through config attrib list. That is why we need to store this rate control method to config. And later on, we will pass this value to context->desc.h264enc.rate_ctrl.rate_ctrl_method. v2 (chk): fix broken build and commit message Signed-off-by: Boyuan Zhang Signed-off-by: Christian König --- src/gallium/state_trackers/va/config.c | 11 +++++++++++ src/gallium/state_trackers/va/context.c | 2 ++ src/gallium/state_trackers/va/va_private.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c index 7742087e999..889ce38e676 100644 --- a/src/gallium/state_trackers/va/config.c +++ b/src/gallium/state_trackers/va/config.c @@ -202,6 +202,17 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin config->profile = p; + for (int i = 0; i rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT; + else if (attrib_list[i].value == VA_RC_VBR) + config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE; + else + config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE; + } + } + pipe_mutex_lock(drv->mutex); *config_id = handle_table_add(drv->htab, config); pipe_mutex_unlock(drv->mutex); diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c index 8882cbaf116..65ba7db4de7 100644 --- a/src/gallium/state_trackers/va/context.c +++ b/src/gallium/state_trackers/va/context.c @@ -276,6 +276,8 @@ 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; pipe_mutex_lock(drv->mutex); *context_id = handle_table_add(drv->htab, context); diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h index 520db467058..1addd87303a 100644 --- a/src/gallium/state_trackers/va/va_private.h +++ b/src/gallium/state_trackers/va/va_private.h @@ -229,6 +229,7 @@ typedef struct { struct pipe_vc1_picture_desc vc1; struct pipe_h264_picture_desc h264; struct pipe_h265_picture_desc h265; + struct pipe_h264_enc_picture_desc h264enc; } desc; struct { @@ -246,6 +247,7 @@ typedef struct { typedef struct { enum pipe_video_profile profile; enum pipe_video_entrypoint entrypoint; + enum pipe_h264_enc_rate_control_method rc; } vlVaConfig; typedef struct { -- 2.30.2