Merge "Attach profiles to bug reports" into nyc-mr1-dev
diff --git a/include/ui/Gralloc1On0Adapter.h b/include/ui/Gralloc1On0Adapter.h
index edcfb65..97c9a89 100644
--- a/include/ui/Gralloc1On0Adapter.h
+++ b/include/ui/Gralloc1On0Adapter.h
@@ -22,6 +22,7 @@
#include <hardware/gralloc1.h>
+#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>
@@ -468,8 +469,10 @@
std::shared_ptr<Buffer> getBuffer(buffer_handle_t bufferHandle);
static std::atomic<gralloc1_buffer_descriptor_t> sNextBufferDescriptorId;
+ std::mutex mDescriptorMutex;
std::unordered_map<gralloc1_buffer_descriptor_t,
std::shared_ptr<Descriptor>> mDescriptors;
+ std::mutex mBufferMutex;
std::unordered_map<buffer_handle_t, std::shared_ptr<Buffer>> mBuffers;
};
diff --git a/libs/ui/Gralloc1On0Adapter.cpp b/libs/ui/Gralloc1On0Adapter.cpp
index 6e69df1..d5b88de 100644
--- a/libs/ui/Gralloc1On0Adapter.cpp
+++ b/libs/ui/Gralloc1On0Adapter.cpp
@@ -193,6 +193,7 @@
gralloc1_buffer_descriptor_t* outDescriptor)
{
auto descriptorId = sNextBufferDescriptorId++;
+ std::lock_guard<std::mutex> lock(mDescriptorMutex);
mDescriptors.emplace(descriptorId,
std::make_shared<Descriptor>(this, descriptorId));
@@ -207,6 +208,7 @@
{
ALOGV("Destroying descriptor %" PRIu64, descriptor);
+ std::lock_guard<std::mutex> lock(mDescriptorMutex);
if (mDescriptors.count(descriptor) == 0) {
return GRALLOC1_ERROR_BAD_DESCRIPTOR;
}
@@ -255,6 +257,8 @@
*outBufferHandle = handle;
auto buffer = std::make_shared<Buffer>(handle, store, *descriptor, stride,
true);
+
+ std::lock_guard<std::mutex> lock(mBufferMutex);
mBuffers.emplace(handle, std::move(buffer));
return GRALLOC1_ERROR_NONE;
@@ -309,6 +313,8 @@
ALOGE("gralloc0 unregister failed: %d", result);
}
}
+
+ std::lock_guard<std::mutex> lock(mBufferMutex);
mBuffers.erase(handle);
return GRALLOC1_ERROR_NONE;
}
@@ -320,6 +326,7 @@
graphicBuffer->getNativeBuffer()->handle, graphicBuffer->getId());
buffer_handle_t handle = graphicBuffer->getNativeBuffer()->handle;
+ std::lock_guard<std::mutex> lock(mBufferMutex);
if (mBuffers.count(handle) != 0) {
mBuffers[handle]->retain();
return GRALLOC1_ERROR_NONE;
@@ -446,6 +453,7 @@
std::shared_ptr<Gralloc1On0Adapter::Descriptor>
Gralloc1On0Adapter::getDescriptor(gralloc1_buffer_descriptor_t descriptorId)
{
+ std::lock_guard<std::mutex> lock(mDescriptorMutex);
if (mDescriptors.count(descriptorId) == 0) {
return nullptr;
}
@@ -456,6 +464,7 @@
std::shared_ptr<Gralloc1On0Adapter::Buffer> Gralloc1On0Adapter::getBuffer(
buffer_handle_t bufferHandle)
{
+ std::lock_guard<std::mutex> lock(mBufferMutex);
if (mBuffers.count(bufferHandle) == 0) {
return nullptr;
}
diff --git a/services/sensorservice/SensorList.cpp b/services/sensorservice/SensorList.cpp
index f6d3d94..e0101c1 100644
--- a/services/sensorservice/SensorList.cpp
+++ b/services/sensorservice/SensorList.cpp
@@ -178,14 +178,7 @@
if (s.hasAdditionalInfo()) {
result.appendFormat("has-additional-info, ");
}
- result.append("| ");
- if (s.isDynamicSensor()) {
- result.append("uuid: ");
- for (uint8_t i : s.getUuid().b) {
- result.appendFormat("%02x", i);
- }
- }
result.append("\n");
return true;
});
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index d654b17..2a8fa4a 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -45,8 +45,7 @@
LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
-USE_HWC2 := false
-ifeq ($(USE_HWC2),true)
+ifeq ($(TARGET_USES_HWC2),true)
LOCAL_CFLAGS += -DUSE_HWC2
LOCAL_SRC_FILES += \
SurfaceFlinger.cpp \
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index d732c07..6c78000 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -726,11 +726,6 @@
// setup a solid color layer yet
ALOGV("[%s] Requesting Client composition", mName.string());
setCompositionType(hwcId, HWC2::Composition::Client);
- error = hwcLayer->setBuffer(nullptr, Fence::NO_FENCE);
- if (error != HWC2::Error::None) {
- ALOGE("[%s] Failed to set null buffer: %s (%d)", mName.string(),
- to_string(error).c_str(), static_cast<int32_t>(error));
- }
return;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9f357df..fa61a9b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1005,7 +1005,12 @@
}
for (size_t displayId = 0; displayId < mDisplays.size(); ++displayId) {
- status_t result = mDisplays[displayId]->prepareFrame(*mHwc);
+ auto& displayDevice = mDisplays[displayId];
+ if (!displayDevice->isDisplayOn()) {
+ continue;
+ }
+
+ status_t result = displayDevice->prepareFrame(*mHwc);
ALOGE_IF(result != NO_ERROR, "prepareFrame for display %zd failed:"
" %d (%s)", displayId, result, strerror(-result));
}
@@ -1229,7 +1234,12 @@
}
for (size_t displayId = 0; displayId < mDisplays.size(); ++displayId) {
- status_t result = mDisplays[displayId]->prepareFrame(*mHwc);
+ auto& displayDevice = mDisplays[displayId];
+ if (!displayDevice->isDisplayOn()) {
+ continue;
+ }
+
+ status_t result = displayDevice->prepareFrame(*mHwc);
ALOGE_IF(result != NO_ERROR, "prepareFrame for display %zd failed:"
" %d (%s)", displayId, result, strerror(-result));
}
@@ -1267,6 +1277,9 @@
for (size_t displayId = 0; displayId < mDisplays.size(); ++displayId) {
auto& displayDevice = mDisplays[displayId];
+ if (!displayDevice->isDisplayOn()) {
+ continue;
+ }
const auto hwcId = displayDevice->getHwcDisplayId();
if (hwcId >= 0) {
mHwc->commit(hwcId);