summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasantha Balla <vballa@codeaurora.org>2015-08-05 17:23:13 +0530
committerVasantha Balla <vballa@codeaurora.org>2015-08-17 19:17:32 +0530
commitaca7b07ceffe52bde74ab188ee0154beb9d801e5 (patch)
treebd08fde44057b3ea19371bde0f0171f59f1f4ab0
parent2c57de7472d70f1096331594f798227c05b74ab2 (diff)
downloadandroid_hardware_qcom_media-aca7b07ceffe52bde74ab188ee0154beb9d801e5.tar.gz
android_hardware_qcom_media-aca7b07ceffe52bde74ab188ee0154beb9d801e5.tar.bz2
android_hardware_qcom_media-aca7b07ceffe52bde74ab188ee0154beb9d801e5.zip
mm-video-v4l2: Add extended config to set instance priority.
Enable priority as hinted by the client: priority = 0 => real-time = 1 => non-realtime Also add the OMX extension for priority and operating-rate. Amended by Ashray Kulkarni <ashrayk@codeaurora.org> Default sessions to non-realtime. bug: 20131548 Change-Id: I37532404a4a3ab5647b3490c3e3ecba2ed604bbf
-rw-r--r--mm-core/inc/OMX_IndexExt.h3
-rw-r--r--mm-video-v4l2/vidc/vdec/inc/omx_vdec.h1
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp24
-rw-r--r--mm-video-v4l2/vidc/venc/inc/video_encoder_device_v4l2.h7
-rw-r--r--mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp8
-rw-r--r--mm-video-v4l2/vidc/venc/src/video_encoder_device_v4l2.cpp49
6 files changed, 92 insertions, 0 deletions
diff --git a/mm-core/inc/OMX_IndexExt.h b/mm-core/inc/OMX_IndexExt.h
index 963ef7ef..3db7da0a 100644
--- a/mm-core/inc/OMX_IndexExt.h
+++ b/mm-core/inc/OMX_IndexExt.h
@@ -77,6 +77,9 @@ typedef enum OMX_INDEXEXTTYPE {
/* Other configurations */
OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000,
+ OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */
+ OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */
+ OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */
/* Time configurations */
OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000,
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
index 54ae1000..00f446cf 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -92,6 +92,7 @@ extern "C" {
#endif
#include "OMX_Core.h"
#include "OMX_QCOMExtns.h"
+#include "OMX_IndexExt.h"
#include "qc_omx_component.h"
#include <linux/msm_vidc_dec.h>
#include <media/msm_vidc.h>
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
index 597abd36..7cc3151a 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -1898,6 +1898,13 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)
DEBUG_PRINT_HIGH("omx_vdec::component_init() success");
}
//memset(&h264_mv_buff,0,sizeof(struct h264_mv_buffer));
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY;
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE;
+
+ if (ioctl(drv_ctx.video_driver_fd, VIDIOC_S_CTRL, &control)) {
+ DEBUG_PRINT_ERROR("Failed to set Default Priority");
+ eRet = OMX_ErrorUnsupportedSetting;
+ }
return eRet;
}
@@ -4105,6 +4112,23 @@ OMX_ERRORTYPE omx_vdec::set_config(OMX_IN OMX_HANDLETYPE hComp,
}
return ret;
+ } else if ((int)configIndex == (int)OMX_IndexConfigPriority) {
+ OMX_PARAM_U32TYPE *priority = (OMX_PARAM_U32TYPE *)configData;
+ DEBUG_PRINT_LOW("Set_config: priority %d", priority->nU32);
+
+ struct v4l2_control control;
+
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY;
+ if (priority->nU32 == 0)
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE;
+ else
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE;
+
+ if (ioctl(drv_ctx.video_driver_fd, VIDIOC_S_CTRL, &control)) {
+ DEBUG_PRINT_ERROR("Failed to set Priority");
+ ret = OMX_ErrorUnsupportedSetting;
+ }
+ return ret;
}
return OMX_ErrorNotImplemented;
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 60ca1b5c..baf6d5b9 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
@@ -202,6 +202,10 @@ struct msm_venc_peak_bitrate {
unsigned int peakbitrate;
};
+struct msm_venc_priority {
+ OMX_U32 priority;
+};
+
enum v4l2_ports {
CAPTURE_PORT,
OUTPUT_PORT,
@@ -327,6 +331,7 @@ class venc_dev
struct msm_venc_perf_level performance_level;
struct msm_venc_vui_timing_info vui_timing_info;
struct msm_venc_peak_bitrate peak_bitrate;
+ struct msm_venc_priority sess_priority;
bool venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel);
bool venc_set_intra_period(OMX_U32 nPFrames, OMX_U32 nBFrames);
@@ -361,6 +366,8 @@ class venc_dev
bool venc_set_perf_level(QOMX_VIDEO_PERF_LEVEL ePerfLevel);
bool venc_set_vui_timing_info(OMX_BOOL enable);
bool venc_set_peak_bitrate(OMX_U32 nPeakBitrate);
+ bool venc_set_session_priority(OMX_U32 priority);
+
#ifdef MAX_RES_1080P
OMX_U32 pmem_free();
OMX_U32 pmem_allocate(OMX_U32 size, OMX_U32 alignment, OMX_U32 count);
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 e0c73353..123a3671 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -1654,6 +1654,14 @@ OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
memcpy(&m_sConfigDeinterlace, pParam, sizeof(m_sConfigDeinterlace));
break;
}
+ case OMX_IndexConfigPriority:
+ {
+ if (!handle->venc_set_config(configData, (OMX_INDEXTYPE)OMX_IndexConfigPriority)) {
+ DEBUG_PRINT_ERROR("Failed to set OMX_IndexConfigPriority");
+ return OMX_ErrorUnsupportedSetting;
+ }
+ break;
+ }
default:
DEBUG_PRINT_ERROR("ERROR: unsupported index %d", (int) configIndex);
break;
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 a835e717..bfe7aa30 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
@@ -210,6 +210,7 @@ venc_dev::venc_dev(class omx_venc *venc_class)
memset(&m_debug,0,sizeof(m_debug));
memset(&hier_p_layers,0,sizeof(hier_p_layers));
memset(&ltrinfo, 0, sizeof(ltrinfo));
+ sess_priority.priority = 1;
char property_value[PROPERTY_VALUE_MAX] = {0};
property_value[0] = '\0';
@@ -907,6 +908,11 @@ bool venc_dev::venc_open(OMX_U32 codec)
DEBUG_PRINT_ERROR("Failed to set V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAME\n");
}
+ sess_priority.priority = 1; /* default to non-real-time */
+ if (venc_set_session_priority(sess_priority.priority)) {
+ DEBUG_PRINT_ERROR("Setting session priority failed");
+ return OMX_ErrorUnsupportedSetting;
+ }
return true;
}
@@ -1883,6 +1889,16 @@ bool venc_dev::venc_set_config(void *configData, OMX_INDEXTYPE index)
}
break;
}
+ case OMX_IndexConfigPriority:
+ {
+ OMX_PARAM_U32TYPE *priority = (OMX_PARAM_U32TYPE *)configData;
+ DEBUG_PRINT_LOW("Set_config: priority %u",priority->nU32);
+ if (!venc_set_session_priority(priority->nU32)) {
+ DEBUG_PRINT_ERROR("Failed to set priority");
+ return false;
+ }
+ break;
+ }
default:
DEBUG_PRINT_ERROR("Unsupported config index = %u", index);
break;
@@ -2104,6 +2120,8 @@ void venc_dev::venc_config_print()
DEBUG_PRINT_HIGH("ENC_CONFIG: VUI timing info enabled: %d", vui_timing_info.enabled);
DEBUG_PRINT_HIGH("ENC_CONFIG: Peak bitrate: %d", peak_bitrate.peakbitrate);
+
+ DEBUG_PRINT_HIGH("ENC_CONFIG: Session Priority: %u", sess_priority.priority);
}
bool venc_dev::venc_reconfig_reqbufs()
@@ -3915,6 +3933,37 @@ bool venc_dev::venc_set_peak_bitrate(OMX_U32 nPeakBitrate)
return true;
}
+bool venc_dev::venc_set_session_priority(OMX_U32 priority) {
+ struct v4l2_control control;
+
+ control.id = V4L2_CID_MPEG_VIDC_VIDEO_PRIORITY;
+ switch(priority) {
+ case 0:
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_ENABLE;
+ break;
+ case 1:
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE;
+ break;
+ default:
+ priority = 1;
+ control.value = V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_DISABLE;
+ DEBUG_PRINT_ERROR("Unsupported priority level %u", priority);
+ break;
+ }
+
+ if (ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control)) {
+ DEBUG_PRINT_ERROR("Failed to set V4L2_MPEG_VIDC_VIDEO_PRIORITY_REALTIME_%s",
+ priority == 0 ? "ENABLE" : "DISABLE");
+ return false;
+ }
+
+ sess_priority.priority = priority;
+
+ DEBUG_PRINT_LOW("Success IOCTL set control for id=%x, val=%d",
+ control.id, control.value);
+ return true;
+}
+
bool venc_dev::venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel)
{
bool status = true;