Loading cmds/dumpstate/dumpstate.cpp +62 −52 Original line number Diff line number Diff line Loading @@ -1237,7 +1237,6 @@ static void RunDumpsysNormal() { } static void DumpHals() { using android::sp; using android::hidl::manager::V1_0::IServiceManager; using android::hardware::defaultServiceManager; Loading Loading @@ -1582,15 +1581,10 @@ void Dumpstate::DumpstateBoard() { paths[i]))); } // Given that bugreport is required to diagnose failures, it's better to // drop the result of IDumpstateDevice than to block the rest of bugreport // for an arbitrary amount of time. std::packaged_task<std::unique_ptr<ssize_t[]>()> dumpstate_task([paths]() -> std::unique_ptr<ssize_t[]> { ::android::sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService()); sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService()); if (dumpstate_device == nullptr) { MYLOGE("No IDumpstateDevice implementation\n"); return nullptr; return; } using ScopedNativeHandle = Loading @@ -1602,7 +1596,7 @@ void Dumpstate::DumpstateBoard() { }); if (handle == nullptr) { MYLOGE("Could not create native_handle\n"); return nullptr; return; } for (size_t i = 0; i < paths.size(); i++) { Loading @@ -1613,16 +1607,44 @@ void Dumpstate::DumpstateBoard() { S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))); if (fd < 0) { MYLOGE("Could not open file %s: %s\n", paths[i].c_str(), strerror(errno)); return nullptr; return; } handle.get()->data[i] = fd.release(); } // Given that bugreport is required to diagnose failures, it's better to // set an arbitrary amount of timeout for IDumpstateDevice than to block the // rest of bugreport. In the timeout case, we will kill dumpstate board HAL // and grab whatever dumped std::packaged_task<bool()> dumpstate_task([paths, dumpstate_device, &handle]() -> bool { android::hardware::Return<void> status = dumpstate_device->dumpstateBoard(handle.get()); if (!status.isOk()) { MYLOGE("dumpstateBoard failed: %s\n", status.description().c_str()); return nullptr; return false; } return true; }); auto result = dumpstate_task.get_future(); std::thread(std::move(dumpstate_task)).detach(); constexpr size_t timeout_sec = 30; if (result.wait_for(std::chrono::seconds(timeout_sec)) != std::future_status::ready) { MYLOGE("dumpstateBoard timed out after %zus, killing dumpstate vendor HAL\n", timeout_sec); if (!android::base::SetProperty("ctl.interface_restart", android::base::StringPrintf("%s/default", IDumpstateDevice::descriptor))) { MYLOGE("Couldn't restart dumpstate HAL\n"); } } // Wait some time for init to kill dumpstate vendor HAL constexpr size_t killing_timeout_sec = 10; if (result.wait_for(std::chrono::seconds(killing_timeout_sec)) != std::future_status::ready) { MYLOGE("killing dumpstateBoard timed out after %zus, continue and " "there might be racing in content\n", killing_timeout_sec); } auto file_sizes = std::make_unique<ssize_t[]>(paths.size()); for (size_t i = 0; i < paths.size(); i++) { struct stat s; Loading @@ -1634,18 +1656,6 @@ void Dumpstate::DumpstateBoard() { } file_sizes[i] = s.st_size; } return file_sizes; }); auto result = dumpstate_task.get_future(); std::thread(std::move(dumpstate_task)).detach(); if (result.wait_for(30s) != std::future_status::ready) { MYLOGE("dumpstateBoard timed out after 30s\n"); return; } std::unique_ptr<ssize_t[]> file_sizes = result.get(); if (file_sizes == nullptr) { return; } for (size_t i = 0; i < paths.size(); i++) { if (file_sizes[i] == -1) { Loading opengl/libs/EGL/egl_display.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,12 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { if (len) { // NOTE: we could avoid the copy if we had strnstr. const std::string ext(start, len); // Temporary hack: Adreno 530 driver exposes this extension under the draft // KHR name, but during Khronos review it was decided to demote it to EXT. if (ext == "EGL_EXT_image_gl_colorspace" && findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) { mExtensionString.append("EGL_EXT_image_gl_colorspace "); } if (findExtension(disp.queryString.extensions, ext.c_str(), len)) { mExtensionString.append(ext + " "); } Loading services/surfaceflinger/BufferLayer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -650,7 +650,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = hwcLayer->setHdrMetadata(metadata); error = hwcLayer->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); Loading services/surfaceflinger/DisplayDevice.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ DisplayDevice::DisplayDevice( int displayHeight, bool hasWideColorGamut, const HdrCapabilities& hdrCapabilities, const int32_t supportedPerFrameMetadata, int initialPowerMode) : lastCompositionHadVisibleLayers(false), mFlinger(flinger), Loading @@ -103,7 +104,8 @@ DisplayDevice::DisplayDevice( mHasWideColorGamut(hasWideColorGamut), mHasHdr10(false), mHasHLG(false), mHasDolbyVision(false) mHasDolbyVision(false), mSupportedPerFrameMetadata(supportedPerFrameMetadata) { // clang-format on for (Hdr hdrType : hdrCapabilities.getSupportedHdrTypes()) { Loading services/surfaceflinger/DisplayDevice.h +9 −5 Original line number Diff line number Diff line Loading @@ -23,17 +23,16 @@ #include <math/mat4.h> #include <ui/Region.h> #include <binder/IBinder.h> #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include <ui/Region.h> #include <utils/RefBase.h> #include <utils/Mutex.h> #include <utils/String8.h> #include <utils/Timers.h> #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include "RenderArea.h" #include "RenderEngine/Surface.h" Loading Loading @@ -86,6 +85,7 @@ public: int displayHeight, bool hasWideColorGamut, const HdrCapabilities& hdrCapabilities, const int32_t supportedPerFrameMetadata, int initialPowerMode); // clang-format on Loading Loading @@ -131,6 +131,8 @@ public: int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp<IBinder>& getDisplayToken() const { return mDisplayToken; } int32_t getSupportedPerFrameMetadata() const { return mSupportedPerFrameMetadata; } // We pass in mustRecompose so we can keep VirtualDisplaySurface's state // machine happy without actually queueing a buffer if nothing has changed status_t beginFrame(bool mustRecompose) const; Loading Loading @@ -259,6 +261,8 @@ private: bool mHasHdr10; bool mHasHLG; bool mHasDolbyVision; const int32_t mSupportedPerFrameMetadata; }; struct DisplayDeviceState { Loading Loading
cmds/dumpstate/dumpstate.cpp +62 −52 Original line number Diff line number Diff line Loading @@ -1237,7 +1237,6 @@ static void RunDumpsysNormal() { } static void DumpHals() { using android::sp; using android::hidl::manager::V1_0::IServiceManager; using android::hardware::defaultServiceManager; Loading Loading @@ -1582,15 +1581,10 @@ void Dumpstate::DumpstateBoard() { paths[i]))); } // Given that bugreport is required to diagnose failures, it's better to // drop the result of IDumpstateDevice than to block the rest of bugreport // for an arbitrary amount of time. std::packaged_task<std::unique_ptr<ssize_t[]>()> dumpstate_task([paths]() -> std::unique_ptr<ssize_t[]> { ::android::sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService()); sp<IDumpstateDevice> dumpstate_device(IDumpstateDevice::getService()); if (dumpstate_device == nullptr) { MYLOGE("No IDumpstateDevice implementation\n"); return nullptr; return; } using ScopedNativeHandle = Loading @@ -1602,7 +1596,7 @@ void Dumpstate::DumpstateBoard() { }); if (handle == nullptr) { MYLOGE("Could not create native_handle\n"); return nullptr; return; } for (size_t i = 0; i < paths.size(); i++) { Loading @@ -1613,16 +1607,44 @@ void Dumpstate::DumpstateBoard() { S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))); if (fd < 0) { MYLOGE("Could not open file %s: %s\n", paths[i].c_str(), strerror(errno)); return nullptr; return; } handle.get()->data[i] = fd.release(); } // Given that bugreport is required to diagnose failures, it's better to // set an arbitrary amount of timeout for IDumpstateDevice than to block the // rest of bugreport. In the timeout case, we will kill dumpstate board HAL // and grab whatever dumped std::packaged_task<bool()> dumpstate_task([paths, dumpstate_device, &handle]() -> bool { android::hardware::Return<void> status = dumpstate_device->dumpstateBoard(handle.get()); if (!status.isOk()) { MYLOGE("dumpstateBoard failed: %s\n", status.description().c_str()); return nullptr; return false; } return true; }); auto result = dumpstate_task.get_future(); std::thread(std::move(dumpstate_task)).detach(); constexpr size_t timeout_sec = 30; if (result.wait_for(std::chrono::seconds(timeout_sec)) != std::future_status::ready) { MYLOGE("dumpstateBoard timed out after %zus, killing dumpstate vendor HAL\n", timeout_sec); if (!android::base::SetProperty("ctl.interface_restart", android::base::StringPrintf("%s/default", IDumpstateDevice::descriptor))) { MYLOGE("Couldn't restart dumpstate HAL\n"); } } // Wait some time for init to kill dumpstate vendor HAL constexpr size_t killing_timeout_sec = 10; if (result.wait_for(std::chrono::seconds(killing_timeout_sec)) != std::future_status::ready) { MYLOGE("killing dumpstateBoard timed out after %zus, continue and " "there might be racing in content\n", killing_timeout_sec); } auto file_sizes = std::make_unique<ssize_t[]>(paths.size()); for (size_t i = 0; i < paths.size(); i++) { struct stat s; Loading @@ -1634,18 +1656,6 @@ void Dumpstate::DumpstateBoard() { } file_sizes[i] = s.st_size; } return file_sizes; }); auto result = dumpstate_task.get_future(); std::thread(std::move(dumpstate_task)).detach(); if (result.wait_for(30s) != std::future_status::ready) { MYLOGE("dumpstateBoard timed out after 30s\n"); return; } std::unique_ptr<ssize_t[]> file_sizes = result.get(); if (file_sizes == nullptr) { return; } for (size_t i = 0; i < paths.size(); i++) { if (file_sizes[i] == -1) { Loading
opengl/libs/EGL/egl_display.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,12 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { if (len) { // NOTE: we could avoid the copy if we had strnstr. const std::string ext(start, len); // Temporary hack: Adreno 530 driver exposes this extension under the draft // KHR name, but during Khronos review it was decided to demote it to EXT. if (ext == "EGL_EXT_image_gl_colorspace" && findExtension(disp.queryString.extensions, "EGL_KHR_image_gl_colorspace")) { mExtensionString.append("EGL_EXT_image_gl_colorspace "); } if (findExtension(disp.queryString.extensions, ext.c_str(), len)) { mExtensionString.append(ext + " "); } Loading
services/surfaceflinger/BufferLayer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -650,7 +650,7 @@ void BufferLayer::setPerFrameData(const sp<const DisplayDevice>& displayDevice) } const HdrMetadata& metadata = mConsumer->getCurrentHdrMetadata(); error = hwcLayer->setHdrMetadata(metadata); error = hwcLayer->setPerFrameMetadata(displayDevice->getSupportedPerFrameMetadata(), metadata); if (error != HWC2::Error::None && error != HWC2::Error::Unsupported) { ALOGE("[%s] Failed to set hdrMetadata: %s (%d)", mName.string(), to_string(error).c_str(), static_cast<int32_t>(error)); Loading
services/surfaceflinger/DisplayDevice.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ DisplayDevice::DisplayDevice( int displayHeight, bool hasWideColorGamut, const HdrCapabilities& hdrCapabilities, const int32_t supportedPerFrameMetadata, int initialPowerMode) : lastCompositionHadVisibleLayers(false), mFlinger(flinger), Loading @@ -103,7 +104,8 @@ DisplayDevice::DisplayDevice( mHasWideColorGamut(hasWideColorGamut), mHasHdr10(false), mHasHLG(false), mHasDolbyVision(false) mHasDolbyVision(false), mSupportedPerFrameMetadata(supportedPerFrameMetadata) { // clang-format on for (Hdr hdrType : hdrCapabilities.getSupportedHdrTypes()) { Loading
services/surfaceflinger/DisplayDevice.h +9 −5 Original line number Diff line number Diff line Loading @@ -23,17 +23,16 @@ #include <math/mat4.h> #include <ui/Region.h> #include <binder/IBinder.h> #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include <ui/Region.h> #include <utils/RefBase.h> #include <utils/Mutex.h> #include <utils/String8.h> #include <utils/Timers.h> #include <gui/ISurfaceComposer.h> #include <hardware/hwcomposer_defs.h> #include <ui/GraphicTypes.h> #include "RenderArea.h" #include "RenderEngine/Surface.h" Loading Loading @@ -86,6 +85,7 @@ public: int displayHeight, bool hasWideColorGamut, const HdrCapabilities& hdrCapabilities, const int32_t supportedPerFrameMetadata, int initialPowerMode); // clang-format on Loading Loading @@ -131,6 +131,8 @@ public: int32_t getHwcDisplayId() const { return mHwcDisplayId; } const wp<IBinder>& getDisplayToken() const { return mDisplayToken; } int32_t getSupportedPerFrameMetadata() const { return mSupportedPerFrameMetadata; } // We pass in mustRecompose so we can keep VirtualDisplaySurface's state // machine happy without actually queueing a buffer if nothing has changed status_t beginFrame(bool mustRecompose) const; Loading Loading @@ -259,6 +261,8 @@ private: bool mHasHdr10; bool mHasHLG; bool mHasDolbyVision; const int32_t mSupportedPerFrameMetadata; }; struct DisplayDeviceState { Loading