diff options
author | Saurabh Kothawade <skothawa@codeaurora.org> | 2017-08-29 15:33:02 -0700 |
---|---|---|
committer | Saurabh Kothawade <skothawa@codeaurora.org> | 2017-09-12 12:36:59 -0700 |
commit | 971a4b485f2bac221f30919e3067f71a17a89a9f (patch) | |
tree | 5aa1ea3c9aea1964bdcbb34951482c640ab6f6d1 /mm-video-v4l2 | |
parent | 4725bf6cf339c683347c75ad692ae756979e2cba (diff) | |
download | media-971a4b485f2bac221f30919e3067f71a17a89a9f.tar.gz |
mm-video-v4l2: vidc: Handle special value of operating rate
Check the value set by client for operating rate. If it is
QOMX_VIDEO_HIGH_PERF_OPERATING_MODE, client wants to use
perfmode. Update internal structures accordingly.
CRs-Fixed: 2106077
Change-Id: Ib7f50bb2f5617d56e8bb776a2f3c8957d5f3e414
Diffstat (limited to 'mm-video-v4l2')
-rw-r--r-- | mm-video-v4l2/vidc/vdec/inc/omx_vdec.h | 1 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp | 10 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/inc/omx_video_base.h | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h | 1 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_video_base.cpp | 9 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp | 31 |
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 0b889160..a6b4014c 100644 --- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h +++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h @@ -1178,6 +1178,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 cda6add0..e8645765 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -828,6 +828,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)); @@ -5146,7 +5147,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 7a844aae..6a66bc15 100644 --- a/mm-video-v4l2/vidc/venc/inc/omx_video_base.h +++ b/mm-video-v4l2/vidc/venc/inc/omx_video_base.h @@ -720,6 +720,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 fcb2e3ff..1bc10842 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 @@ -460,6 +460,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 ef40e291..4b4fa2e4 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_base.cpp @@ -2198,6 +2198,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 249ef200..cc754fca 100644 --- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp +++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp @@ -1850,11 +1850,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 d59d7a95..37ee968c 100755..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 @@ -140,11 +140,12 @@ venc_dev::venc_dev(class omx_venc *venc_class) memset(<rinfo, 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, @@ -2824,7 +2825,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; @@ -3163,6 +3164,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. @@ -3333,7 +3338,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); @@ -4772,7 +4777,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; } @@ -6057,6 +6062,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; @@ -6077,8 +6083,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; @@ -6086,8 +6092,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; } @@ -6492,7 +6505,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; } |