Merge tag 'LA.UM.9.1.r1-12800-SMxxx0.QSSI13.0' into staging/lineage-20.0_merge-LA.UM.9.1.r1-12800-SMxxx0.QSSI13.0
"LA.UM.9.1.r1-12800-SMxxx0.QSSI13.0"
# By Paras Nagda (1) and Pradosh Das (1)
# Via Pradosh Das
* tag 'LA.UM.9.1.r1-12800-SMxxx0.QSSI13.0':
mm-video-v4l2: venc: Fix HDR10+ recording
mm-video-v4l2: venc: set Main10 profile
Change-Id: Ib3c1729df7369df73ec4c52fb244446d98b3b254
diff --git a/mm-video-v4l2/vidc/common/src/vidc_common.cpp b/mm-video-v4l2/vidc/common/src/vidc_common.cpp
index 464504c..a3c9669 100644
--- a/mm-video-v4l2/vidc/common/src/vidc_common.cpp
+++ b/mm-video-v4l2/vidc/common/src/vidc_common.cpp
@@ -62,6 +62,8 @@
V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN10},
{OMX_VIDEO_HEVCProfileMainStill,
V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN_STILL_PIC},
+ {OMX_VIDEO_HEVCProfileMain10,
+ V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN10},
});
pl_map profile_level_converter::profile_hevc_v4l2_to_omx ({});
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 e230d63..907ed7e 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
@@ -608,6 +608,7 @@
OMX_TICKS timestamp, OMX_U32 freeSize);
bool mBitrateSavingsEnable;
bool hdr10metadata_supported;
+ bool is_hevcprofile_explicitly_set;
};
enum instance_state {
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 4280d73..550d4d1 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
@@ -193,6 +193,7 @@
mIsNativeRecorder = false;
m_hdr10meta_enabled = false;
hdr10metadata_supported = false;
+ is_hevcprofile_explicitly_set = false;
Platform::Config::getInt32(Platform::vidc_enc_log_in,
(int32_t *)&m_debug.in_buffer_log, 0);
@@ -1169,9 +1170,10 @@
QOMX_VIDEO_AVCProfileMain,
QOMX_VIDEO_AVCProfileConstrainedHigh,
QOMX_VIDEO_AVCProfileHigh };
- int hevc_profiles[3] = { OMX_VIDEO_HEVCProfileMain,
+ int hevc_profiles[4] = { OMX_VIDEO_HEVCProfileMain,
OMX_VIDEO_HEVCProfileMain10HDR10,
- OMX_VIDEO_HEVCProfileMainStill };
+ OMX_VIDEO_HEVCProfileMainStill,
+ OMX_VIDEO_HEVCProfileMain10 };
if (!profileLevelType)
return OMX_ErrorBadParameter;
@@ -4357,6 +4359,16 @@
DEBUG_PRINT_LOW("gralloc format 0x%x (%s) (%s)",
handle->format, grallocFormatStr, isUBWC ? "UBWC" : "Linear");
+ if (m_codec == OMX_VIDEO_CodingHEVC && (handle->format == HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC ||
+ handle->format == HAL_PIXEL_FORMAT_YCbCr_420_P010_VENUS) &&
+ codec_profile.profile != V4L2_MPEG_VIDC_VIDEO_HEVC_PROFILE_MAIN10)
+ {
+ is_hevcprofile_explicitly_set = true;
+ if (!venc_set_profile (OMX_VIDEO_HEVCProfileMain10)) {
+ DEBUG_PRINT_ERROR("ERROR: Unsuccessful in updating Profile OMX_VIDEO_HEVCProfileMain10");
+ return false;
+ }
+ }
if (handle->format == HAL_PIXEL_FORMAT_NV12_ENCODEABLE) {
m_sVenc_cfg.inputformat = isUBWC ? V4L2_PIX_FMT_NV12_UBWC : V4L2_PIX_FMT_NV12;
DEBUG_PRINT_INFO("ENC_CONFIG: Input Color = NV12 %s", isUBWC ? "UBWC" : "Linear");
@@ -5298,7 +5310,7 @@
codec_profile.profile = control.value;
- if (hdr10metadata_supported == true) {
+ if (hdr10metadata_supported == true && (!is_hevcprofile_explicitly_set)) {
if (venc_set_extradata_hdr10metadata() == false)
{
DEBUG_PRINT_ERROR("Failed to set extradata HDR10PLUS_METADATA");
@@ -7276,7 +7288,9 @@
*usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
#endif
- if (hevc && eProfile == (OMX_U32)OMX_VIDEO_HEVCProfileMain10HDR10) {
+ if (hevc &&
+ (eProfile == (OMX_U32)OMX_VIDEO_HEVCProfileMain10HDR10 ||
+ eProfile == (OMX_U32)OMX_VIDEO_HEVCProfileMain10)) {
DEBUG_PRINT_INFO("Setting 10-bit consumer usage bits");
*usage |= GRALLOC_USAGE_PRIVATE_10BIT_VIDEO;
if (mUseLinearColorFormat & REQUEST_LINEAR_COLOR_10_BIT) {