summaryrefslogtreecommitdiff
path: root/mm-video-v4l2
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-09-21 14:46:07 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-09-21 14:46:06 -0700
commite1c701151c7f71a7a069e6b24ae299b7453403e9 (patch)
treed091fb7f5bcd3a63827e91683532c7353ee79dec /mm-video-v4l2
parent7d5d1cca0c9ec885d5fe37bb26a8dbbc1b82496a (diff)
parent971a4b485f2bac221f30919e3067f71a17a89a9f (diff)
downloadmedia-e1c701151c7f71a7a069e6b24ae299b7453403e9.tar.gz
Merge "mm-video-v4l2: vidc: Handle special value of operating rate"
Diffstat (limited to 'mm-video-v4l2')
-rw-r--r--mm-video-v4l2/vidc/vdec/inc/omx_vdec.h1
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp10
-rw-r--r--mm-video-v4l2/vidc/venc/inc/omx_video_base.h1
-rw-r--r--[-rwxr-xr-x]mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h1
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_base.cpp9
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp4
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp31
7 files changed, 46 insertions, 11 deletions
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
index 761407d7..cd75dd04 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -1186,6 +1186,7 @@ class omx_vdec: public qc_omx_component
OMX_U32 m_reconfig_height;
bool m_smoothstreaming_mode;
bool m_decode_order_mode;
+ bool m_client_req_turbo_mode;
bool m_input_pass_buffer_fd;
DescribeColorAspectsParams m_client_color_space;
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
index b0b0dbf3..bf9c7533 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -833,6 +833,7 @@ omx_vdec::omx_vdec(): m_error_propogated(false),
m_smoothstreaming_width = 0;
m_smoothstreaming_height = 0;
m_decode_order_mode = false;
+ m_client_req_turbo_mode = false;
is_q6_platform = false;
m_input_pass_buffer_fd = false;
memset(&m_extradata_info, 0, sizeof(m_extradata_info));
@@ -5178,7 +5179,14 @@ OMX_ERRORTYPE omx_vdec::set_config(OMX_IN OMX_HANDLETYPE hComp,
control.id = V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE;
control.value = rate->nU32;
- operating_frame_rate = rate->nU32 >> 16;
+ if (rate->nU32 == QOMX_VIDEO_HIGH_PERF_OPERATING_MODE) {
+ DEBUG_PRINT_LOW("Turbo mode requested");
+ m_client_req_turbo_mode = true;
+ } else {
+ operating_frame_rate = rate->nU32 >> 16;
+ m_client_req_turbo_mode = false;
+ DEBUG_PRINT_LOW("Operating Rate Set = %d fps", operating_frame_rate);
+ }
if (ioctl(drv_ctx.video_driver_fd, VIDIOC_S_CTRL, &control)) {
ret = errno == -EBUSY ? OMX_ErrorInsufficientResources :
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
index 5bc226f4..9e090257 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h
@@ -727,6 +727,7 @@ class omx_video: public qc_omx_component
QOMX_ENABLETYPE m_sParamControlInputQueue;
OMX_TIME_CONFIG_TIMESTAMPTYPE m_sConfigInputTrigTS;
QOMX_EXTNINDEX_VIDEO_LOW_LATENCY_MODE m_sParamLowLatency;
+ OMX_U32 m_nOperatingRate;
// fill this buffer queue
omx_cmd_queue m_ftb_q;
diff --git a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
index b161037b..9315fd00 100755..100644
--- a/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
+++ b/mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h
@@ -462,6 +462,7 @@ class venc_dev
OMX_BOOL downscalar_enabled;
bool client_req_disable_bframe;
bool client_req_disable_temporal_layers;
+ bool client_req_turbo_mode;
bool venc_query_cap(struct v4l2_queryctrl &cap);
bool venc_validate_range(OMX_S32 id, OMX_S32 val);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
index c6c2cee9..64bfabc9 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp
@@ -2282,6 +2282,15 @@ OMX_ERRORTYPE omx_video::get_config(OMX_IN OMX_HANDLETYPE hComp,
memcpy(pParam, &m_sConfigIntraRefresh, sizeof(m_sConfigIntraRefresh));
break;
}
+ case OMX_IndexConfigOperatingRate:
+ {
+ VALIDATE_OMX_PARAM_DATA(configData, OMX_PARAM_U32TYPE);
+ OMX_PARAM_U32TYPE* pParam =
+ reinterpret_cast<OMX_PARAM_U32TYPE*>(configData);
+ DEBUG_PRINT_LOW("get_config: OMX_IndexConfigOperatingRate");
+ pParam->nU32 = m_nOperatingRate;
+ break;
+ }
case OMX_QTIIndexConfigVideoBlurResolution:
{
VALIDATE_OMX_PARAM_DATA(configData, OMX_QTI_VIDEO_CONFIG_BLURINFO);
diff --git a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
index d0ac14ab..9c0f9fd2 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -1897,11 +1897,13 @@ OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
case OMX_IndexConfigOperatingRate:
{
VALIDATE_OMX_PARAM_DATA(configData, OMX_PARAM_U32TYPE);
+ OMX_PARAM_U32TYPE* pParam = (OMX_PARAM_U32TYPE*) configData;
if (!handle->venc_set_config(configData, (OMX_INDEXTYPE)OMX_IndexConfigOperatingRate)) {
- DEBUG_PRINT_ERROR("Failed to set OMX_IndexConfigOperatingRate");
+ DEBUG_PRINT_ERROR("Failed to set OMX_IndexConfigOperatingRate %u", pParam->nU32 >> 16);
return handle->hw_overload ? OMX_ErrorInsufficientResources :
OMX_ErrorUnsupportedSetting;
}
+ m_nOperatingRate = pParam->nU32;
break;
}
case OMX_QTIIndexConfigVideoRoiInfo:
diff --git a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
index 3dfd26b3..8b8f2767 100644
--- a/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
+++ b/mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp
@@ -143,11 +143,12 @@ venc_dev::venc_dev(class omx_venc *venc_class)
memset(&ltrinfo, 0, sizeof(ltrinfo));
memset(&fd_list, 0, sizeof(fd_list));
sess_priority.priority = 1;
- operating_rate = 0;
+ operating_rate = 30;
memset(&color_space, 0x0, sizeof(color_space));
memset(&temporal_layers_config, 0x0, sizeof(temporal_layers_config));
client_req_disable_bframe = false;
client_req_disable_temporal_layers = false;
+ client_req_turbo_mode = false;
Platform::Config::getInt32(Platform::vidc_enc_log_in,
@@ -2861,7 +2862,7 @@ bool venc_dev::venc_set_config(void *configData, OMX_INDEXTYPE index)
case OMX_IndexConfigOperatingRate:
{
OMX_PARAM_U32TYPE *rate = (OMX_PARAM_U32TYPE *)configData;
- DEBUG_PRINT_LOW("Set_config: operating rate %d", rate->nU32);
+ DEBUG_PRINT_LOW("Set_config: operating rate %u", rate->nU32);
if (!venc_set_operatingrate(rate->nU32)) {
DEBUG_PRINT_ERROR("Failed to set operating rate");
return false;
@@ -3205,6 +3206,10 @@ unsigned venc_dev::venc_start(void)
if (vqzip_sei_info.enabled && !venc_set_vqzip_defaults())
return 1;
+ if (!venc_set_priority(sess_priority.priority)) {
+ DEBUG_PRINT_ERROR("Failed to set priority");
+ return 1;
+ }
// Client can set intra refresh period in terms of frames.
// This requires reconfiguration on port redefinition as
// mbcount for IR depends on encode resolution.
@@ -3375,7 +3380,7 @@ void venc_dev::venc_config_print()
DEBUG_PRINT_HIGH("ENC_CONFIG: Peak bitrate: %d", peak_bitrate.peakbitrate);
- DEBUG_PRINT_HIGH("ENC_CONFIG: Session Priority: %u", sess_priority.priority);
+ DEBUG_PRINT_HIGH("ENC_CONFIG: Session Priority: %s", sess_priority.priority ? "NonRealTime" : "RealTime");
DEBUG_PRINT_HIGH("ENC_CONFIG: ROI : %u", m_roi_enabled);
@@ -4814,7 +4819,7 @@ bool venc_dev::venc_reconfigure_intra_period()
isValidFps = true;
}
- if ((operating_rate >> 16) <= VENC_BFRAME_MAX_FPS) {
+ if (operating_rate <= VENC_BFRAME_MAX_FPS) {
isValidOpRate = true;
}
@@ -6102,6 +6107,7 @@ bool venc_dev::venc_set_vpx_error_resilience(OMX_BOOL enable)
bool venc_dev::venc_set_priority(OMX_U32 priority) {
struct v4l2_control control;
+ DEBUG_PRINT_LOW("venc_set_priority: %s", priority ? "NonRealTime" : "RealTime");
control.id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY;
if (priority == 0)
control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE;
@@ -6122,8 +6128,8 @@ bool venc_dev::venc_set_operatingrate(OMX_U32 rate) {
control.id = V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE;
control.value = rate;
- DEBUG_PRINT_LOW("venc_set_operating_rate: %d fps", rate >> 16);
- DEBUG_PRINT_LOW("Calling IOCTL set control for id=%d, val=%d", control.id, control.value);
+ DEBUG_PRINT_LOW("venc_set_operating_rate: %u fps", rate >> 16);
+ DEBUG_PRINT_LOW("Calling IOCTL set control for id=%d, val=%u", control.id, control.value);
if(ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control)) {
hw_overload = errno == EBUSY;
@@ -6131,8 +6137,15 @@ bool venc_dev::venc_set_operatingrate(OMX_U32 rate) {
rate >> 16, hw_overload ? "HW overload" : strerror(errno));
return false;
}
- operating_rate = rate;
- DEBUG_PRINT_LOW("Operating Rate Set = %d fps", rate >> 16);
+ if (rate == QOMX_VIDEO_HIGH_PERF_OPERATING_MODE) {
+ DEBUG_PRINT_LOW("Turbo mode requested");
+ client_req_turbo_mode = true;
+ } else {
+ operating_rate = rate >> 16;
+ client_req_turbo_mode = false;
+ DEBUG_PRINT_LOW("Operating Rate Set = %d fps", rate >> 16);
+ }
+
return true;
}
@@ -6537,7 +6550,7 @@ bool venc_dev::venc_convert_abs2cum_bitrate(QOMX_EXTNINDEX_VIDEO_HYBRID_HP_MODE
bool venc_dev::venc_validate_temporal_settings() {
- if (((m_sVenc_cfg.fps_num / m_sVenc_cfg.fps_den) < 60) && ((operating_rate >> 16) < 60)) {
+ if (((m_sVenc_cfg.fps_num / m_sVenc_cfg.fps_den) < 60) && (operating_rate < 60)) {
DEBUG_PRINT_HIGH("TemporalLayer: Invalid FPS/operating rate settings for Hier layers");
return false;
}