Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1f805f8 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4739962 from e43650d2 to pi-release

Change-Id: I8fdd552e794384f67346d669ba52ee6df0eddb9f
parents d8ccab53 e43650d2
Loading
Loading
Loading
Loading
+62 −52
Original line number Diff line number Diff line
@@ -1237,7 +1237,6 @@ static void RunDumpsysNormal() {
}

static void DumpHals() {
    using android::sp;
    using android::hidl::manager::V1_0::IServiceManager;
    using android::hardware::defaultServiceManager;

@@ -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 =
@@ -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++) {
@@ -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;
@@ -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) {
+6 −0
Original line number Diff line number Diff line
@@ -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 + " ");
                }
+1 −1
Original line number Diff line number Diff line
@@ -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));
+3 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ DisplayDevice::DisplayDevice(
        int displayHeight,
        bool hasWideColorGamut,
        const HdrCapabilities& hdrCapabilities,
        const int32_t supportedPerFrameMetadata,
        int initialPowerMode)
    : lastCompositionHadVisibleLayers(false),
      mFlinger(flinger),
@@ -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()) {
+9 −5
Original line number Diff line number Diff line
@@ -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"

@@ -86,6 +85,7 @@ public:
            int displayHeight,
            bool hasWideColorGamut,
            const HdrCapabilities& hdrCapabilities,
            const int32_t supportedPerFrameMetadata,
            int initialPowerMode);
    // clang-format on

@@ -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;
@@ -259,6 +261,8 @@ private:
    bool mHasHdr10;
    bool mHasHLG;
    bool mHasDolbyVision;

    const int32_t mSupportedPerFrameMetadata;
};

struct DisplayDeviceState {
Loading