[Mesa-dev] [PATCH 07/12] st/va: get rate control method from configattrib
Boyuan Zhang
boyuan.zhang at amd.com
Thu Jun 30 18:30:48 UTC 2016
Signed-off-by: Boyuan Zhang <boyuan.zhang at amd.com>
---
src/gallium/state_trackers/va/config.c | 11 +++++++++++
src/gallium/state_trackers/va/context.c | 3 ++-
src/gallium/state_trackers/va/va_private.h | 1 +
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c
index 73704a1..ea838c0 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -172,6 +172,17 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
config->profile = p;
+ for (int i = 0; i <num_attribs ; i++) {
+ if (attrib_list[i].type == VAConfigAttribRateControl) {
+ if (attrib_list[i].value == VA_RC_CBR)
+ config->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;
+ }
+ }
+
*config_id = handle_table_add(drv->htab, config);
return VA_STATUS_SUCCESS;
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index b4334f4..c67ed1f 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -274,7 +274,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);
pipe_mutex_unlock(drv->mutex);
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h
index 723983d..ad9010a 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -246,6 +246,7 @@ typedef struct {
typedef struct {
VAEntrypoint entrypoint;
enum pipe_video_profile profile;
+ enum pipe_h264_enc_rate_control_method rc;
} vlVaConfig;
typedef struct {
--
2.7.4
More information about the mesa-dev
mailing list