summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.h6
-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.cpp50
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 06522424..50de50e4 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -93,6 +93,7 @@ extern "C" {
#include "OMX_Core.h"
#include "OMX_QCOMExtns.h"
#include "OMX_VideoExt.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 95df3311..3d7eb53a 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -2230,6 +2230,13 @@ OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)
drv_ctx.video_driver_fd);
}
//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;
}
@@ -4620,6 +4627,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 5a12a81e..837f7ace 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
@@ -215,6 +215,10 @@ struct msm_venc_vpx_error_resilience {
unsigned int enable;
};
+struct msm_venc_priority {
+ OMX_U32 priority;
+};
+
enum v4l2_ports {
CAPTURE_PORT,
OUTPUT_PORT,
@@ -358,6 +362,7 @@ class venc_dev
struct msm_venc_peak_bitrate peak_bitrate;
struct msm_venc_ltrinfo ltrinfo;
struct msm_venc_vpx_error_resilience vpx_err_resilience;
+ 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);
@@ -399,6 +404,7 @@ class venc_dev
bool venc_set_hybrid_hierp(OMX_U32 layers);
bool venc_calibrate_gop();
bool venc_validate_hybridhp_params(OMX_U32 layers, OMX_U32 bFrames, OMX_U32 count, int mode);
+ bool venc_set_session_priority(OMX_U32 priority);
#ifdef MAX_RES_1080P
OMX_U32 pmem_free();
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 0d1a9feb..80b30972 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -1868,6 +1868,14 @@ OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
}
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 4f4ae36b..964c3534 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
@@ -258,6 +258,7 @@ venc_dev::venc_dev(class omx_venc *venc_class)
supported_rc_modes = RC_ALL;
camera_mode_enabled = false;
memset(&ltrinfo, 0, sizeof(ltrinfo));
+ sess_priority.priority = 1;
char property_value[PROPERTY_VALUE_MAX] = {0};
property_get("vidc.enc.log.in", property_value, "0");
@@ -1079,6 +1080,11 @@ bool venc_dev::venc_open(OMX_U32 codec)
}
}
+ 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;
}
@@ -2142,6 +2148,17 @@ 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;
@@ -2385,6 +2402,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()
@@ -4684,6 +4703,37 @@ bool venc_dev::venc_set_vpx_error_resilience(OMX_BOOL enable)
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;