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/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..2be052c
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/hardware/qcom/media
diff --git a/Android.mk b/Android.mk
index eae0e2b..c86f724 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,5 @@
+ifeq ($(call my-dir),$(call project-path-for,qcom-media))
+
 QCOM_MEDIA_ROOT := $(call my-dir)
 
 #Compile these for all targets under QCOM_BOARD_PLATFORMS list.
@@ -15,3 +17,5 @@
 include $(QCOM_MEDIA_ROOT)/hypv-intercept/Android.mk
 endif
 endif
+
+endif
diff --git a/libc2dcolorconvert/Android.mk b/libc2dcolorconvert/Android.mk
index f6158fc..c9a3297 100644
--- a/libc2dcolorconvert/Android.mk
+++ b/libc2dcolorconvert/Android.mk
@@ -14,7 +14,7 @@
 LOCAL_HEADER_LIBRARIES := \
         libutils_headers \
         libhardware_headers \
-        display_intf_headers
+        display_headers
 
 LOCAL_SHARED_LIBRARIES := liblog libdl
 
diff --git a/libplatformconfig/Android.mk b/libplatformconfig/Android.mk
index c346b0e..d4a82d0 100644
--- a/libplatformconfig/Android.mk
+++ b/libplatformconfig/Android.mk
@@ -2,8 +2,6 @@
 LOCAL_DIR_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_COPY_HEADERS_TO := libplatformconfig
-
 libplatformconfig-def := \
       -g0 -O3 -fpic \
       -Wno-deprecated-declarations -Werror \
@@ -15,8 +13,6 @@
 
 COMMON_CFLAGS := -O3
 
-include $(BUILD_COPY_HEADERS)
-
 LOCAL_CFLAGS := $(COMMON_CFLAGS) $(libplatformconfig-def)
 
 LOCAL_SHARED_LIBRARIES += \
diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk
index 89f17d7..b4ebd4b 100644
--- a/libstagefrighthw/Android.mk
+++ b/libstagefrighthw/Android.mk
@@ -17,14 +17,6 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-#===============================================================================
-#             Deploy the headers that can be exposed
-#===============================================================================
-
-LOCAL_COPY_HEADERS_TO   := mm-core/omxcore
-LOCAL_COPY_HEADERS      := QComOMXMetadata.h \
-                           QComOMXPlugin.h
-
 LOCAL_SRC_FILES := \
     QComOMXPlugin.cpp                      \
 
@@ -43,8 +35,6 @@
         libcutils_headers \
         libutils_headers
 
-LOCAL_C_INCLUDES:= $(TARGET_OUT_HEADERS)/mm-core/omxcore/
-
 LOCAL_SHARED_LIBRARIES :=       \
         libutils                \
         libcutils               \
diff --git a/mm-core/Android.mk b/mm-core/Android.mk
index a3f2b1e..66c0f9c 100644
--- a/mm-core/Android.mk
+++ b/mm-core/Android.mk
@@ -29,44 +29,11 @@
 endif
 
 #===============================================================================
-#             Deploy the headers that can be exposed
-#===============================================================================
-
-LOCAL_COPY_HEADERS_TO   := mm-core/omxcore
-LOCAL_COPY_HEADERS      := inc/OMX_Audio.h
-LOCAL_COPY_HEADERS      += inc/OMX_Component.h
-LOCAL_COPY_HEADERS      += inc/OMX_ContentPipe.h
-LOCAL_COPY_HEADERS      += inc/OMX_Core.h
-LOCAL_COPY_HEADERS      += inc/OMX_Image.h
-LOCAL_COPY_HEADERS      += inc/OMX_Index.h
-LOCAL_COPY_HEADERS      += inc/OMX_IVCommon.h
-LOCAL_COPY_HEADERS      += inc/OMX_Other.h
-LOCAL_COPY_HEADERS      += inc/OMX_QCOMExtns.h
-LOCAL_COPY_HEADERS      += inc/OMX_Types.h
-LOCAL_COPY_HEADERS      += inc/OMX_Video.h
-LOCAL_COPY_HEADERS      += inc/qc_omx_common.h
-LOCAL_COPY_HEADERS      += inc/qc_omx_component.h
-LOCAL_COPY_HEADERS      += inc/qc_omx_msg.h
-LOCAL_COPY_HEADERS      += inc/QOMX_AudioExtensions.h
-LOCAL_COPY_HEADERS      += inc/QOMX_AudioIndexExtensions.h
-LOCAL_COPY_HEADERS      += inc/OMX_CoreExt.h
-LOCAL_COPY_HEADERS      += inc/QOMX_CoreExtensions.h
-LOCAL_COPY_HEADERS      += inc/QOMX_FileFormatExtensions.h
-LOCAL_COPY_HEADERS      += inc/QOMX_IVCommonExtensions.h
-LOCAL_COPY_HEADERS      += inc/QOMX_SourceExtensions.h
-LOCAL_COPY_HEADERS      += inc/QOMX_VideoExtensions.h
-LOCAL_COPY_HEADERS      += inc/OMX_IndexExt.h
-LOCAL_COPY_HEADERS      += inc/OMX_VideoExt.h
-LOCAL_COPY_HEADERS      += inc/QOMX_StreamingExtensions.h
-LOCAL_COPY_HEADERS      += inc/QCMediaDefs.h
-LOCAL_COPY_HEADERS      += inc/QCMetaData.h
-
-#===============================================================================
 #             LIBRARY for Android apps
 #===============================================================================
 
 LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/media/libplatformconfig
+LOCAL_C_INCLUDES        += $(call project-path-for,qcom-media)/libplatformconfig
 
 LOCAL_HEADER_LIBRARIES := \
         libutils_headers \
@@ -101,7 +68,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_C_INCLUDES        := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES        += $(TOP)/hardware/qcom/media/libplatformconfig
+LOCAL_C_INCLUDES        += $(call project-path-for,qcom-media)/libplatformconfig
 
 LOCAL_HEADER_LIBRARIES := \
         libutils_headers \
diff --git a/mm-video-v4l2/vidc/common/Android.mk b/mm-video-v4l2/vidc/common/Android.mk
index c282cfb..4361c93 100644
--- a/mm-video-v4l2/vidc/common/Android.mk
+++ b/mm-video-v4l2/vidc/common/Android.mk
@@ -21,8 +21,8 @@
 # ---------------------------------------------------------------------------------
 
 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      += $(call project-path-for,qcom-media)/mm-core/inc
+libmm-vidc-inc      += $(call project-path-for,qcom-media)/libc2dcolorconvert
 libmm-vidc-inc      += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
 libmm-vidc-inc      += $(TOP)/hardware/libhardware/include
 libmm-vidc-inc      += $(LIBION_HEADER_PATHS)
diff --git a/mm-video-v4l2/vidc/vdec/Android.mk b/mm-video-v4l2/vidc/vdec/Android.mk
index 8903538..b7a3163 100644
--- a/mm-video-v4l2/vidc/vdec/Android.mk
+++ b/mm-video-v4l2/vidc/vdec/Android.mk
@@ -58,19 +58,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          += $(call project-path-for,qcom-media)/mm-video-v4l2/vidc/common/inc
+libmm-vdec-inc          += $(call project-path-for,qcom-media)/mm-core/inc
+libmm-vdec-inc          += $(call project-path-for,qcom-media)/libplatformconfig
 libmm-vdec-inc          += $(TARGET_OUT_HEADERS)/adreno
-libmm-vdec-inc      	+= $(TOP)/hardware/qcom/media/libc2dcolorconvert
+libmm-vdec-inc      	+= $(call project-path-for,qcom-media)/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      	+= $(call project-path-for,qcom-media)/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 += $(call project-path-for,qcom-media)/libstagefrighthw
 endif
 
 # Common Dependencies
@@ -90,7 +90,7 @@
 
 ifeq ($(ENABLE_HYP),true)
 libmm-vdec-def += -DHYPERVISOR
-libmm-vdec-inc += $(TOP)/hardware/qcom/media/hypv-intercept
+libmm-vdec-inc += $(call project-path-for,qcom-media)/hypv-intercept
 endif
 # ---------------------------------------------------------------------------------
 # 			Make the Shared library (libOmxVdec)
@@ -108,7 +108,7 @@
         libnativebase_headers \
         libutils_headers \
         libhardware_headers \
-        display_intf_headers
+        display_headers
 
 LOCAL_C_INCLUDES                += $(libmm-vdec-inc)
 LOCAL_ADDITIONAL_DEPENDENCIES   := $(libmm-vdec-add-dep)
@@ -150,7 +150,7 @@
         libnativebase_headers \
         libutils_headers \
         libhardware_headers \
-        display_intf_headers
+        display_headers
 
 LOCAL_C_INCLUDES              += $(libmm-vdec-inc)
 LOCAL_ADDITIONAL_DEPENDENCIES := $(libmm-vdec-add-dep)
diff --git a/mm-video-v4l2/vidc/venc/Android.mk b/mm-video-v4l2/vidc/venc/Android.mk
index aea70b2..3e3e97f 100644
--- a/mm-video-v4l2/vidc/venc/Android.mk
+++ b/mm-video-v4l2/vidc/venc/Android.mk
@@ -39,6 +39,10 @@
 
 libmm-venc-def += -D_UBWC_
 
+ifeq ($(TARGET_DISABLED_UBWC),true)
+libmm-venc-def += -DDISABLE_UBWC
+endif
+
 ifeq ($(call is-board-platform-in-list, $(TARGETS_THAT_SUPPORT_VQZIP)),true)
 libmm-venc-def += -D_VQZIP_
 endif
@@ -66,12 +70,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      += $(call project-path-for,qcom-media)/mm-video-v4l2/vidc/common/inc
+libmm-venc-inc      += $(call project-path-for,qcom-media)/mm-core/inc
+libmm-venc-inc      += $(call project-path-for,qcom-media)/libstagefrighthw
+libmm-venc-inc      += $(call project-path-for,qcom-media)/libplatformconfig
 libmm-venc-inc      += $(TARGET_OUT_HEADERS)/adreno
-libmm-venc-inc      += hardware/qcom/media/libc2dcolorconvert
+libmm-venc-inc      += $(call project-path-for,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
@@ -79,7 +83,7 @@
 libmm-venc-inc      += $(TOP)/frameworks/native/libs/arect/include
 
 ifeq ($(ENABLE_HYP),true)
-libmm-venc-inc      += hardware/qcom/media/hypv-intercept
+libmm-venc-inc      += $(call project-path-for,qcom-media)/hypv-intercept
 endif
 
 ifneq ($(call is-board-platform-in-list, $(TARGETS_THAT_DONT_SUPPORT_SW_VENC_ROTATION)),true)
@@ -106,7 +110,7 @@
         libcutils_headers \
         libutils_headers \
         libhardware_headers \
-        display_intf_headers
+        display_headers
 
 LOCAL_C_INCLUDES                := $(libmm-venc-inc)
 LOCAL_ADDITIONAL_DEPENDENCIES   := $(libmm-venc-add-dep)
@@ -134,6 +138,7 @@
 # 			Make the Shared library (libOmxSwVencMpeg4)
 # ---------------------------------------------------------------------------------
 
+ifneq ($(QCPATH),)
 include $(CLEAR_VARS)
 
 libmm-venc-inc      += $(TARGET_OUT_HEADERS)/mm-video/swvenc
@@ -149,7 +154,7 @@
         libnativebase_headers \
         libutils_headers \
         libhardware_headers \
-        display_intf_headers
+        display_headers
 
 LOCAL_C_INCLUDES                := $(libmm-venc-inc)
 LOCAL_ADDITIONAL_DEPENDENCIES   := $(libmm-venc-add-dep)
@@ -173,6 +178,7 @@
 LOCAL_SRC_FILES   += src/omx_swvenc_mpeg4.cpp
 
 include $(BUILD_SHARED_LIBRARY)
+endif # QCPATH
 endif
 
 
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 4219e63..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
@@ -7283,8 +7283,10 @@
     /* Initialize to zero & update as per required color format */
     *usage = 0;
 
+#ifndef DISABLE_UBWC
     /* Configure UBWC as default */
     *usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
+#endif
 
     if (hevc &&
        (eProfile == (OMX_U32)OMX_VIDEO_HEVCProfileMain10HDR10 ||