[automerger skipped] resolve merge conflicts of cd02298b46cfb17954555e0f1d324f63085aa204 to oreo-mr1-vts-dev am: 79cea44239 -s ours am: 46a5d4f73b am: 72c90cbaa5
am: a9891eebb3
Change-Id: I3084a0db5c459428df4b0169b75e6b2ad4223c64
diff --git a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
index 95080d1..91adfc1 100644
--- a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
+++ b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
@@ -45,29 +45,37 @@
xmlFilePath, xsdFilePath)
/** Validate an XML according to an xsd.
- * The XML file must be in at least one of the provided locations.
- * If multiple are found, all are validated.
+ * All file named xmlFileName in each xmlFileLocations folder must be valid if present.
+ * @tparam atLeastOneRequired If true, at least one file has to be found.
+ * If false, no found file is a success.
*/
+template <bool atLeastOneRequired = true>
::testing::AssertionResult validateXmlMultipleLocations(
const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath);
-/** ASSERT that an XML is valid according to an xsd.
- * The XML file must be in at least one of the provided locations.
- * If multiple are found, all are validated.
- */
-#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
- ASSERT_PRED_FORMAT3( \
- ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \
+/** ASSERT that all found XML are valid according to an xsd. */
+#define ASSERT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
+ ASSERT_PRED_FORMAT3( \
+ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
xmlFileName, xmlFileLocations, xsdFilePath)
-/** EXPECT an XML to be valid according to an xsd.
- * The XML file must be in at least one of the provided locations.
- * If multiple are found, all are validated.
- */
-#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
- EXPECT_PRED_FORMAT3( \
- ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations, \
+/** EXPECT that all found XML are valid according to an xsd. */
+#define EXPECT_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
+ EXPECT_PRED_FORMAT3( \
+ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<false>, \
+ xmlFileName, xmlFileLocations, xsdFilePath)
+
+/** ASSERT that all found XML are valid according to an xsd. At least one must be found. */
+#define ASSERT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
+ ASSERT_PRED_FORMAT3( \
+ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
+ xmlFileName, xmlFileLocations, xsdFilePath)
+
+/** EXPECT that all found XML are valid according to an xsd. At least one must be found. */
+#define EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(xmlFileName, xmlFileLocations, xsdFilePath) \
+ EXPECT_PRED_FORMAT3( \
+ ::android::hardware::audio::common::test::utility::validateXmlMultipleLocations<true>, \
xmlFileName, xmlFileLocations, xsdFilePath)
} // namespace utility
diff --git a/audio/common/all-versions/test/utility/src/ValidateXml.cpp b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
index 5030af5..1a906d6 100644
--- a/audio/common/all-versions/test/utility/src/ValidateXml.cpp
+++ b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
@@ -129,6 +129,7 @@
return ::testing::AssertionSuccess();
}
+template <bool atLeastOneRequired>
::testing::AssertionResult validateXmlMultipleLocations(
const char* xmlFileNameExpr, const char* xmlFileLocationsExpr, const char* xsdFilePathExpr,
const char* xmlFileName, std::vector<const char*> xmlFileLocations, const char* xsdFilePath) {
@@ -150,7 +151,7 @@
}
}
- if (foundFiles.empty()) {
+ if (atLeastOneRequired && foundFiles.empty()) {
errors.push_back("No xml file found in provided locations.\n");
}
@@ -160,9 +161,20 @@
<< " While validating all: " << xmlFileNameExpr
<< "\n Which is: " << xmlFileName
<< "\n In the following folders: " << xmlFileLocationsExpr
- << "\n Which is: " << ::testing::PrintToString(xmlFileLocations);
+ << "\n Which is: " << ::testing::PrintToString(xmlFileLocations)
+ << (atLeastOneRequired ? "Where at least one file must be found."
+ : "Where no file might exist.");
}
+template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*,
+ const char*, const char*,
+ std::vector<const char*>,
+ const char*);
+template ::testing::AssertionResult validateXmlMultipleLocations<false>(const char*, const char*,
+ const char*, const char*,
+ std::vector<const char*>,
+ const char*);
+
} // namespace utility
} // namespace test
} // namespace common
diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
index d0bc690..bf080d3 100644
--- a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
+++ b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
@@ -27,6 +27,6 @@
using namespace android::effectsConfig;
std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS));
- EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
- "/data/local/tmp/audio_effects_conf_V2_0.xsd");
+ EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
+ "/data/local/tmp/audio_effects_conf_V2_0.xsd");
}
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 69f8535..fd785df 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -53,6 +53,7 @@
camera3_callback_ops({&sProcessCaptureResult, &sNotify}),
mDevice(device),
mDeviceVersion(device->common.version),
+ mFreeBufEarly(shouldFreeBufEarly()),
mIsAELockAvailable(false),
mDerivePostRawSensKey(false),
mNumPartialResults(1),
@@ -129,6 +130,10 @@
return false;
}
+bool CameraDeviceSession::shouldFreeBufEarly() {
+ return property_get_bool("ro.vendor.camera.free_buf_early", 0) == 1;
+}
+
CameraDeviceSession::~CameraDeviceSession() {
if (!isClosed()) {
ALOGE("CameraDeviceSession deleted before close!");
@@ -887,6 +892,24 @@
(*streams)[i] = &mStreamMap[id];
}
+ if (mFreeBufEarly) {
+ // Remove buffers of deleted streams
+ for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) {
+ int id = it->first;
+ bool found = false;
+ for (const auto& stream : requestedConfiguration.streams) {
+ if (id == stream.id) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // Unmap all buffers of deleted stream
+ cleanupBuffersLocked(id);
+ }
+ }
+ }
+
return true;
}
@@ -908,7 +931,9 @@
// Unmap all buffers of deleted stream
// in case the configuration call succeeds and HAL
// is able to release the corresponding resources too.
- cleanupBuffersLocked(id);
+ if (!mFreeBufEarly) {
+ cleanupBuffersLocked(id);
+ }
it = mStreamMap.erase(it);
} else {
++it;
@@ -927,6 +952,27 @@
mResultBatcher.setBatchedStreams(mVideoStreamIds);
}
+
+void CameraDeviceSession::postProcessConfigurationFailureLocked(
+ const StreamConfiguration& requestedConfiguration) {
+ if (mFreeBufEarly) {
+ // Re-build the buf cache entry for deleted streams
+ for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) {
+ int id = it->first;
+ bool found = false;
+ for (const auto& stream : requestedConfiguration.streams) {
+ if (id == stream.id) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ mCirculatingBuffers.emplace(id, CirculatingBuffers{});
+ }
+ }
+ }
+}
+
Return<void> CameraDeviceSession::configureStreams(
const StreamConfiguration& requestedConfiguration,
ICameraDeviceSession::configureStreams_cb _hidl_cb) {
@@ -979,6 +1025,8 @@
// the corresponding resources of the deleted streams.
if (ret == OK) {
postProcessConfigurationLocked(requestedConfiguration);
+ } else {
+ postProcessConfigurationFailureLocked(requestedConfiguration);
}
if (ret == -EINVAL) {
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index af90e5a..bcee259 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -120,6 +120,8 @@
hidl_vec<camera3_stream_t*> *streams /*out*/);
void postProcessConfigurationLocked(const StreamConfiguration& requestedConfiguration);
+ void postProcessConfigurationFailureLocked(const StreamConfiguration& requestedConfiguration);
+
protected:
// protecting mClosed/mDisconnected/mInitFail
@@ -142,6 +144,7 @@
camera3_device_t* mDevice;
const uint32_t mDeviceVersion;
+ const bool mFreeBufEarly;
bool mIsAELockAvailable;
bool mDerivePostRawSensKey;
uint32_t mNumPartialResults;
@@ -293,6 +296,8 @@
bool initialize();
+ static bool shouldFreeBufEarly();
+
Status initStatus() const;
// Validate and import request's input buffer and acquire fence
diff --git a/camera/device/3.3/default/CameraDeviceSession.cpp b/camera/device/3.3/default/CameraDeviceSession.cpp
index d36e9ed..60174fb 100644
--- a/camera/device/3.3/default/CameraDeviceSession.cpp
+++ b/camera/device/3.3/default/CameraDeviceSession.cpp
@@ -92,6 +92,8 @@
// the corresponding resources of the deleted streams.
if (ret == OK) {
postProcessConfigurationLocked(requestedConfiguration);
+ } else {
+ postProcessConfigurationFailureLocked(requestedConfiguration);
}
if (ret == -EINVAL) {
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp
index 6a18161..f2e031c 100644
--- a/camera/device/3.4/default/CameraDeviceSession.cpp
+++ b/camera/device/3.4/default/CameraDeviceSession.cpp
@@ -154,6 +154,8 @@
// the corresponding resources of the deleted streams.
if (ret == OK) {
postProcessConfigurationLocked_3_4(requestedConfiguration);
+ } else {
+ postProcessConfigurationFailureLocked_3_4(requestedConfiguration);
}
if (ret == -EINVAL) {
@@ -215,6 +217,23 @@
(*streams)[i] = &mStreamMap[id];
}
+ if (mFreeBufEarly) {
+ // Remove buffers of deleted streams
+ for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) {
+ int id = it->first;
+ bool found = false;
+ for (const auto& stream : requestedConfiguration.streams) {
+ if (id == stream.v3_2.id) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ // Unmap all buffers of deleted stream
+ cleanupBuffersLocked(id);
+ }
+ }
+ }
return true;
}
@@ -236,7 +255,9 @@
// Unmap all buffers of deleted stream
// in case the configuration call succeeds and HAL
// is able to release the corresponding resources too.
- cleanupBuffersLocked(id);
+ if (!mFreeBufEarly) {
+ cleanupBuffersLocked(id);
+ }
it = mStreamMap.erase(it);
} else {
++it;
@@ -255,6 +276,26 @@
mResultBatcher_3_4.setBatchedStreams(mVideoStreamIds);
}
+void CameraDeviceSession::postProcessConfigurationFailureLocked_3_4(
+ const StreamConfiguration& requestedConfiguration) {
+ if (mFreeBufEarly) {
+ // Re-build the buf cache entry for deleted streams
+ for(auto it = mStreamMap.begin(); it != mStreamMap.end(); it++) {
+ int id = it->first;
+ bool found = false;
+ for (const auto& stream : requestedConfiguration.streams) {
+ if (id == stream.v3_2.id) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ mCirculatingBuffers.emplace(id, CirculatingBuffers{});
+ }
+ }
+ }
+}
+
Return<void> CameraDeviceSession::processCaptureRequest_3_4(
const hidl_vec<V3_4::CaptureRequest>& requests,
const hidl_vec<V3_2::BufferCache>& cachesToRemove,
diff --git a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
index 5d6a112..fdc8a5a 100644
--- a/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
+++ b/camera/device/3.4/default/include/device_v3_4_impl/CameraDeviceSession.h
@@ -84,6 +84,8 @@
camera3_stream_configuration_t *stream_list /*out*/,
hidl_vec<camera3_stream_t*> *streams /*out*/);
void postProcessConfigurationLocked_3_4(const StreamConfiguration& requestedConfiguration);
+ void postProcessConfigurationFailureLocked_3_4(
+ const StreamConfiguration& requestedConfiguration);
Return<void> processCaptureRequest_3_4(
const hidl_vec<V3_4::CaptureRequest>& requests,
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 1a245c4..439333d 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -4046,10 +4046,10 @@
<< static_cast<uint32_t>(inflightReq.errorCode);
}
}
-
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
+
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
}
}
diff --git a/drm/1.0/default/DrmFactory.cpp b/drm/1.0/default/DrmFactory.cpp
index 7e5d998..05951d7 100644
--- a/drm/1.0/default/DrmFactory.cpp
+++ b/drm/1.0/default/DrmFactory.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
-` *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
diff --git a/drm/1.0/default/LegacyPluginPath.cpp b/drm/1.0/default/LegacyPluginPath.cpp
index 369059d..d0a8f90 100644
--- a/drm/1.0/default/LegacyPluginPath.cpp
+++ b/drm/1.0/default/LegacyPluginPath.cpp
@@ -16,6 +16,8 @@
#include "LegacyPluginPath.h"
+#include <unistd.h>
+
#include <cutils/properties.h>
namespace android {
@@ -24,12 +26,16 @@
namespace V1_0 {
namespace implementation {
+// 64-bit DRM depends on OEM libraries that aren't
+// provided for all devices. If the drm hal service
+// is running as 64-bit use the 64-bit libs, otherwise
+// use the 32-bit libs.
const char* getDrmPluginPath() {
- if (property_get_bool("drm.64bit.enabled", false)) {
- return "/vendor/lib64/mediadrm";
- } else {
- return "/vendor/lib/mediadrm";
- }
+#if defined(__LP64__)
+ return "/vendor/lib64/mediadrm";
+#else
+ return "/vendor/lib/mediadrm";
+#endif
}
} // namespace implementation
diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h
index f387b3c..0c45fb3 100644
--- a/drm/1.0/default/include/PluginLoader.h
+++ b/drm/1.0/default/include/PluginLoader.h
@@ -85,7 +85,10 @@
libraries.push(library);
T* result = createFactoryFunc();
return result;
- }
+ } else {
+ ALOGE("Failed to lookup symbol %s in library %s: %s",
+ entry, path, library->lastError());
+ }
}
return NULL;
}
diff --git a/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp b/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp
index 7c9e651..0f50577 100644
--- a/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp
+++ b/graphics/composer/2.1/utils/hwc2onfbadapter/HWC2OnFbAdapter.cpp
@@ -32,6 +32,8 @@
#include <log/log.h>
#include <sync/sync.h>
+using namespace HWC2;
+
namespace android {
namespace {
@@ -629,9 +631,10 @@
}
}
-void getCapabilitiesHook(hwc2_device_t* /*device*/, uint32_t* outCount,
- int32_t* /*outCapabilities*/) {
- *outCount = 0;
+void getCapabilitiesHook(hwc2_device_t* device, uint32_t* outCount,
+ int32_t* outCapabilities) {
+ auto& adapter = HWC2OnFbAdapter::cast(device);
+ adapter.getCapabilities(outCount, outCapabilities);
}
int closeHook(hw_device_t* device) {
@@ -656,6 +659,10 @@
mFbInfo.xdpi_scaled = int(mFbDevice->xdpi * 1000.0f);
mFbInfo.ydpi_scaled = int(mFbDevice->ydpi * 1000.0f);
+ // Present fences aren't supported, always indicate PresentFenceIsNotReliable
+ // for FB devices
+ mCapabilities.insert(Capability::PresentFenceIsNotReliable);
+
mVsyncThread.start(0, mFbInfo.vsync_period_ns);
}
@@ -791,6 +798,23 @@
mVsyncThread.enableCallback(enable);
}
+void HWC2OnFbAdapter::getCapabilities(uint32_t* outCount,
+ int32_t* outCapabilities) {
+ if (outCapabilities == nullptr) {
+ *outCount = mCapabilities.size();
+ return;
+ }
+
+ auto capabilityIter = mCapabilities.cbegin();
+ for (size_t written = 0; written < *outCount; ++written) {
+ if (capabilityIter == mCapabilities.cend()) {
+ return;
+ }
+ outCapabilities[written] = static_cast<int32_t>(*capabilityIter);
+ ++capabilityIter;
+ }
+}
+
int64_t HWC2OnFbAdapter::VsyncThread::now() {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
diff --git a/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h b/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h
index d6272fd..f1f11ef 100644
--- a/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h
+++ b/graphics/composer/2.1/utils/hwc2onfbadapter/include/hwc2onfbadapter/HWC2OnFbAdapter.h
@@ -23,7 +23,11 @@
#include <thread>
#include <unordered_set>
+#define HWC2_INCLUDE_STRINGIFICATION
+#define HWC2_USE_CPP11
#include <hardware/hwcomposer2.h>
+#undef HWC2_INCLUDE_STRINGIFICATION
+#undef HWC2_USE_CPP11
struct framebuffer_device_t;
@@ -75,6 +79,7 @@
void setVsyncCallback(HWC2_PFN_VSYNC callback, hwc2_callback_data_t data);
void enableVsync(bool enable);
+ void getCapabilities(uint32_t* outCount, int32_t* outCapabilities);
private:
framebuffer_device_t* mFbDevice{nullptr};
@@ -90,6 +95,8 @@
buffer_handle_t mBuffer{nullptr};
+ std::unordered_set<HWC2::Capability> mCapabilities;
+
class VsyncThread {
public:
static int64_t now();