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

Commit 82999cc3 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8237032 from 92ffa638 to tm-d1-release

Change-Id: I1c1d68c79fb82494f5a783bfaf315fcbb9433630
parents 8a5830d6 92ffa638
Loading
Loading
Loading
Loading
+44 −43
Original line number Diff line number Diff line
@@ -214,15 +214,16 @@ class GraphicsCompositionTestBase : public ::testing::Test {
        mWriter.reset();
    }

    std::pair<ScopedAStatus, bool> getHasReadbackBuffer() {
    bool getHasReadbackBuffer() {
        auto [status, readBackBufferAttributes] =
                mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId());
        if (status.isOk()) {
            mPixelFormat = readBackBufferAttributes.format;
            mDataspace = readBackBufferAttributes.dataspace;
            return {std::move(status), ReadbackHelper::readbackSupported(mPixelFormat, mDataspace)};
            return ReadbackHelper::readbackSupported(mPixelFormat, mDataspace);
        }
        return {std::move(status), false};
        EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
        return false;
    }

    std::shared_ptr<VtsComposerClient> mComposerClient;
@@ -264,8 +265,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -316,8 +317,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -376,8 +377,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -425,8 +426,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
}

TEST_P(GraphicsCompositionTest, SetReadbackBuffer) {
    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
    EXPECT_TRUE(readbackStatus.isOk());
    bool isSupported;
    ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
    if (!isSupported) {
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
@@ -439,8 +440,8 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer) {
}

TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) {
    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
    EXPECT_TRUE(readbackStatus.isOk());
    bool isSupported;
    ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
    if (!isSupported) {
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
@@ -461,8 +462,8 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) {
}

TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
    EXPECT_TRUE(readbackStatus.isOk());
    bool isSupported;
    ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
    if (!isSupported) {
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
@@ -478,8 +479,8 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
}

TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) {
    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
    EXPECT_TRUE(readbackStatus.isOk());
    bool isSupported;
    ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
    if (!isSupported) {
        GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
        return;
@@ -503,8 +504,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -594,8 +595,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -693,8 +694,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -768,8 +769,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -819,8 +820,8 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -878,8 +879,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -982,8 +983,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace for "
                               "color mode: "
@@ -1135,8 +1136,8 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -1179,8 +1180,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -1220,8 +1221,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -1303,8 +1304,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) {
            return;
        }

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -1348,8 +1349,8 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
@@ -1393,8 +1394,8 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) {
                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                            .isOk());

        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
        EXPECT_TRUE(readbackStatus.isOk());
        bool isSupported;
        ASSERT_NO_FATAL_FAILURE(isSupported = getHasReadbackBuffer());
        if (!isSupported) {
            GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
            return;
+27 −0
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@
#endif

#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android/api-level.h>

#include <android/hardware/media/omx/1.0/IOmx.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
@@ -371,6 +373,31 @@ TEST_P(StoreHidlTest, ListRoles) {
    }
}

static int getFirstApiLevel() {
    return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__);
}

// list components and roles.
TEST_P(StoreHidlTest, OmxCodecAllowedTest) {
    hidl_vec<IOmx::ComponentInfo> componentInfos = getComponentInfoList(omx);
    for (IOmx::ComponentInfo info : componentInfos) {
        for (std::string role : info.mRoles) {
            if (role.find("video_decoder") != std::string::npos ||
                role.find("video_encoder") != std::string::npos) {
                ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__)
                        << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
                        << " not allowed for devices launching with Android S and above";
            }
            if (role.find("audio_decoder") != std::string::npos ||
                role.find("audio_encoder") != std::string::npos) {
                ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__)
                        << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
                        << " not allowed for devices launching with Android T and above";
            }
        }
    }
}

// list components and roles.
TEST_P(StoreHidlTest, ListNodes) {
    description("enumerate component and roles");
+7 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <nnapi/Types.h>
#include <nnapi/Validation.h>

#include <type_traits>

namespace aidl::android::hardware::neuralnetworks::utils {

constexpr auto kDefaultPriority = Priority::MEDIUM;
@@ -80,6 +82,11 @@ auto convertFromNonCanonical(const Type& nonCanonicalObject)
    return convert(NN_TRY(nn::convert(nonCanonicalObject)));
}

template <typename Type>
constexpr std::underlying_type_t<Type> underlyingType(Type value) {
    return static_cast<std::underlying_type_t<Type>>(value);
}

nn::GeneralResult<Memory> clone(const Memory& memory);
nn::GeneralResult<Request> clone(const Request& request);
nn::GeneralResult<RequestMemoryPool> clone(const RequestMemoryPool& requestPool);
+2 −5
Original line number Diff line number Diff line
@@ -57,10 +57,6 @@
    while (UNLIKELY(value > std::numeric_limits<int32_t>::max())) return NN_ERROR()

namespace {
template <typename Type>
constexpr std::underlying_type_t<Type> underlyingType(Type value) {
    return static_cast<std::underlying_type_t<Type>>(value);
}

constexpr int64_t kNoTiming = -1;

@@ -70,6 +66,7 @@ namespace android::nn {
namespace {

using ::aidl::android::hardware::common::NativeHandle;
using ::aidl::android::hardware::neuralnetworks::utils::underlyingType;

template <typename Input>
using UnvalidatedConvertOutput =
@@ -404,7 +401,7 @@ GeneralResult<SharedMemory> unvalidatedConvert(const aidl_hal::Memory& memory) {
#endif  // __ANDROID__
        }
    }
    return NN_ERROR() << "Unrecognized Memory::Tag: " << memory.getTag();
    return NN_ERROR() << "Unrecognized Memory::Tag: " << underlyingType(memory.getTag());
}

GeneralResult<Timing> unvalidatedConvert(const aidl_hal::Timing& timing) {
+2 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ nn::GeneralResult<Memory> clone(const Memory& memory) {
            return Memory::make<Memory::Tag::hardwareBuffer>(std::move(handle));
        }
    }
    return (NN_ERROR() << "Unrecognized Memory::Tag: " << memory.getTag())
    return (NN_ERROR() << "Unrecognized Memory::Tag: " << underlyingType(memory.getTag()))
            .
            operator nn::GeneralResult<Memory>();
}
@@ -103,7 +103,7 @@ nn::GeneralResult<RequestMemoryPool> clone(const RequestMemoryPool& requestPool)
    }
    // Using explicit type conversion because std::variant inside the RequestMemoryPool confuses the
    // compiler.
    return (NN_ERROR() << "Unrecognized request pool tag: " << requestPool.getTag())
    return (NN_ERROR() << "Unrecognized request pool tag: " << underlyingType(requestPool.getTag()))
            .
            operator nn::GeneralResult<RequestMemoryPool>();
}
Loading