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

Commit 628d6f93 authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge "Migrate reader writer based tests for HAL 2.4"

parents 31a70ce8 3335f7a4
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -32,11 +32,27 @@ cc_test {
    srcs: [
        "VtsHalGraphicsComposer3_TargetTest.cpp",
        "composer-vts/GraphicsComposerCallback.cpp",
        "composer-vts/TestCommandReader.cpp",
    ],

    shared_libs: [
        "libbinder_ndk",
        "libbinder",
        "libfmq",
        "libbase",
        "libsync",
        "libui",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.graphics.mapper@3.0",
        "android.hardware.graphics.mapper@4.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@3.0",
        "android.hardware.graphics.allocator@4.0",
        "libvndksupport",
    ],
    header_libs: [
        "android.hardware.graphics.composer3-command-buffer",
    ],
    static_libs: [
        "android.hardware.graphics.composer3-V1-ndk",
@@ -44,9 +60,19 @@ cc_test {
        "android.hardware.graphics.common@1.2",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@3.0",
        "android.hardware.graphics.allocator@4.0",
        "android.hardware.graphics.composer@3-vts",
        "android.hardware.graphics.mapper@2.0-vts",
        "android.hardware.graphics.mapper@2.1-vts",
        "android.hardware.graphics.mapper@3.0-vts",
        "android.hardware.graphics.mapper@4.0-vts",
        "libaidlcommonsupport",
    ],
    cflags: [
        "-Wconversion",
    ],

    test_suites: [
        "general-tests",
        "vts",
+424 −18

File changed.

Preview size limit exceeded, changes collapsed.

+21 −0
Original line number Diff line number Diff line
@@ -28,17 +28,38 @@ cc_library_static {
    defaults: ["hidl_defaults"],
    srcs: [
        "GraphicsComposerCallback.cpp",
        "TestCommandReader.cpp",
    ],
    header_libs: [
        "android.hardware.graphics.composer3-command-buffer",
    ],
    static_libs: [
        "android.hardware.graphics.composer3-V1-ndk",
        "android.hardware.graphics.common-V3-ndk",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "libgtest",
        "libbase",
        "libfmq",
        "libsync",
        "libaidlcommonsupport",
        "android.hardware.graphics.mapper@2.0-vts",
        "android.hardware.graphics.mapper@3.0-vts",
        "android.hardware.graphics.mapper@4.0-vts",
    ],
    shared_libs: [
        "libbinder_ndk",
        "libhidlbase",
        "android.hardware.graphics.composer3-V1-ndk",
    ],
    cflags: [
        "-O0",
        "-g",
        "-DLOG_TAG=\"ComposerVts\"",
        "-Wconversion",
    ],
    export_header_lib_headers: [
        "android.hardware.graphics.composer3-command-buffer",
    ],
    export_include_dirs: ["include"],
}
+92 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2021, 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.
 */

#include "include/TestCommandReader.h"
#include <gtest/gtest.h>

namespace aidl::android::hardware::graphics::composer3::vts {

void TestCommandReader::parse() {
    mErrors.clear();
    mCompositionChanges.clear();
    while (!isEmpty()) {
        int32_t command;
        uint16_t length;
        ASSERT_TRUE(beginCommand(&command, &length));

        parseSingleCommand(command, length);

        endCommand();
    }
}

void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length) {
    auto command = static_cast<Command>(commandRaw);

    switch (command) {
        case Command::SET_CLIENT_TARGET_PROPERTY:
            ASSERT_EQ(2, length);
            read();
            close(readFence());
            break;
        case Command::SELECT_DISPLAY:
            ASSERT_EQ(2, length);
            read64();  // display
            break;
        case Command::SET_ERROR: {
            ASSERT_EQ(2, length);
            auto loc = read();
            auto err = readSigned();
            std::pair<uint32_t, uint32_t> error(loc, err);
            mErrors.push_back(error);
        } break;
        case Command::SET_CHANGED_COMPOSITION_TYPES:
            ASSERT_EQ(0, length % 3);
            for (uint16_t count = 0; count < length / 3; ++count) {
                uint64_t layerId = read64();
                uint32_t composition = read();

                std::pair<uint64_t, uint32_t> compositionChange(layerId, composition);
                mCompositionChanges.push_back(compositionChange);
            }
            break;
        case Command::SET_DISPLAY_REQUESTS:
            ASSERT_EQ(1, length % 3);
            read();  // displayRequests, ignored for now
            for (uint16_t count = 0; count < (length - 1) / 3; ++count) {
                read64();  // layer
                // silently eat requests to clear the client target, since we won't be testing
                // client composition anyway
                ASSERT_EQ(1u, read());
            }
            break;
        case Command::SET_PRESENT_FENCE:
            ASSERT_EQ(1, length);
            close(readFence());
            break;
        case Command::SET_RELEASE_FENCES:
            ASSERT_EQ(0, length % 3);
            for (uint16_t count = 0; count < length / 3; ++count) {
                read64();
                close(readFence());
            }
            break;
        default:
            GTEST_FAIL() << "unexpected return command " << std::hex << static_cast<int>(command);
            break;
    }
}
}  // namespace aidl::android::hardware::graphics::composer3::vts
 No newline at end of file
+7 −1
Original line number Diff line number Diff line
@@ -15,12 +15,18 @@
 */
#pragma once

#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>
#include <android-base/thread_annotations.h>
#include <mutex>
#include <unordered_set>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop  // ignored "-Wconversion

namespace aidl::android::hardware::graphics::composer3::vts {

// IComposerCallback to be installed with IComposerClient::registerCallback.
Loading