Merge remote-tracking branch 'goog/qcom/release/LA.UM.8.1.C9.09.00.00.518.107'
Bug: 129559122
Change-Id: Ie17efecb43a404ecfe0f15576caf8656598e04ad
diff --git a/libplatformconfig/Android.mk b/libplatformconfig/Android.mk
index 9fe15be..c346b0e 100644
--- a/libplatformconfig/Android.mk
+++ b/libplatformconfig/Android.mk
@@ -35,6 +35,16 @@
LOCAL_SRC_FILES := PlatformConfig.cpp
LOCAL_SRC_FILES += ConfigParser.cpp
+####################
+ENABLE_CONFIGSTORE = true
+ifeq ($(ENABLE_CONFIGSTORE),true)
+LOCAL_SRC_FILES += ConfigStore.cpp
+LOCAL_CFLAGS += -DENABLE_CONFIGSTORE
+LOCAL_SHARED_LIBRARIES += libhidlbase
+LOCAL_SHARED_LIBRARIES += vendor.qti.hardware.capabilityconfigstore@1.0
+endif
+####################
+
LOCAL_MODULE := libplatformconfig
LOCAL_VENDOR_MODULE := true
diff --git a/libplatformconfig/ConfigStore.cpp b/libplatformconfig/ConfigStore.cpp
new file mode 100644
index 0000000..05c2aaa
--- /dev/null
+++ b/libplatformconfig/ConfigStore.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 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:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include "ConfigStore.h"
+#include "PlatformConfig.h"
+
+bool isConfigStoreEnabled()
+{
+ return Platform::Config::isConfigStoreEnabled();
+}
+
+uint32_t getConfigStoreBool(const char *area, const char *config,
+ bool *value, const bool defaultValue)
+{
+ using Platform::ConfigError_t;
+
+ ConfigError_t err = ConfigError_t::OK;
+
+ if (!area || !config || !value) {
+ err = ConfigError_t::FAIL;
+ }
+
+ if (err == ConfigError_t::OK) {
+ err = Platform::Config::getConfigStoreBool(area, config, *value, defaultValue);
+ }
+
+ return static_cast<uint32_t>(err);
+}
diff --git a/libplatformconfig/ConfigStore.h b/libplatformconfig/ConfigStore.h
new file mode 100644
index 0000000..2c75fb1
--- /dev/null
+++ b/libplatformconfig/ConfigStore.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 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:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CONFIG_STORE_H__
+#define __CONFIG_STORE_H__
+
+//////////////////////////////////////////////////////////////////////////////
+// Include Files
+//////////////////////////////////////////////////////////////////////////////
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// wrappers to allow C files to access ConfigStore
+bool isConfigStoreEnabled();
+uint32_t getConfigStoreBool(const char *area, const char *config,
+ bool *value, const bool defaultValue);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // __CONFIG_STORE_H__
diff --git a/libplatformconfig/PlatformConfig.cpp b/libplatformconfig/PlatformConfig.cpp
index 35237e8..cd8956b 100644
--- a/libplatformconfig/PlatformConfig.cpp
+++ b/libplatformconfig/PlatformConfig.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 - 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017 - 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
@@ -35,6 +35,11 @@
#include "PlatformConfig.h"
#include "ConfigParser.h"
+#ifdef ENABLE_CONFIGSTORE
+#include <vendor/qti/hardware/capabilityconfigstore/1.0/types.h>
+#include <vendor/qti/hardware/capabilityconfigstore/1.0/ICapabilityConfigStore.h>
+#endif
+
namespace Platform {
#define PLAT_CONFIG_FILE "/vendor/etc/system_properties.xml"
@@ -71,4 +76,67 @@
return OK;
}
+bool Config::isConfigStoreEnabled()
+{
+#ifdef ENABLE_CONFIGSTORE
+ return true;
+#else
+ return false;
+#endif
+}
+
+ConfigError_t Config::getConfigStoreBool(const char *area, const char *config,
+ bool &value, const bool defaultValue)
+{
+#ifdef ENABLE_CONFIGSTORE
+ using vendor::qti::hardware::capabilityconfigstore::V1_0::Result;
+ using vendor::qti::hardware::capabilityconfigstore::V1_0::CommandResult;
+ if (area == nullptr || config == nullptr) {
+ return FAIL;
+ }
+
+ value = defaultValue;
+
+ Config *conf = getInstance();
+ if (conf == nullptr) {
+ return FAIL;
+ }
+
+ // load on demand
+ if (conf->mConfigStore == nullptr) {
+ conf->mConfigStore = ICapabilityConfigStore::tryGetService();
+ }
+
+ if (conf->mConfigStore == nullptr) {
+ VIDC_PLAT_LOGH("%s: unable to get configstore service", __func__);
+ return FAIL;
+ }
+
+ CommandResult result;
+ conf->mConfigStore->getConfig(area, config, [&](const CommandResult &res) {
+ result = res;
+ });
+
+ if (result.result_type != Result::SUCCESS) {
+ VIDC_PLAT_LOGH("%s: %s/%s not found(%u)", __func__, area, config,
+ result.result_type);
+ return FAIL;
+ }
+
+ if (strncasecmp("true", result.value.c_str(), result.value.size()) == 0) {
+ value = true;
+ } else {
+ value = false;
+ }
+ VIDC_PLAT_LOGH("%s: %s/%s=%s, returning %s ", __func__, area, config,
+ result.value.c_str(), value ? "true" : "false");
+ return OK;
+#else
+ (void)(area);
+ (void)(config);
+ value = defaultValue;
+ return OK;
+#endif
+}
+
}
diff --git a/libplatformconfig/PlatformConfig.h b/libplatformconfig/PlatformConfig.h
index 4c79a0e..40a035c 100644
--- a/libplatformconfig/PlatformConfig.h
+++ b/libplatformconfig/PlatformConfig.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -36,6 +36,10 @@
#include <string>
#include <map>
+#ifdef ENABLE_CONFIGSTORE
+#include <vendor/qti/hardware/capabilityconfigstore/1.0/ICapabilityConfigStore.h>
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -44,6 +48,11 @@
typedef std::map<std::string, std::string> ConfigMap;
+#ifdef ENABLE_CONFIGSTORE
+using namespace android;
+using vendor::qti::hardware::capabilityconfigstore::V1_0::ICapabilityConfigStore;
+#endif
+
typedef enum {
OK = 0,
FAIL = 1,
@@ -97,9 +106,17 @@
ConfigMap mConfigMap;
static Config* mInstance;
+#ifdef ENABLE_CONFIGSTORE
+ android::sp<ICapabilityConfigStore> mConfigStore;
+#endif
+
public:
static ConfigError_t getInt32(Config_t config, int32_t *value,
const int32_t defaultValue);
+
+ static bool isConfigStoreEnabled();
+ static ConfigError_t getConfigStoreBool(const char *area,
+ const char *config, bool &value, const bool defaultValue);
};
}
diff --git a/mm-core/Android.mk b/mm-core/Android.mk
index d607156..423ae81 100644
--- a/mm-core/Android.mk
+++ b/mm-core/Android.mk
@@ -65,6 +65,7 @@
LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/common
LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TOP)/hardware/qcom/media/libplatformconfig
LOCAL_HEADER_LIBRARIES := \
libutils_headers
@@ -97,6 +98,7 @@
LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/common
LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TOP)/hardware/qcom/media/libplatformconfig
LOCAL_HEADER_LIBRARIES := \
libutils_headers
diff --git a/mm-core/src/common/qc_omx_core.c b/mm-core/src/common/qc_omx_core.c
index 7d38b3e..341a44d 100644
--- a/mm-core/src/common/qc_omx_core.c
+++ b/mm-core/src/common/qc_omx_core.c
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2009, 2015, 2018, The Linux Foundation. All rights reserved.
+Copyright (c) 2009, 2015, 2018-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:
@@ -49,6 +49,8 @@
#include "omx_core_cmp.h"
#include <cutils/properties.h>
+#include "ConfigStore.h"
+
extern omx_core_cb_type core[];
extern const unsigned int SIZE_OF_CORE;
static pthread_mutex_t lock_core = PTHREAD_MUTEX_INITIALIZER;
@@ -425,16 +427,25 @@
}
if(cmp_index >= 0)
{
- char value[PROPERTY_VALUE_MAX];
DEBUG_PRINT("getting fn pointer\n");
- // Load VPP omx component for decoder if vpp
- // property is enabled
- if ((property_get("vendor.media.vpp.enable", value, NULL))
- && (!strcmp("1", value) || !strcmp("true", value))) {
- DEBUG_PRINT("VPP property is enabled");
- if (!strcmp(core[cmp_index].so_lib_name, "libOmxVdec.so")
- || !strcmp(core[cmp_index].so_lib_name, "libOmxSwVdec.so")) {
+ // Load VPP omx component for decoder if vpp property is enabled
+ const char *hwDecLib = "libOmxVdec.so";
+ const char *swDecLib = "libOmxSwVdec.so";
+ if (!strncmp(core[cmp_index].so_lib_name, hwDecLib, strlen(hwDecLib)) ||
+ !strncmp(core[cmp_index].so_lib_name, swDecLib, strlen(swDecLib))) {
+ bool isVppEnabled = false;
+ if (isConfigStoreEnabled()) {
+ getConfigStoreBool("vpp", "enable", &isVppEnabled, false);
+ } else {
+ char value[PROPERTY_VALUE_MAX];
+ if ((property_get("vendor.media.vpp.enable", value, NULL))
+ && (!strcmp("1", value) || !strcmp("true", value))) {
+ isVppEnabled = true;
+ }
+ }
+ if (isVppEnabled) {
+ DEBUG_PRINT("VPP property is enabled");
vpp_cmp_index = get_cmp_index("OMX.qti.vdec.vpp");
if (vpp_cmp_index < 0) {
DEBUG_PRINT_ERROR("Unable to find VPP OMX lib in registry ");
diff --git a/product.mk b/product.mk
index 44f6055..ff47072 100644
--- a/product.mk
+++ b/product.mk
@@ -1,4 +1,4 @@
-MSM_VIDC_TARGET_LIST := msmnile
+#MSM_VIDC_TARGET_LIST := msmnile
ifeq ($(call is-board-platform-in-list, $(QCOM_BOARD_PLATFORMS)),true)
@@ -22,6 +22,8 @@
PRODUCT_PACKAGES += $(MM_VIDEO)
+ifeq ($(call is-board-platform-in-list, msmnile),true)
include hardware/qcom/media/conf_files/$(TARGET_BOARD_PLATFORM)/$(TARGET_BOARD_PLATFORM).mk
+endif
endif