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

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

Snap for 6291259 from 48dc9323 to rvc-release

Change-Id: I817658557425fdfacb27ac16d395382f8bf10e77
parents a1d6f69e 48dc9323
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <memory>
#include <utility>

namespace android {

namespace aidl {

// nullable/make_nullable provide source-level compatibility between std::opional and std::unique_ptr
// usage:
//     nullable<Foo> a;
//     nullable<Foo> b = make_nullable<Foo>(...);
//     auto c = make_nullable<Foo>(...);
//     c.reset();
//     c = make_nullable<Foo>(...);
//     c = std::move(a);

template <typename T>
using nullable = std::unique_ptr<T>;

template <typename T, typename... Args>
inline nullable<T> make_nullable(Args&&... args) {
    return std::make_unique<T>(std::forward<Args>(args)...);
}

} // namespace aidl

} // namespace android
 No newline at end of file
+0 −2
Original line number Diff line number Diff line
@@ -346,8 +346,6 @@ status_t BufferQueueLayer::updateActiveBuffer() {
    mPreviousBufferId = getCurrentBufferId();
    mBufferInfo.mBuffer =
            mConsumer->getCurrentBuffer(&mBufferInfo.mBufferSlot, &mBufferInfo.mFence);
    auto* layerCompositionState = editCompositionState();
    layerCompositionState->buffer = mBufferInfo.mBuffer;

    if (mBufferInfo.mBuffer == nullptr) {
        // this can only happen if the very first buffer was rejected.
+0 −1
Original line number Diff line number Diff line
@@ -616,7 +616,6 @@ status_t BufferStateLayer::updateActiveBuffer() {
    mPreviousBufferId = getCurrentBufferId();
    mBufferInfo.mBuffer = s.buffer;
    mBufferInfo.mFence = s.acquireFence;
    editCompositionState()->buffer = mBufferInfo.mBuffer;

    return NO_ERROR;
}
+17 −13
Original line number Diff line number Diff line
@@ -104,9 +104,8 @@ uint16_t DisplayId::manufacturerId() const {
    return static_cast<uint16_t>(value >> 40);
}

DisplayId DisplayId::fromEdid(uint8_t port, uint16_t manufacturerId, uint32_t displayNameHash) {
    return {(static_cast<Type>(manufacturerId) << 40) | (static_cast<Type>(displayNameHash) << 8) |
            port};
DisplayId DisplayId::fromEdid(uint8_t port, uint16_t manufacturerId, uint32_t modelHash) {
    return {(static_cast<Type>(manufacturerId) << 40) | (static_cast<Type>(modelHash) << 8) | port};
}

bool isEdid(const DisplayIdentificationData& data) {
@@ -209,23 +208,30 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
        view.remove_prefix(kDescriptorLength);
    }

    if (displayName.empty()) {
    std::string_view modelString = displayName;

    if (modelString.empty()) {
        ALOGW("Invalid EDID: falling back to serial number due to missing display name.");
        displayName = serialNumber;
        modelString = serialNumber;
    }
    if (displayName.empty()) {
    if (modelString.empty()) {
        ALOGW("Invalid EDID: falling back to ASCII text due to missing serial number.");
        displayName = asciiText;
        modelString = asciiText;
    }
    if (displayName.empty()) {
    if (modelString.empty()) {
        ALOGE("Invalid EDID: display name and fallback descriptors are missing.");
        return {};
    }

    // Hash model string instead of using product code or (integer) serial number, since the latter
    // have been observed to change on some displays with multiple inputs.
    const auto modelHash = static_cast<uint32_t>(std::hash<std::string_view>()(modelString));

    return Edid{.manufacturerId = manufacturerId,
                .productId = productId,
                .pnpId = *pnpId,
                .modelHash = modelHash,
                .displayName = displayName,
                .productId = productId,
                .manufactureWeek = manufactureWeek,
                .manufactureOrModelYear = manufactureOrModelYear};
}
@@ -253,10 +259,8 @@ std::optional<DisplayIdentificationInfo> parseDisplayIdentificationData(
        return {};
    }

    // Hash display name instead of using product code or serial number, since the latter have been
    // observed to change on some displays with multiple inputs.
    const auto hash = static_cast<uint32_t>(std::hash<std::string_view>()(edid->displayName));
    return DisplayIdentificationInfo{.id = DisplayId::fromEdid(port, edid->manufacturerId, hash),
    const auto displayId = DisplayId::fromEdid(port, edid->manufacturerId, edid->modelHash);
    return DisplayIdentificationInfo{.id = displayId,
                                     .name = std::string(edid->displayName),
                                     .deviceProductInfo = buildDeviceProductInfo(*edid)};
}
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ struct DisplayId {

    uint16_t manufacturerId() const;

    static DisplayId fromEdid(uint8_t port, uint16_t manufacturerId, uint32_t displayNameHash);
    static DisplayId fromEdid(uint8_t port, uint16_t manufacturerId, uint32_t modelHash);
};

inline bool operator==(DisplayId lhs, DisplayId rhs) {
@@ -61,6 +61,7 @@ struct Edid {
    uint16_t manufacturerId;
    uint16_t productId;
    PnpId pnpId;
    uint32_t modelHash;
    std::string_view displayName;
    uint8_t manufactureOrModelYear;
    uint8_t manufactureWeek;
Loading