summaryrefslogtreecommitdiffstats
path: root/mm-video
diff options
context:
space:
mode:
authorDeepak Verma <dverma@codeaurora.org>2013-07-08 18:09:08 +0530
committerMaheshwar Ajja <majja@codeaurora.org>2013-07-09 20:33:41 +0530
commit1e19c47607a9a59c0b9b41a782a6603c14f1e6f5 (patch)
tree4074926838ba6075ae35f427d78d2734fa6e4061 /mm-video
parentb091030234c29e0334c330c047a009c5b535351c (diff)
downloadandroid_hardware_qcom_media-1e19c47607a9a59c0b9b41a782a6603c14f1e6f5.tar.gz
android_hardware_qcom_media-1e19c47607a9a59c0b9b41a782a6603c14f1e6f5.tar.bz2
android_hardware_qcom_media-1e19c47607a9a59c0b9b41a782a6603c14f1e6f5.zip
mm-video: Get current performance level of video driver
Get current performance level of video driver. Client can use this info to decide whether to start another video session in parallel or not. Change-Id: I95da6e2b995230bec6469845c84e66f6e3c92816
Diffstat (limited to 'mm-video')
-rw-r--r--mm-video/vidc/vdec/inc/omx_vdec.h1
-rw-r--r--mm-video/vidc/vdec/src/omx_vdec.cpp20
-rw-r--r--mm-video/vidc/venc/inc/omx_video_base.h3
-rw-r--r--mm-video/vidc/venc/inc/omx_video_encoder.h1
-rw-r--r--mm-video/vidc/venc/inc/video_encoder_device.h1
-rw-r--r--mm-video/vidc/venc/src/omx_video_base.cpp7
-rw-r--r--mm-video/vidc/venc/src/omx_video_encoder.cpp10
-rw-r--r--mm-video/vidc/venc/src/video_encoder_device.cpp13
8 files changed, 54 insertions, 2 deletions
diff --git a/mm-video/vidc/vdec/inc/omx_vdec.h b/mm-video/vidc/vdec/inc/omx_vdec.h
index 3dcc8d5e..d9258bc5 100644
--- a/mm-video/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video/vidc/vdec/inc/omx_vdec.h
@@ -777,6 +777,7 @@ private:
unsigned nal_length;
bool look_ahead_nal;
int first_frame;
+ unsigned int current_performance;
unsigned char *first_buffer;
int first_frame_size;
unsigned char m_hwdevice_name[80];
diff --git a/mm-video/vidc/vdec/src/omx_vdec.cpp b/mm-video/vidc/vdec/src/omx_vdec.cpp
index 5f6ef475..747c7b76 100644
--- a/mm-video/vidc/vdec/src/omx_vdec.cpp
+++ b/mm-video/vidc/vdec/src/omx_vdec.cpp
@@ -549,7 +549,8 @@ omx_vdec::omx_vdec(): m_state(OMX_StateInvalid),
secure_mode(false),
m_use_uncache_buffers(false),
external_meta_buffer(false),
- external_meta_buffer_iommu(false)
+ external_meta_buffer_iommu(false),
+ current_performance(0)
#ifdef _ANDROID_
,iDivXDrmDecrypt(NULL)
#endif
@@ -1336,6 +1337,13 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)
eRet = OMX_ErrorInsufficientResources;
goto cleanup;
}
+
+ ioctl_msg = {NULL,NULL};
+ ioctl_msg.out = (void*)&current_performance;
+ (void)(ioctl(drv_ctx.video_driver_fd, VDEC_IOCTL_GET_PERF_LEVEL, &ioctl_msg));
+ DEBUG_PRINT_HIGH("component_init: current performance level = %u ",
+ current_performance);
+
#ifdef _ANDROID_
if(is_secure)
sendBroadCastEvent(String16("qualcomm.intent.action.SECURE_START_DONE"));
@@ -3948,6 +3956,16 @@ OMX_ERRORTYPE omx_vdec::get_config(OMX_IN OMX_HANDLETYPE hComp,
memcpy(rect, &rectangle, sizeof(OMX_CONFIG_RECTTYPE));
break;
}
+ case OMX_QcomIndexParamVideoPerformanceLevel:
+ {
+ struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
+ OMX_QCOM_QUERY_PERFORMANCE *decoder_cur_perf_lvl =
+ (OMX_QCOM_QUERY_PERFORMANCE*)configData;
+ decoder_cur_perf_lvl->performance = current_performance;
+ DEBUG_PRINT_HIGH("get_config: current performance level = %d ",
+ decoder_cur_perf_lvl->performance);
+ break;
+ }
default:
{
diff --git a/mm-video/vidc/venc/inc/omx_video_base.h b/mm-video/vidc/venc/inc/omx_video_base.h
index ab120760..1763aefa 100644
--- a/mm-video/vidc/venc/inc/omx_video_base.h
+++ b/mm-video/vidc/venc/inc/omx_video_base.h
@@ -197,6 +197,7 @@ public:
virtual bool dev_empty_buf(void *, void *,unsigned,unsigned) = 0;
virtual bool dev_fill_buf(void *buffer, void *,unsigned,unsigned) = 0;
virtual bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32) = 0;
+ virtual bool dev_get_curr_perf_lvl(OMX_PTR) = 0;
virtual bool dev_get_seq_hdr(void *, unsigned, unsigned *) = 0;
virtual bool dev_loaded_start(void) = 0;
virtual bool dev_loaded_stop(void) = 0;
@@ -563,6 +564,8 @@ public:
unsigned int m_flags;
unsigned int m_etb_count;
unsigned int m_fbd_count;
+
+ unsigned int m_curr_perf;
#ifdef _ANDROID_
// Heap pointer to frame buffers
sp<MemoryHeapBase> m_heap_ptr;
diff --git a/mm-video/vidc/venc/inc/omx_video_encoder.h b/mm-video/vidc/venc/inc/omx_video_encoder.h
index 4ba6d211..3e0900da 100644
--- a/mm-video/vidc/venc/inc/omx_video_encoder.h
+++ b/mm-video/vidc/venc/inc/omx_video_encoder.h
@@ -72,6 +72,7 @@ private:
bool dev_empty_buf(void *, void *,unsigned,unsigned);
bool dev_fill_buf(void *, void *,unsigned,unsigned);
bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
+ bool dev_get_curr_perf_lvl(OMX_PTR);
bool dev_set_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
bool update_profile_level();
bool dev_get_seq_hdr(void *, unsigned, unsigned *);
diff --git a/mm-video/vidc/venc/inc/video_encoder_device.h b/mm-video/vidc/venc/inc/video_encoder_device.h
index 04d9a0e5..631feb10 100644
--- a/mm-video/vidc/venc/inc/video_encoder_device.h
+++ b/mm-video/vidc/venc/inc/video_encoder_device.h
@@ -72,6 +72,7 @@ public:
unsigned long *,unsigned long);
bool venc_set_buf_req(unsigned long *,unsigned long *,
unsigned long *,unsigned long);
+ bool venc_get_curr_perf_lvl(OMX_PTR);
bool venc_set_param(void *,OMX_INDEXTYPE);
bool venc_set_config(void *configData, OMX_INDEXTYPE index);
bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
diff --git a/mm-video/vidc/venc/src/omx_video_base.cpp b/mm-video/vidc/venc/src/omx_video_base.cpp
index e08868f4..49a8df30 100644
--- a/mm-video/vidc/venc/src/omx_video_base.cpp
+++ b/mm-video/vidc/venc/src/omx_video_base.cpp
@@ -1944,6 +1944,13 @@ OMX_ERRORTYPE omx_video::get_config(OMX_IN OMX_HANDLETYPE hComp,
memcpy(pParam, &m_sIntraperiod, sizeof(m_sIntraperiod));
break;
}
+ case OMX_QcomIndexParamVideoPerformanceLevel:
+ {
+ DEBUG_PRINT_LOW("get_config:OMX_QcomIndexParamVideoPerformanceLevel\n");
+ OMX_QCOM_QUERY_PERFORMANCE *pParam = reinterpret_cast<OMX_QCOM_QUERY_PERFORMANCE*>(configData);
+ pParam->performance = m_curr_perf;
+ break;
+ }
default:
DEBUG_PRINT_ERROR("ERROR: unsupported index %d", (int) configIndex);
return OMX_ErrorUnsupportedIndex;
diff --git a/mm-video/vidc/venc/src/omx_video_encoder.cpp b/mm-video/vidc/venc/src/omx_video_encoder.cpp
index e44504f2..48ece06d 100644
--- a/mm-video/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video/vidc/venc/src/omx_video_encoder.cpp
@@ -159,6 +159,10 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
return OMX_ErrorInsufficientResources;
}
+ //Getting current performance level
+ m_curr_perf = 0;
+ dev_get_curr_perf_lvl(&m_curr_perf);
+
//Intialise the OMX layer variables
memset(&m_pCallbacks,0,sizeof(OMX_CALLBACKTYPE));
@@ -453,7 +457,6 @@ OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
}
}
}
-
DEBUG_PRINT_HIGH("\n Component_init return value = 0x%x", eRet);
return eRet;
}
@@ -1624,6 +1627,11 @@ bool omx_venc::dev_get_buf_req(OMX_U32 *min_buff_count,
}
+bool omx_venc::dev_get_curr_perf_lvl(OMX_PTR curr_perf)
+{
+ return handle->venc_get_curr_perf_lvl(curr_perf);
+}
+
bool omx_venc::dev_set_buf_req(OMX_U32 *min_buff_count,
OMX_U32 *actual_buff_count,
OMX_U32 *buff_size,
diff --git a/mm-video/vidc/venc/src/video_encoder_device.cpp b/mm-video/vidc/venc/src/video_encoder_device.cpp
index 6e539035..165346a8 100644
--- a/mm-video/vidc/venc/src/video_encoder_device.cpp
+++ b/mm-video/vidc/venc/src/video_encoder_device.cpp
@@ -571,6 +571,19 @@ bool venc_dev::venc_get_buf_req(unsigned long *min_buff_count,
}
+bool venc_dev::venc_get_curr_perf_lvl(OMX_PTR curr_perf)
+{
+ struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
+ ioctl_msg.out = (void*)curr_perf;
+ if (ioctl(m_nDriver_fd, VEN_IOCTL_GET_PERF_LEVEL, &ioctl_msg) < 0)
+ {
+ DEBUG_PRINT_ERROR("ioctl VENC_IOCTL_GET_CURR_PERF_LVL failed");
+ return false;
+ }
+ DEBUG_PRINT_HIGH("get_curr_perf_lvl = %u", *(OMX_U32 *)(curr_perf));
+ return true;
+}
+
bool venc_dev::venc_set_param(void *paramData,OMX_INDEXTYPE index )
{
venc_ioctl_msg ioctl_msg = {NULL,NULL};