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

Commit 9563037a authored by Mark Yacoub's avatar Mark Yacoub
Browse files

VTS: Create libhwc_aidl_test out of HWC VTS

[Why]
VTS tests targeting HWC depend on wrapper and helpers that are very
well done and beneficial to other tests outside of VTS that are also
targeting HWC.
Instead of rewriting all these helpers in a new effort to test HWC using
Cuttlefish, a common library for HWC AIDL tests would be beneficial.

[How]
Take out all the helpers out of the VTS directory and create a new
libhwc_aidl_test directory that other tests can reference.
Also, remove any mention of VTS out of them because they're not longer
directly related to VTS.

Merge Difference:
Teardown API has been updated based on ag/31493518 to standarize the API
between aosp and ag and avoid potential conflicts between
libhwc_aidl_test clients.

Bug: b/384710755   , b/383783834
Test: atest VtsHalGraphicsComposer3_TargetTest
Flag: TEST_ONLY
Merged-In: Icaff0c50186d7b016e1d1822e084bf12001fe5be
Change-Id: Ice9f4df5499f4d7869a17d370367cac1c18898a7
parent 1a086472
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2025, 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.
 */

package {
    default_team: "trendy_team_android_core_graphics_stack",
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    // SPDX-license-identifier-Apache-2.0
}

cc_library_static {
    name: "libhwc_aidl_test",
    export_include_dirs: ["include"],
    defaults: [
        "use_libaidlvintf_gtest_helper_static",
        "librenderengine_deps",
        "android.hardware.graphics.common-ndk_static",
        "android.hardware.graphics.composer3-ndk_static",
    ],
    srcs: [
        "ComposerClientWrapper.cpp",
        "GraphicsComposerCallback.cpp",
        "Readback.cpp",
        "RenderEngine.cpp",
    ],
    shared_libs: [
        "libEGL",
        "libGLESv2",
        "libbinder_ndk",
        "libbinder",
        "libfmq",
        "libbase",
        "libsync",
        "libui",
        "libgui",
    ],
    header_libs: [
        "android.hardware.graphics.composer3-command-buffer",
    ],
    static_libs: [
        "android.hardware.graphics.common@1.2",
        "android.hardware.common-V2-ndk",
        "android.hardware.common.fmq-V1-ndk",
        "libaidlcommonsupport",
        "libarect",
        "libbase",
        "libfmq",
        "libgtest",
        "librenderengine",
        "libsync",
        "libsurfaceflinger_common",
    ],
    cflags: [
        "-Wconversion",
    ],
}
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#undef LOG_TAG
#define LOG_TAG "GraphicsComposerCallback"

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

void GraphicsComposerCallback::setVsyncAllowed(bool allowed) {
    std::scoped_lock lock(mMutex);
@@ -219,4 +219,4 @@ int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount
    return ::ndk::ScopedAStatus::ok();
}

}  // namespace aidl::android::hardware::graphics::composer3::vts
}  // namespace aidl::android::hardware::graphics::composer3::libhwc_aidl_test
+8 −9
Original line number Diff line number Diff line
@@ -14,14 +14,12 @@
 * limitations under the License.
 */

#include "ReadbackVts.h"
#include "Readback.h"
#include <aidl/android/hardware/graphics/common/BufferUsage.h>
#include <cmath>
#include "RenderEngineVts.h"
#include "renderengine/ExternalTexture.h"
#include "RenderEngine.h"
#include "renderengine/impl/ExternalTexture.h"

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

const std::vector<ColorMode> ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3};
const std::vector<Dataspace> ReadbackHelper::dataspaces = {common::Dataspace::SRGB,
@@ -320,8 +318,9 @@ void ReadbackHelper::compareColorBuffers(void* expectedBuffer, void* actualBuffe
    }
}

ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr<VtsComposerClient>& client,
                               int32_t width, int32_t height, common::PixelFormat pixelFormat,
ReadbackBuffer::ReadbackBuffer(int64_t display,
                               const std::shared_ptr<ComposerClientWrapper>& client, int32_t width,
                               int32_t height, common::PixelFormat pixelFormat,
                               common::Dataspace dataspace)
    : mComposerClient(client) {
    mDisplay = display;
@@ -403,7 +402,7 @@ LayerSettings TestColorLayer::toRenderEngineLayerSettings() {
    return layerSettings;
}

TestBufferLayer::TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client,
TestBufferLayer::TestBufferLayer(const std::shared_ptr<ComposerClientWrapper>& client,
                                 TestRenderEngine& renderEngine, int64_t display, uint32_t width,
                                 uint32_t height, common::PixelFormat format,
                                 ComposerClientWriter& writer, Composition composition)
@@ -489,4 +488,4 @@ void TestBufferLayer::setToClientComposition(ComposerClientWriter& writer) {
    writer.setLayerCompositionType(mDisplay, mLayer, Composition::CLIENT);
}

}  // namespace aidl::android::hardware::graphics::composer3::vts
}  // namespace aidl::android::hardware::graphics::composer3::libhwc_aidl_test
+3 −3
Original line number Diff line number Diff line
@@ -14,10 +14,10 @@
 * limitations under the License.
 */

#include "RenderEngineVts.h"
#include "RenderEngine.h"
#include "renderengine/impl/ExternalTexture.h"

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

using ::android::renderengine::DisplaySettings;
using ::android::renderengine::LayerSettings;
@@ -115,4 +115,4 @@ void TestRenderEngine::checkColorBuffer(const ::android::sp<::android::GraphicBu
    ASSERT_EQ(::android::OK, mGraphicBuffer->unlock());
}

}  // namespace aidl::android::hardware::graphics::composer3::vts
}  // namespace aidl::android::hardware::graphics::composer3::libhwc_aidl_test
Loading