Merge remote-tracking branch 'goog/qcom/release/LA.UM.9.1.C11.11.00.00.841.013' into sc-dev

 Conflicts:
	conf_files/atoll/media_codecs.xml
	conf_files/atoll/media_codecs_performance.xml
	conf_files/atoll/media_codecs_vendor.xml
	conf_files/sm6150/media_codecs.xml
	conf_files/sm6150/media_codecs_sdmmagpie_v1.xml
	conf_files/sm6150/media_codecs_vendor_sdmmagpie_v1.xml
	mm-core/src/registry_table.c
	mm-core/src/registry_table_android.c
	mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
	product.mk

Bug: 188781413
Bug: 189096555
Change-Id: I3ff3c2d9f700e0e134fedc8e0012381cdd9442b3
diff --git a/NOTICE b/LICENSE
similarity index 100%
rename from NOTICE
rename to LICENSE
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/MODULE_LICENSE_BSD b/MODULE_LICENSE_BSD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_BSD
diff --git a/MODULE_LICENSE_MIT b/MODULE_LICENSE_MIT
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_MIT
diff --git a/conf_files/atoll/media_codecs.xml b/conf_files/atoll/media_codecs.xml
index 48da490..514ce7a 100644
--- a/conf_files/atoll/media_codecs.xml
+++ b/conf_files/atoll/media_codecs.xml
@@ -198,7 +198,6 @@
             <Limit name="bitrate" range="1-2000000" />
             <Limit name="frame-rate" range="1-30" />
             <Limit name="concurrent-instances" max="16" />
-            <Limit name="performance-point-864x480" value="30" />
             <Limit name="performance-point-720x480" value="30" />
             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
@@ -213,7 +212,6 @@
              <Limit name="bitrate" range="1-8000000" />
              <Limit name="frame-rate" range="1-30" />
              <Limit name="concurrent-instances" max="16" />
-             <Limit name="performance-point-864x480" value="30" />
              <Limit name="performance-point-720x480" value="30" />
              <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
@@ -364,7 +362,6 @@
              <Limit name="frame-rate" range="1-30" />
              <Feature name="adaptive-playback" />
              <Limit name="concurrent-instances" max="16" />
-             <Limit name="performance-point-864x480" value="30" />
              <Limit name="performance-point-720x480" value="30" />
              <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
diff --git a/conf_files/atoll/media_codecs_vendor.xml b/conf_files/atoll/media_codecs_vendor.xml
index 49234b0..6e892ec 100644
--- a/conf_files/atoll/media_codecs_vendor.xml
+++ b/conf_files/atoll/media_codecs_vendor.xml
@@ -211,7 +211,6 @@
             <Limit name="bitrate" range="1-2000000" />
             <Limit name="frame-rate" range="1-30" />
             <Limit name="concurrent-instances" max="16" />
-            <Limit name="performance-point-864x480" value="30" />
             <Limit name="performance-point-720x480" value="30" />
             <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
@@ -226,7 +225,6 @@
              <Limit name="bitrate" range="1-8000000" />
              <Limit name="frame-rate" range="1-30" />
              <Limit name="concurrent-instances" max="16" />
-             <Limit name="performance-point-864x480" value="30" />
              <Limit name="performance-point-720x480" value="30" />
              <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
@@ -377,7 +375,6 @@
              <Limit name="frame-rate" range="1-30" />
              <Feature name="adaptive-playback" />
              <Limit name="concurrent-instances" max="16" />
-             <Limit name="performance-point-864x480" value="30" />
              <Limit name="performance-point-720x480" value="30" />
              <Limit name="performance-point-720x576" value="25" />
         </MediaCodec>
diff --git a/conf_files/config.mk b/conf_files/config.mk
index 681e036..dd37710 100644
--- a/conf_files/config.mk
+++ b/conf_files/config.mk
@@ -1,5 +1,5 @@
 ifeq ($(TARGET_BOARD_PLATFORM),msm8937)
-PRODUCT_COPY_FILES += hardware/qcom/media/conf_files/msm8937/media_profiles_8937.xml:system/etc/media_profiles.xml \
-                      hardware/qcom/media/conf_files/msm8937/media_codecs_8937.xml:system/etc/media_codecs.xml \
-                      hardware/qcom/media/conf_files/msm8937/media_codecs_performance_8937.xml:system/etc/media_codecs_performance.xml
+PRODUCT_COPY_FILES += hardware/qcom/sm8150/media/conf_files/msm8937/media_profiles_8937.xml:system/etc/media_profiles.xml \
+                      hardware/qcom/sm8150/media/conf_files/msm8937/media_codecs_8937.xml:system/etc/media_codecs.xml \
+                      hardware/qcom/sm8150/media/conf_files/msm8937/media_codecs_performance_8937.xml:system/etc/media_codecs_performance.xml
 endif #TARGET_BOARD_PLATFORM
diff --git a/conf_files/msmnile/msmnile.mk b/conf_files/msmnile/msmnile.mk
index 216be6e..b8fca8c 100644
--- a/conf_files/msmnile/msmnile.mk
+++ b/conf_files/msmnile/msmnile.mk
@@ -1,4 +1,4 @@
-CONFIG_PATH := hardware/qcom/media/conf_files/msmnile
+CONFIG_PATH := hardware/qcom/sm8150/media/conf_files/msmnile
 
 # Video feature flags
 
diff --git a/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v0.xml b/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v0.xml
index 1901a2e..1f8b65e 100644
--- a/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v0.xml
+++ b/conf_files/sm6150/media_codecs_vendor_sdmmagpie_v0.xml
@@ -203,7 +203,7 @@
             <Quirk name="requires-allocate-on-input-ports" />
             <Quirk name="requires-allocate-on-output-ports" />
             <Quirk name="requires-loaded-to-idle-after-allocation" />
-            <Limit name="size" min="512x512" max="4096x2160" />
+            <Limit name="size" min="512x512" max="8192x8192" />
             <Limit name="frame-rate" range="1-20" />
             <Limit name="concurrent-instances" max="6" />
             <Limit name="quality" range="0-100" default="80" />
diff --git a/hypv-intercept/Android.mk b/hypv-intercept/Android.mk
index 6d4e6ba..18044e8 100644
--- a/hypv-intercept/Android.mk
+++ b/hypv-intercept/Android.mk
@@ -13,6 +13,9 @@
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_MODULE := libhypv_intercept
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE
 
 LOCAL_MODULE_PATH_32      := $(TARGET_OUT_VENDOR)/lib
 LOCAL_MODULE_PATH_64      := $(TARGET_OUT_VENDOR)/lib64
diff --git a/libarbitrarybytes/Android.mk b/libarbitrarybytes/Android.mk
index 63817e8..de88145 100644
--- a/libarbitrarybytes/Android.mk
+++ b/libarbitrarybytes/Android.mk
@@ -13,6 +13,9 @@
 libarbitrarybytes-inc  += $(LOCAL_PATH)/../mm-core/inc
 
 LOCAL_MODULE           := libarbitrarybytes
+LOCAL_LICENSE_KINDS    := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE      := $(LOCAL_PATH)/../LICENSE
 
 LOCAL_PRELINK_MODULE   := false
 LOCAL_VENDOR_MODULE    := true
diff --git a/libc2dcolorconvert/Android.mk b/libc2dcolorconvert/Android.mk
index f6158fc..234b75b 100644
--- a/libc2dcolorconvert/Android.mk
+++ b/libc2dcolorconvert/Android.mk
@@ -21,6 +21,9 @@
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_MODULE := libc2dcolorconvert
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE
 
 LOCAL_VENDOR_MODULE := true
 
diff --git a/libplatformconfig/Android.mk b/libplatformconfig/Android.mk
index c346b0e..0636b0c 100644
--- a/libplatformconfig/Android.mk
+++ b/libplatformconfig/Android.mk
@@ -46,6 +46,9 @@
 ####################
 
 LOCAL_MODULE := libplatformconfig
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE
 LOCAL_VENDOR_MODULE := true
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk
index 89f17d7..ba70fb7 100644
--- a/libstagefrighthw/Android.mk
+++ b/libstagefrighthw/Android.mk
@@ -51,8 +51,10 @@
         libdl                   \
 
 LOCAL_MODULE := libstagefrighthw
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
 
 LOCAL_VENDOR_MODULE := true
 
 include $(BUILD_SHARED_LIBRARY)
-
diff --git a/mm-core/Android.mk b/mm-core/Android.mk
index a3f2b1e..37a4b2e 100644
--- a/mm-core/Android.mk
+++ b/mm-core/Android.mk
@@ -12,7 +12,7 @@
 #             Figure out the targets
 #===============================================================================
 
-ifeq ($(filter $(TARGET_BOARD_PLATFORM), msmnile),$(TARGET_BOARD_PLATFORM))
+ifeq ($(filter $(TARGET_BOARD_PLATFORM), msmnile sm8150),$(TARGET_BOARD_PLATFORM))
 OMXCORE_CFLAGS += -D_NILE_
 else ifeq ($(filter $(TARGET_BOARD_PLATFORM), $(MSMSTEPPE)),$(TARGET_BOARD_PLATFORM))
 OMXCORE_CFLAGS += -D_STEPPE_
@@ -66,7 +66,7 @@
 #===============================================================================
 
 LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/media/libplatformconfig
+LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/sm8150/media/libplatformconfig
 
 LOCAL_HEADER_LIBRARIES := \
         libutils_headers \
@@ -76,6 +76,9 @@
 
 LOCAL_PRELINK_MODULE    := false
 LOCAL_MODULE            := libOmxCore
+LOCAL_LICENSE_KINDS     := SPDX-license-identifier-BSD SPDX-license-identifier-MIT
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE       := $(LOCAL_PATH)/../LICENSE
 LOCAL_MODULE_TAGS       := optional
 LOCAL_VENDOR_MODULE     := true
 LOCAL_SHARED_LIBRARIES  := liblog libdl libcutils
@@ -86,7 +89,7 @@
 
 LOCAL_SRC_FILES         := src/common/omx_core_cmp.cpp
 LOCAL_SRC_FILES         += src/common/qc_omx_core.c
-ifneq (,$(filter msmnile sdmshrike $(MSMSTEPPE) $(TRINKET) atoll,$(TARGET_BOARD_PLATFORM)))
+ifneq (,$(filter msmnile sm8150 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)))
 LOCAL_SRC_FILES         += src/registry_table_android.c
 else
 LOCAL_SRC_FILES         += src/qc_registry_table_android.c
@@ -101,7 +104,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/media/libplatformconfig
+LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/sm8150/media/libplatformconfig
 
 LOCAL_HEADER_LIBRARIES := \
         libutils_headers \
@@ -111,6 +114,9 @@
 
 LOCAL_PRELINK_MODULE    := false
 LOCAL_MODULE            := libmm-omxcore
+LOCAL_LICENSE_KINDS     := SPDX-license-identifier-BSD SPDX-license-identifier-MIT
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE       := $(LOCAL_PATH)/../LICENSE
 LOCAL_MODULE_TAGS       := optional
 LOCAL_VENDOR_MODULE     := true
 LOCAL_SHARED_LIBRARIES  := liblog libdl libcutils
@@ -121,7 +127,7 @@
 
 LOCAL_SRC_FILES         := src/common/omx_core_cmp.cpp
 LOCAL_SRC_FILES         += src/common/qc_omx_core.c
-ifneq (,$(filter msmnile sdmshrike $(MSMSTEPPE) $(TRINKET) atoll,$(TARGET_BOARD_PLATFORM)))
+ifneq (,$(filter msmnile sdmshrike sm8150 $(MSMSTEPPE) $(TRINKET) atoll,$(TARGET_BOARD_PLATFORM)))
 LOCAL_SRC_FILES         += src/$(MM_CORE_TARGET)/registry_table.c
 else
 LOCAL_SRC_FILES         += src/$(MM_CORE_TARGET)/qc_registry_table.c
@@ -132,6 +138,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := libomxcore_headers
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD SPDX-license-identifier-MIT
+LOCAL_LICENSE_CONDITIONS := notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../LICENSE
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
 LOCAL_VENDOR_MODULE := true
 
diff --git a/mm-core/src/registry_table.c b/mm-core/src/registry_table.c
index 8d392a5..4b6d732 100644
--- a/mm-core/src/registry_table.c
+++ b/mm-core/src/registry_table.c
@@ -42,49 +42,14 @@
     //Common entries
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc", "libOmxVdec.so", "video_decoder.avc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc.dsmode", "libOmxVideoDSMode.so", "video_decoder.avc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.file.muxer", "libOmxMux.so", "container_muxer.mp2"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.hevc", "libOmxVdec.so", "video_decoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.vp8", "libOmxVdec.so", "video_decoder.vp8"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.vp9", "libOmxVdec.so", "video_decoder.vp9"),
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.mpeg4sw", "libOmxSwVdec.so", "video_decoder.mpeg4"),
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.h263sw", "libOmxSwVdec.so", "video_decoder.h263"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.mpeg4sw", "libOmxSwVencMpeg4.so", "video_encoder.mpeg4"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.h263sw", "libOmxSwVencMpeg4.so", "video_encoder.h263"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.avc", "libOmxVenc.so", "video_encoder.avc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.vp8", "libOmxVenc.so", "video_encoder.vp8"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.hevc", "libOmxVenc.so", "video_encoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.hevc.cq", "libOmxVenc.so", "video_encoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.heic", "libOmxVenc.so", "image_encoder.heic"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.Qcelp13", "libOmxQcelp13Dec.so", "audio_decoder.Qcelp13"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.evrc", "libOmxEvrcDec.so", "audio_decoder.evrc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.wma", "libOmxWmaDec.so", "audio_decoder.wma"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.wma10Pro", "libOmxWmaDec.so", "audio_decoder.wma"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.alac", "libOmxAlacDec.so", "audio_decoder.alac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.ape", "libOmxApeDec.so", "audio_decoder.ape"),
-    OMX_REGISTRY_ENTRY("OMX.qti.audio.decoder.dsd", "libOmxDsdDec.so", "audio_decoder.dsd"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.aac", "libOmxAacEnc.so", "audio_encoder.aac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.qcelp13", "libOmxQcelp13Enc.so", "audio_encoder.qcelp13"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.evrc", "libOmxEvrcEnc.so", "audio_encoder.evrc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.amrnb", "libOmxAmrEnc.so", "audio_encoder.amrnb"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.aac", "libOmxAacDec.so", "audio_decoder.aac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.multiaac", "libOmxAacDec.so", "audio_decoder.aac"),
-
-//#ifdef _NILE_
-    //Entries specific to msmnile
-    OMX_REGISTRY_ENTRY("OMX.qti.vdec.vpp", "libOmxVpp.so", "video_decoder.vpp"),
-//#endif //_NILE_
-
-//#if defined(_STEPPE_) || defined(_ATOLL_)
-    //Entries specific to msmsteppe
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.tme", "libOmxVenc.so", "video_encoder.tme"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.tme.secure", "libOmxVenc.so", "video_encoder.tme"),
-//    OMX_REGISTRY_ENTRY("OMX.qti.vdec.vpp", "libOmxVpp.so", "video_decoder.vpp"),
-//#endif //_STEPPE_ || _ATOLL_
-
-//#if !defined(_ATOLL_) && !defined(_TRINKET_)
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.vc1sw", "libOmxSwVdec.so", "video_decoder.vc1"),
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.wmvsw", "libOmxSwVdec.so", "video_decoder.vc1"),
-//#endif //_ATOLL_ || _TRINKET_
 };
 
 const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
diff --git a/mm-core/src/registry_table_android.c b/mm-core/src/registry_table_android.c
index 81b169d..51c5985 100644
--- a/mm-core/src/registry_table_android.c
+++ b/mm-core/src/registry_table_android.c
@@ -42,17 +42,11 @@
     //Common entries
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc", "libOmxVdec.so", "video_decoder.avc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc.secure", "libOmxVdec.so", "video_decoder.avc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.mpeg2", "libOmxVdec.so", "video_decoder.mpeg2"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.mpeg2.secure", "libOmxVdec.so", "video_decoder.mpeg2"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.hevc", "libOmxVdec.so", "video_decoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.hevc.secure", "libOmxVdec.so", "video_decoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.vp8", "libOmxVdec.so", "video_decoder.vp8"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.vp9", "libOmxVdec.so", "video_decoder.vp9"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.vp9.secure", "libOmxVdec.so", "video_decoder.vp9"),
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.mpeg4sw", "libOmxSwVdec.so", "video_decoder.mpeg4"),
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.h263sw", "libOmxSwVdec.so", "video_decoder.h263"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.mpeg4sw", "libOmxSwVencMpeg4.so", "video_encoder.mpeg4"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.h263sw", "libOmxSwVencMpeg4.so", "video_encoder.h263"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.avc", "libOmxVenc.so", "video_encoder.avc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.avc.secure", "libOmxVenc.so", "video_encoder.avc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.vp8", "libOmxVenc.so", "video_encoder.vp8"),
@@ -60,43 +54,6 @@
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.hevc.cq", "libOmxVenc.so", "video_encoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.hevc.secure", "libOmxVenc.so", "video_encoder.hevc"),
     OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.heic", "libOmxVenc.so", "image_encoder.heic"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.Qcelp13", "libOmxQcelp13Dec.so", "audio_decoder.Qcelp13"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.evrc", "libOmxEvrcDec.so", "audio_decoder.evrc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.wma", "libOmxWmaDec.so", "audio_decoder.wma"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.wma10Pro", "libOmxWmaDec.so", "audio_decoder.wma"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.wmaLossLess", "libOmxWmaDec.so", "audio_decoder.wma"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.amrwbplus", "libOmxAmrwbplusDec.so", "audio_decoder.awbplus"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.alac", "libOmxAlacDec.so", "audio_decoder.alac"),
-    OMX_REGISTRY_ENTRY("OMX.qti.audio.decoder.alac.sw", "libOmxAlacDecSw.so", "audio_decoder.alac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.ape", "libOmxApeDec.so", "audio_decoder.ape"),
-    OMX_REGISTRY_ENTRY("OMX.qti.audio.decoder.ape.sw", "libOmxApeDecSw.so", "audio_decoder.ape"),
-    OMX_REGISTRY_ENTRY("OMX.qti.audio.decoder.dsd", "libOmxDsdDec.so", "audio_decoder.dsd"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.aac", "libOmxAacEnc.so", "audio_encoder.aac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.qcelp13", "libOmxQcelp13Enc.so", "audio_encoder.qcelp13"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.evrc", "libOmxEvrcEnc.so", "audio_encoder.evrc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.encoder.amrnb", "libOmxAmrEnc.so", "audio_encoder.amrnb"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.multiaac", "libOmxAacDec.so", "audio_decoder.aac"),
-//#ifdef _NILE_
-    //Entries specific to msmnile
-    OMX_REGISTRY_ENTRY("OMX.qti.vdec.vpp", "libOmxVpp.so", "iv_processor.yuv"),
-//#endif
-
-//#if defined(_STEPPE_) || defined(_ATOLL_)
-    //Entries specific to msmsteppe
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.tme", "libOmxVenc.so", "video_encoder.tme"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.encoder.tme.secure", "libOmxVenc.so", "video_encoder.tme"),
-//    OMX_REGISTRY_ENTRY("OMX.qti.vdec.vpp", "libOmxVpp.so", "iv_processor.yuv"),
-//#endif //_STEPPE_
-
-//#if !defined(_ATOLL_) && !defined(_TRINKET_)
-    OMX_REGISTRY_ENTRY("OMX.qti.video.decoder.vc1sw", "libOmxSwVdec.so", "video_decoder.vc1"),
-//#endif //_ATOLL_ || _TRINKET_
-
-    OMX_REGISTRY_ENTRY("OMX.QCOM.CUST.COMP.START", NULL, NULL),
-    OMX_REGISTRY_ENTRY("OMX.qcom.file.muxer", "libOmxMux.so", "container_muxer.mp2"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.audio.decoder.aac", "libOmxAacDec.so", "audio_decoder.aac"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc.secure.dsmode", "libOmxVideoDSMode.so", "video_decoder.avc"),
-    OMX_REGISTRY_ENTRY("OMX.qcom.video.decoder.avc.dsmode", "libOmxVideoDSMode.so", "video_decoder.avc"),
 };
 const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
-omx_core_cb_type component[SIZE_OF_CORE];
\ No newline at end of file
+omx_core_cb_type component[SIZE_OF_CORE];
diff --git a/mm-video-v4l2/vidc/common/Android.mk b/mm-video-v4l2/vidc/common/Android.mk
index c282cfb..c5b0f54 100644
--- a/mm-video-v4l2/vidc/common/Android.mk
+++ b/mm-video-v4l2/vidc/common/Android.mk
@@ -1,4 +1,6 @@
 ROOT_DIR := $(call my-dir)
+LIBION_HEADER_PATH_WRAPPER := $(QC_OPEN_PATH)/core-utils/build/libion_header_paths/libion_path.mk
+
 include $(CLEAR_VARS)
 include $(LIBION_HEADER_PATH_WRAPPER)
 LOCAL_PATH:= $(ROOT_DIR)
@@ -21,13 +23,16 @@
 # ---------------------------------------------------------------------------------
 
 libmm-vidc-inc      := $(LOCAL_PATH)/inc
-libmm-vidc-inc      += $(TOP)/hardware/qcom/media/mm-core/inc
-libmm-vidc-inc      += $(TOP)/hardware/qcom/media/libc2dcolorconvert
+libmm-vidc-inc      += $(QCOM_MEDIA_ROOT)/mm-core/inc
+libmm-vidc-inc      += $(QCOM_MEDIA_ROOT)/libc2dcolorconvert
 libmm-vidc-inc      += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
 libmm-vidc-inc      += $(TOP)/hardware/libhardware/include
 libmm-vidc-inc      += $(LIBION_HEADER_PATHS)
 
 LOCAL_MODULE                    := libOmxVidcCommon
+LOCAL_LICENSE_KINDS             := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS        := notice
+LOCAL_NOTICE_FILE               := $(LOCAL_PATH)/../../../LICENSE
 LOCAL_MODULE_TAGS               := optional
 LOCAL_VENDOR_MODULE             := true
 LOCAL_CFLAGS                    := $(libmm-vidc-def)
diff --git a/mm-video-v4l2/vidc/vdec/Android.mk b/mm-video-v4l2/vidc/vdec/Android.mk
index 8903538..0034496 100644
--- a/mm-video-v4l2/vidc/vdec/Android.mk
+++ b/mm-video-v4l2/vidc/vdec/Android.mk
@@ -1,4 +1,6 @@
 LOCAL_PATH := $(call my-dir)
+LIBION_HEADER_PATH_WRAPPER := $(QC_OPEN_PATH)/core-utils/build/libion_header_paths/libion_path.mk
+
 include $(CLEAR_VARS)
 include $(LIBION_HEADER_PATH_WRAPPER)
 
@@ -58,19 +60,19 @@
 # Common Includes
 libmm-vdec-inc          := $(LOCAL_PATH)/inc
 libmm-vdec-inc          += $(LIBION_HEADER_PATHS)
-libmm-vdec-inc          += $(TOP)/hardware/qcom/media/mm-video-v4l2/vidc/common/inc
-libmm-vdec-inc          += $(TOP)/hardware/qcom/media/mm-core/inc
-libmm-vdec-inc          += hardware/qcom/media/libplatformconfig
+libmm-vdec-inc          += $(QCOM_MEDIA_ROOT)/mm-video-v4l2/vidc/common/inc
+libmm-vdec-inc          += $(QCOM_MEDIA_ROOT)/mm-core/inc
+libmm-vdec-inc          += $(QCOM_MEDIA_ROOT)/libplatformconfig
 libmm-vdec-inc          += $(TARGET_OUT_HEADERS)/adreno
-libmm-vdec-inc      	+= $(TOP)/hardware/qcom/media/libc2dcolorconvert
+libmm-vdec-inc      	+= $(QCOM_MEDIA_ROOT)/libc2dcolorconvert
 libmm-vdec-inc      	+= $(TARGET_OUT_HEADERS)/mm-video/SwVdec
 libmm-vdec-inc      	+= $(TARGET_OUT_HEADERS)/mm-video/swvdec
 libmm-vdec-inc      	+= $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
-libmm-vdec-inc      	+= $(TOP)/hardware/qcom/media/libarbitrarybytes/inc
+libmm-vdec-inc      	+= $(QCOM_MEDIA_ROOT)/libarbitrarybytes/inc
 
 ifeq ($(PLATFORM_SDK_VERSION), 18)  #JB_MR2
 libmm-vdec-def += -DANDROID_JELLYBEAN_MR2=1
-libmm-vdec-inc += $(TOP)/hardware/qcom/media/libstagefrighthw
+libmm-vdec-inc += $(TOP)/hardware/qcom/sm8150/media/libstagefrighthw
 endif
 
 # Common Dependencies
@@ -99,9 +101,12 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE                    := libOmxVdec
+LOCAL_LICENSE_KINDS             := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS        := notice
+LOCAL_NOTICE_FILE               := $(LOCAL_PATH)/../../../LICENSE
 LOCAL_MODULE_TAGS               := optional
 LOCAL_VENDOR_MODULE             := true
-LOCAL_CFLAGS                    := $(libmm-vdec-def) -Werror
+LOCAL_CFLAGS                    := $(libmm-vdec-def) -Wno-enum-compare -Werror
 
 LOCAL_HEADER_LIBRARIES := \
         media_plugin_headers \
@@ -119,6 +124,7 @@
 LOCAL_SHARED_LIBRARIES  += libqdMetaData
 LOCAL_SHARED_LIBRARIES  += libplatformconfig
 LOCAL_SHARED_LIBRARIES  += libarbitrarybytes
+LOCAL_SHARED_LIBRARIES  += libnativewindow
 ifeq ($(ENABLE_HYP),true)
 LOCAL_SHARED_LIBRARIES  += libhypv_intercept
 endif
@@ -141,6 +147,9 @@
 ifneq ($(call is-board-platform-in-list, $(TARGETS_THAT_DONT_NEED_SW_VDEC)),true)
 
 LOCAL_MODULE                  := libOmxSwVdec
+LOCAL_LICENSE_KINDS           := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS      := notice
+LOCAL_NOTICE_FILE             := $(LOCAL_PATH)/../../../LICENSE
 LOCAL_MODULE_TAGS             := optional
 LOCAL_VENDOR_MODULE           := true
 LOCAL_CFLAGS                  := $(libmm-vdec-def)
@@ -158,6 +167,7 @@
 LOCAL_PRELINK_MODULE          := false
 LOCAL_SHARED_LIBRARIES        := liblog libcutils libc2dcolorconvert libion
 LOCAL_SHARED_LIBRARIES        += libswvdec
+LOCAL_SHARED_LIBRARIES        += libnativewindow
 
 LOCAL_SRC_FILES               := src/omx_swvdec.cpp
 LOCAL_SRC_FILES               += src/omx_swvdec_utils.cpp
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 5db344a..c7b87c2 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp
@@ -7458,6 +7458,16 @@
         buffer->pBuffer = (OMX_U8*)drv_ctx.ptr_inputbuffer[nBufferIndex].bufferaddr;
     }
 
+    /* Check if the input timestamp in seconds is greater than LONG_MAX
+       or lesser than LONG_MIN. */
+    if (buffer->nTimeStamp / 1000000 > LONG_MAX ||
+       buffer->nTimeStamp / 1000000 < LONG_MIN) {
+        /* This timestamp cannot be contained in driver timestamp field */
+        DEBUG_PRINT_ERROR("[ETB] BHdr(%p) pBuf(%p) nTS(%lld) nFL(%u) >> Invalid timestamp",
+            buffer, buffer->pBuffer, buffer->nTimeStamp, (unsigned int)buffer->nFilledLen);
+        return OMX_ErrorBadParameter;
+    }
+
     m_etb_count++;
     //To handle wrap around case. m_etb_count++ to ensure value is non-zero.
     if (!m_etb_count)
@@ -9936,14 +9946,18 @@
     }
 
 #ifdef HYPERVISOR
-    flag = 0;
+    flag &= ~ION_FLAG_CACHED;
 #endif
     ion_info->alloc_data.flags = flag;
     ion_info->alloc_data.len = buffer_size;
 
     ion_info->alloc_data.heap_id_mask = ION_HEAP(ION_SYSTEM_HEAP_ID);
     if (secure_mode && (ion_info->alloc_data.flags & ION_FLAG_SECURE)) {
+#ifdef HYPERVISOR
+        ion_info->alloc_data.heap_id_mask = ION_HEAP(ION_SECURE_DISPLAY_HEAP_ID);
+#else
         ion_info->alloc_data.heap_id_mask = ION_HEAP(MEM_HEAP_ID);
+#endif
     }
 
     /* Use secure display cma heap for obvious reasons. */
@@ -12733,8 +12747,13 @@
 {
     bool status = true;
     pthread_mutex_lock(&omx->c_lock);
+     /* Whenever port mode is set to kPortModeDynamicANWBuffer, Video Frameworks
+        always uses VideoNativeMetadata and OMX receives buffer type as
+        grallocsource via storeMetaDataInBuffers_l API. The buffer_size
+        will be communicated to frameworks via IndexParamPortdefinition. */
     if (!enabled)
-        buffer_size = omx->drv_ctx.op_buf.buffer_size;
+        buffer_size = omx->dynamic_buf_mode ? sizeof(struct VideoNativeMetadata) :
+                      omx->drv_ctx.op_buf.buffer_size;
     else {
         buffer_size = c2dcc.getBuffSize(C2D_OUTPUT);
     }
@@ -12743,9 +12762,10 @@
 }
 
 OMX_ERRORTYPE omx_vdec::allocate_color_convert_buf::set_buffer_req(
-        OMX_U32 buffer_size, OMX_U32 actual_count) {
-    OMX_U32 expectedSize = enabled ? buffer_size_req : omx->drv_ctx.op_buf.buffer_size;
-
+        OMX_U32 buffer_size, OMX_U32 actual_count)
+{
+    OMX_U32 expectedSize = is_color_conversion_enabled() ? buffer_size_req : omx->dynamic_buf_mode ?
+            sizeof(struct VideoDecoderOutputMetaData) : omx->drv_ctx.op_buf.buffer_size;
     if (buffer_size < expectedSize) {
         DEBUG_PRINT_ERROR("OP Requirements: Client size(%u) insufficient v/s requested(%u)",
                 buffer_size, expectedSize);
diff --git a/mm-video-v4l2/vidc/venc/Android.mk b/mm-video-v4l2/vidc/venc/Android.mk
index aea70b2..42c3ca3 100644
--- a/mm-video-v4l2/vidc/venc/Android.mk
+++ b/mm-video-v4l2/vidc/venc/Android.mk
@@ -1,4 +1,6 @@
 LOCAL_PATH := $(call my-dir)
+LIBION_HEADER_PATH_WRAPPER := $(QC_OPEN_PATH)/core-utils/build/libion_header_paths/libion_path.mk
+
 include $(CLEAR_VARS)
 include $(LIBION_HEADER_PATH_WRAPPER)
 
@@ -66,12 +68,12 @@
 # Common Includes
 libmm-venc-inc      := $(LOCAL_PATH)/inc
 libmm-venc-inc      += $(LIBION_HEADER_PATHS)
-libmm-venc-inc      += $(TOP)/hardware/qcom/media/mm-video-v4l2/vidc/common/inc
-libmm-venc-inc      += hardware/qcom/media/mm-core/inc
-libmm-venc-inc      += hardware/qcom/media/libstagefrighthw
-libmm-venc-inc      += hardware/qcom/media/libplatformconfig
+libmm-venc-inc      += $(QCOM_MEDIA_ROOT)/mm-video-v4l2/vidc/common/inc
+libmm-venc-inc      += $(QCOM_MEDIA_ROOT)/mm-core/inc
+libmm-venc-inc      += $(QCOM_MEDIA_ROOT)/libstagefrighthw
+libmm-venc-inc      += $(QCOM_MEDIA_ROOT)/libplatformconfig
+libmm-venc-inc      += $(QCOM_MEDIA_ROOT)/libc2dcolorconvert
 libmm-venc-inc      += $(TARGET_OUT_HEADERS)/adreno
-libmm-venc-inc      += hardware/qcom/media/libc2dcolorconvert
 libmm-venc-inc      += $(TARGET_OUT_HEADERS)/libvqzip
 libmm-venc-inc      += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
 libmm-venc-inc      += $(TOP)/frameworks/native/libs/nativewindow/include
@@ -96,6 +98,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE                    := libOmxVenc
+LOCAL_LICENSE_KINDS             := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS        := notice
+LOCAL_NOTICE_FILE               := $(LOCAL_PATH)/../../../LICENSE
 LOCAL_MODULE_TAGS               := optional
 LOCAL_VENDOR_MODULE             := true
 LOCAL_CFLAGS                    := $(libmm-venc-def)
@@ -113,6 +118,7 @@
 
 LOCAL_PRELINK_MODULE      := false
 LOCAL_SHARED_LIBRARIES    := liblog libcutils libdl libplatformconfig libion
+LOCAL_SHARED_LIBRARIES    += libnativewindow
 
 # ifeq ($(BOARD_USES_ADRENO), true)
 LOCAL_SHARED_LIBRARIES    += libc2dcolorconvert
@@ -127,6 +133,9 @@
 LOCAL_SRC_FILES   += src/omx_video_encoder.cpp
 LOCAL_SRC_FILES   += src/video_encoder_device_v4l2.cpp
 
+# Suppress warnings until they are fixed in video_encoder_device_v4l2.cpp
+LOCAL_CFLAGS += -Wno-error=implicit-fallthrough
+
 include $(BUILD_SHARED_LIBRARY)
 
 ifneq ($(call is-board-platform-in-list, $(TARGETS_THAT_DONT_NEED_SW_VENC_MPEG4)),true)
@@ -139,6 +148,9 @@
 libmm-venc-inc      += $(TARGET_OUT_HEADERS)/mm-video/swvenc
 
 LOCAL_MODULE                    := libOmxSwVencMpeg4
+LOCAL_LICENSE_KINDS             := SPDX-license-identifier-BSD
+LOCAL_LICENSE_CONDITIONS        := notice
+LOCAL_NOTICE_FILE               := $(LOCAL_PATH)/../../../LICENSE
 
 LOCAL_MODULE_TAGS               := optional
 LOCAL_VENDOR_MODULE             := true
@@ -158,6 +170,7 @@
 LOCAL_SHARED_LIBRARIES    := liblog libcutils libdl libplatformconfig libion
 LOCAL_SHARED_LIBRARIES    += libMpeg4SwEncoder
 LOCAL_SHARED_LIBRARIES    += libqdMetaData
+LOCAL_SHARED_LIBRARIES    += libnativewindow
 
 ifneq ($(call is-board-platform-in-list, $(TARGETS_THAT_DONT_SUPPORT_SW_VENC_ROTATION)),true)
 LOCAL_SHARED_LIBRARIES += libui
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h b/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
index da0f98a..99f8cb3 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_swvenc_mpeg4.h
@@ -199,6 +199,7 @@
            OMX_U32 port
         );
         int swvenc_input_log_buffers(const char *buffer, int bufferlen);
+        int swvenc_input_log_rotated_buffers(const char *buffer, int bufferlen);
         bool dev_get_hevc_profile(OMX_U32*) { return false; }
         bool dev_handle_client_input_extradata(void*) { return false; }
         void dev_get_color_format_as_string(char *, int, unsigned) {};
diff --git a/mm-video-v4l2/vidc/venc/inc/omx_video_common.h b/mm-video-v4l2/vidc/venc/inc/omx_video_common.h
index 49a1384..0f173c8 100644
--- a/mm-video-v4l2/vidc/venc/inc/omx_video_common.h
+++ b/mm-video-v4l2/vidc/venc/inc/omx_video_common.h
@@ -1,5 +1,5 @@
 /*--------------------------------------------------------------------------
-Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -99,13 +99,16 @@
 
 struct venc_debug_cap {
     bool in_buffer_log;
+    bool in_buffer_rotated_log;
     bool out_buffer_log;
     bool extradata_log;
     char infile_name[PROPERTY_VALUE_MAX];
+    char inrotatedfile_name[PROPERTY_VALUE_MAX];
     char outfile_name[PROPERTY_VALUE_MAX];
     char extradatafile_name[PROPERTY_VALUE_MAX];
     char log_loc[PROPERTY_VALUE_MAX];
     FILE *infile;
+    FILE *inrotatedfile;
     FILE *outfile;
     FILE *extradatafile;
 };
diff --git a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
index 6fd85a9..0cb6ef2 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_swvenc_mpeg4.cpp
@@ -90,6 +90,10 @@
     m_debug.in_buffer_log = atoi(property_value);
 
     property_value[0] = '\0';
+    property_get("vendor.vidc.enc.log.in.rotated", property_value, "0");
+    m_debug.in_buffer_rotated_log = atoi(property_value);
+
+    property_value[0] = '\0';
     property_get("vendor.vidc.enc.log.out", property_value, "0");
     m_debug.out_buffer_log = atoi(property_value);
 
@@ -552,17 +556,21 @@
                     RETURN(OMX_ErrorUnsupportedSetting);
                 }
 
-                /* set the frame size */
-                Prop.id = SWVENC_PROPERTY_ID_FRAME_SIZE;
-                Prop.info.frame_size.height = portDefn->format.video.nFrameHeight;
-                Prop.info.frame_size.width  = portDefn->format.video.nFrameWidth;
+                // don't update frame size if it's unchanged
+                if (m_sInPortDef.format.video.nFrameWidth != portDefn->format.video.nFrameWidth
+                        || m_sInPortDef.format.video.nFrameHeight != portDefn->format.video.nFrameHeight) {
+                    /* set the frame size */
+                    Prop.id = SWVENC_PROPERTY_ID_FRAME_SIZE;
+                    Prop.info.frame_size.height = portDefn->format.video.nFrameHeight;
+                    Prop.info.frame_size.width  = portDefn->format.video.nFrameWidth;
 
-                Ret = swvenc_setproperty(m_hSwVenc, &Prop);
-                if (Ret != SWVENC_S_SUCCESS)
-                {
-                   DEBUG_PRINT_ERROR("%s, swvenc_setproperty failed (%d)",
-                     __FUNCTION__, Ret);
-                   RETURN(OMX_ErrorUnsupportedSetting);
+                    Ret = swvenc_setproperty(m_hSwVenc, &Prop);
+                    if (Ret != SWVENC_S_SUCCESS)
+                    {
+                        DEBUG_PRINT_ERROR("%s, swvenc_setproperty failed (%d)",
+                                __FUNCTION__, Ret);
+                    RETURN(OMX_ErrorUnsupportedSetting);
+                    }
                 }
 
                 /* set the input frame-rate */
@@ -1849,7 +1857,7 @@
     Prop.info.frame_size.width = inHeight;
 
     DEBUG_PRINT_HIGH("setting flipped dimensions to swencoder, WxH (%d x %d)",
-            inWidth, inHeight);
+            Prop.info.frame_size.width, Prop.info.frame_size.height);
     Ret = swvenc_setproperty(m_hSwVenc, &Prop);
     if (Ret != SWVENC_S_SUCCESS) {
         // currently, set dimensions to encoder can only be called when encoder is
@@ -2388,6 +2396,7 @@
 
     if (m_debug.in_buffer_log)
     {
+       // dump before rotation, un-rotated buffer
        swvenc_input_log_buffers((const char*)ipbuffer.p_buffer, ipbuffer.filled_length);
     }
 
@@ -2396,6 +2405,11 @@
             DEBUG_PRINT_ERROR("rotate failed");
             return OMX_ErrorUndefined;
         }
+        if (m_debug.in_buffer_rotated_log) {
+            // dump after rotation, rotated buffer
+            DEBUG_PRINT_ERROR("dump rotated");
+            swvenc_input_log_rotated_buffers((const char*)ipbuffer.p_buffer, ipbuffer.filled_length);
+        }
     }
 
     Ret = swvenc_emptythisbuffer(m_hSwVenc, &ipbuffer);
@@ -2873,8 +2887,8 @@
     if (m_debug.out_buffer_log && !m_debug.outfile)
     {
         int size = 0;
-        int width = m_sInPortDef.format.video.nFrameWidth;
-        int height = m_sInPortDef.format.video.nFrameHeight;
+        int width = m_sOutPortDef.format.video.nFrameWidth;
+        int height = m_sOutPortDef.format.video.nFrameHeight;
         if(SWVENC_CODEC_MPEG4 == m_codec)
         {
            size = snprintf(m_debug.outfile_name, PROPERTY_VALUE_MAX,
@@ -2960,6 +2974,59 @@
    RETURN(0);
 }
 
+int omx_venc::swvenc_input_log_rotated_buffers(const char *buffer, int bufferlen)
+{
+   int width = m_sInPortDef.format.video.nFrameWidth;
+   int height = m_sInPortDef.format.video.nFrameHeight;
+   if (m_bIsInFlipDone) {
+       auto v = width;
+       width = height;
+       height = v;
+   }
+   int stride = SWVENC_Y_STRIDE(COLOR_FMT_NV12, width);
+   int scanlines = SWVENC_Y_SCANLINES(COLOR_FMT_NV12, height);
+   char *temp = (char*)buffer;
+
+   if (!m_debug.inrotatedfile)
+   {
+       int size = snprintf(m_debug.inrotatedfile_name, PROPERTY_VALUE_MAX,
+                      "%s/input_enc_rotated_%d_%d_%p.yuv",
+                      m_debug.log_loc, width, height, this);
+       if ((size > PROPERTY_VALUE_MAX) || (size < 0))
+       {
+           DEBUG_PRINT_ERROR("Failed to open input rotated file: %s for logging size:%d",
+                              m_debug.inrotatedfile_name, size);
+           RETURN(-1);
+       }
+       DEBUG_PRINT_LOW("input rotated filename = %s", m_debug.inrotatedfile_name);
+       m_debug.inrotatedfile = fopen (m_debug.inrotatedfile_name, "ab");
+       if (!m_debug.inrotatedfile)
+       {
+           DEBUG_PRINT_HIGH("Failed to open input rotated file: %s for logging",
+              m_debug.inrotatedfile_name);
+           m_debug.inrotatedfile_name[0] = '\0';
+           RETURN(-1);
+       }
+   }
+   if (m_debug.inrotatedfile && buffer && bufferlen)
+   {
+       DEBUG_PRINT_LOW("%s buffer length: %d", __func__, bufferlen);
+       for (int i = 0; i < height; i++)
+       {
+          fwrite(temp, width, 1, m_debug.inrotatedfile);
+          temp += stride;
+       }
+       temp = (char*)(buffer + (stride * scanlines));
+       for(int i = 0; i < height/2; i++)
+       {
+          fwrite(temp, width, 1, m_debug.inrotatedfile);
+          temp += stride;
+      }
+   }
+
+   RETURN(0);
+}
+
 int omx_venc::dev_extradata_log_buffers(char *buffer, bool input)
 {
    ENTER_FUNC();
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 8f0868b..6002f32 100644
--- a/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
+++ b/mm-video-v4l2/vidc/venc/src/omx_video_encoder.cpp
@@ -248,8 +248,25 @@
         codec_type = OMX_VIDEO_CodingHEVC;
     } else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.heic",    \
                 OMX_MAX_STRINGNAME_SIZE)) {
-        strlcpy((char *)m_cRole, "video_encoder.hevc", OMX_MAX_STRINGNAME_SIZE);
-        codec_type = OMX_VIDEO_CodingImageHEIC;
+        char platform_name[PROP_VALUE_MAX] = {0};
+        char version[PROP_VALUE_MAX] = {0};
+        property_get("ro.board.platform", platform_name, "0");  //HW ID
+        if (!strcmp(platform_name, "sm6150"))
+        {
+            if (property_get("vendor.media.target.version", version, "0") &&
+                    (atoi(version) == 0))
+            {
+                //Sku version, HEIC is disabled on this target
+                DEBUG_PRINT_ERROR("heic encoder not supported on this target");
+                eRet = OMX_ErrorInvalidComponentName;
+            } else {
+                strlcpy((char *)m_cRole, "video_encoder.hevc", OMX_MAX_STRINGNAME_SIZE);
+                codec_type = OMX_VIDEO_CodingImageHEIC;
+            }
+        } else {
+            strlcpy((char *)m_cRole, "video_encoder.hevc", OMX_MAX_STRINGNAME_SIZE);
+            codec_type = OMX_VIDEO_CodingImageHEIC;
+        }
     } else if (!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.hevc.secure",    \
                 OMX_MAX_STRINGNAME_SIZE)) {
         strlcpy((char *)m_cRole, "video_encoder.hevc", OMX_MAX_STRINGNAME_SIZE);
@@ -495,6 +512,7 @@
                 &m_sOutPortDef.nBufferSize,
                 m_sOutPortDef.nPortIndex) != true) {
         eRet = OMX_ErrorUndefined;
+        goto init_error;
     }
 
     // Initialize the video color format for input port
@@ -950,7 +968,7 @@
                 avc_param.nCabacInitIdc = 0;
                 if ((pParam->eProfile == OMX_VIDEO_AVCProfileHigh)||
                     (pParam->eProfile == OMX_VIDEO_AVCProfileMain)||
-                    (pParam->eProfile == static_cast <OMX_VIDEO_AVCPROFILETYPE> (OMX_VIDEO_AVCProfileConstrainedHigh))) {
+                    (pParam->eProfile == (OMX_VIDEO_AVCPROFILETYPE)OMX_VIDEO_AVCProfileConstrainedHigh)) {
 
                     if (pParam->nBFrames) {
                         avc_param.nBFrames = pParam->nBFrames;
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 5a6c384..5e1b280 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
@@ -2120,6 +2120,12 @@
             DEBUG_PRINT_LOW("Set buffer count = %d as metadata mode and batchmode enabled", minCount);
         }
 
+        // reset min count to 4 for HEIC cases
+        if (mIsGridset) {
+            minCount = 4;
+            DEBUG_PRINT_LOW("Set buffer count = %d for HEIC", minCount);
+        }
+
         minCount = MAX((unsigned int)control.value, minCount);
         m_sInput_buff_property.mincount = minCount;
 
@@ -4169,7 +4175,7 @@
     struct v4l2_buffer buf;
     struct v4l2_requestbuffers bufreq;
     struct v4l2_plane plane[VIDEO_MAX_PLANES];
-    int rc = 0, extra_idx;
+    int rc = 0, extra_idx, c2d_enabled = 0;
     bool interlace_flag = false;
     struct OMX_BUFFERHEADERTYPE *bufhdr;
     LEGACY_CAM_METADATA_TYPE * meta_buf = NULL;
@@ -4547,6 +4553,7 @@
                 // color_format == 1 ==> RGBA to YUV Color-converted buffer
                 // Buffers color-converted via C2D have 601-Limited color
                 if (!streaming[OUTPUT_PORT]) {
+                    c2d_enabled = 1;
                     DEBUG_PRINT_HIGH("Setting colorspace 601-L for Color-converted buffer");
                     venc_set_colorspace(MSM_VIDC_BT601_6_625, 0 /*range-limited*/,
                             MSM_VIDC_TRANSFER_601_6_525, MSM_VIDC_MATRIX_601_6_525);
@@ -4568,9 +4575,9 @@
         }
     }
 
-    if (!streaming[OUTPUT_PORT] &&
+    if (!streaming[OUTPUT_PORT] && (c2d_enabled ||
         (m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_TP10_UBWC &&
-         m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_UBWC)) {
+         m_sVenc_cfg.inputformat != V4L2_PIX_FMT_NV12_UBWC))) {
         if (bframe_implicitly_enabled) {
             DEBUG_PRINT_HIGH("Disabling implicitly enabled B-frames");
             intra_period.num_pframes = nPframes_cache;
@@ -7265,9 +7272,6 @@
     /* Initialize to zero & update as per required color format */
     *usage = 0;
 
-    /* Configure UBWC as default */
-    *usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
-
     if (hevc && eProfile == (OMX_U32)OMX_VIDEO_HEVCProfileMain10HDR10) {
         DEBUG_PRINT_INFO("Setting 10-bit consumer usage bits");
         *usage |= GRALLOC_USAGE_PRIVATE_10BIT_VIDEO;
diff --git a/product.mk b/product.mk
index ddffee3..2aa09cd 100644
--- a/product.mk
+++ b/product.mk
@@ -22,8 +22,8 @@
 
 PRODUCT_PACKAGES += $(MM_VIDEO)
 
-ifeq ($(call is-board-platform-in-list, msmnile $(MSMSTEPPE) atoll $(TRINKET)),true)
-include hardware/qcom/media/conf_files/$(TARGET_BOARD_PLATFORM)/$(TARGET_BOARD_PLATFORM).mk
+ifeq ($(call is-board-platform-in-list, msmnile $(MSMSTEPPE)),true)
+include hardware/qcom/sm8150/media/conf_files/$(TARGET_BOARD_PLATFORM)/$(TARGET_BOARD_PLATFORM).mk
 else ifeq ($(TARGET_BOARD_PLATFORM), sdmshrike)
 include hardware/qcom/media/conf_files/msmnile/msmnile.mk
 endif