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

Commit 75869729 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove unmaintained tests."

parents b71f06ca e62b7c24
Loading
Loading
Loading
Loading
+0 −53
Original line number Diff line number Diff line
// Copyright (C) 2018 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.

cc_test {
    name: "test-hwc2",
    defaults: ["surfaceflinger_defaults"],
    cflags: [
        "-DEGL_EGLEXT_PROTOTYPES",
        "-DGL_GLEXT_PROTOTYPES",
        "-fno-builtin",
        "-fstack-protector-all",
        "-g",
        "-Wextra",
    ],
    srcs: [
        "Hwc2Test.cpp",
        "Hwc2TestProperties.cpp",
        "Hwc2TestLayer.cpp",
        "Hwc2TestLayers.cpp",
        "Hwc2TestBuffer.cpp",
        "Hwc2TestClientTarget.cpp",
        "Hwc2TestVirtualDisplay.cpp",
        "Hwc2TestPixelComparator.cpp",
    ],
    static_libs: [
        "libbase",
        "libmath",
    ],
    shared_libs: [
        "android.hardware.graphics.common@1.1",
        "libcutils",
        "libEGL",
        "libGLESv2",
        "libgui",
        "libhardware",
        "libjnigraphics",
        "liblog",
        "libsync",
        "libui",
        "libutils",
    ],
}
+0 −4779

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −813

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −108
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.
 */

#ifndef _HWC2_TEST_BUFFER_H
#define _HWC2_TEST_BUFFER_H

#include <android-base/unique_fd.h>
#include <set>

#include <hardware/hwcomposer2.h>

#include <ui/GraphicBuffer.h>

#include "Hwc2TestProperties.h"

class Hwc2TestFenceGenerator;
class Hwc2TestLayers;

class Hwc2TestBuffer {
public:
    Hwc2TestBuffer();
    ~Hwc2TestBuffer();

    void updateBufferArea(const Area& bufferArea);

    int  get(buffer_handle_t* outHandle, int32_t* outFence);

protected:
    int generateBuffer();

    android::sp<android::GraphicBuffer> mGraphicBuffer;

    std::unique_ptr<Hwc2TestFenceGenerator> mFenceGenerator;

    Area mBufferArea = {-1, -1};
    const android_pixel_format_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888;

    bool mValidBuffer = false;
    buffer_handle_t mHandle = nullptr;
};


class Hwc2TestClientTargetBuffer {
public:
    Hwc2TestClientTargetBuffer();
    ~Hwc2TestClientTargetBuffer();

    int  get(buffer_handle_t* outHandle, int32_t* outFence,
            const Area& bufferArea, const Hwc2TestLayers* testLayers,
            const std::set<hwc2_layer_t>* clientLayers,
            const std::set<hwc2_layer_t>* clearLayers);

protected:
    android::sp<android::GraphicBuffer> mGraphicBuffer;

    std::unique_ptr<Hwc2TestFenceGenerator> mFenceGenerator;

    const android_pixel_format_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
};


class Hwc2TestVirtualBuffer {
public:
    void updateBufferArea(const Area& bufferArea);

    bool writeBufferToFile(std::string path);

    android::sp<android::GraphicBuffer>& graphicBuffer()
    {
        return mGraphicBuffer;
    }

protected:
    android::sp<android::GraphicBuffer> mGraphicBuffer;

    Area mBufferArea = {-1, -1};

    const android_pixel_format_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
};


class Hwc2TestExpectedBuffer : public Hwc2TestVirtualBuffer {
public:
    int generateExpectedBuffer(const Hwc2TestLayers* testLayers,
            const std::vector<hwc2_layer_t>* allLayers,
            const std::set<hwc2_layer_t>* clearLayers);
};


class Hwc2TestOutputBuffer : public Hwc2TestVirtualBuffer {
public:
    int getOutputBuffer(buffer_handle_t* outHandle, int32_t* outFence);
};

#endif /* ifndef _HWC2_TEST_BUFFER_H */
+0 −102
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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 <sstream>

#include <ui/Rect.h>

#include "Hwc2TestClientTarget.h"

int Hwc2TestClientTarget::getBuffer(const Hwc2TestLayers& testLayers,
        const std::set<hwc2_layer_t>& clientLayers,
        const std::set<hwc2_layer_t>& clearLayers, bool flipClientTarget,
        const Area& displayArea, buffer_handle_t* outHandle,
        int32_t* outAcquireFence)
{
    if (!flipClientTarget) {
        bool needsClientTarget = false;

        for (auto clientLayer : clientLayers) {
            if (testLayers.getVisibleRegion(clientLayer).numRects > 0) {
                needsClientTarget = true;
                break;
            }
        }

        if (!needsClientTarget) {
           *outHandle = nullptr;
           *outAcquireFence = -1;
           return 0;
        }
    }

    return mBuffer.get(outHandle, outAcquireFence, displayArea,
            &testLayers, &clientLayers, &clearLayers);
}


Hwc2TestClientTargetSupport::Hwc2TestClientTargetSupport(
        Hwc2TestCoverage coverage, const Area& displayArea)
    : mBufferArea(coverage, displayArea),
      mDataspace(coverage),
      mSurfaceDamage(coverage)
{
    mBufferArea.setDependent(&mSurfaceDamage);
}

std::string Hwc2TestClientTargetSupport::dump() const
{
    std::stringstream dmp;

    dmp << "client target: \n";

    for (auto property : properties) {
        dmp << property->dump();
    }

    return dmp.str();
}

void Hwc2TestClientTargetSupport::reset()
{
    for (auto property : properties) {
        property->reset();
    }
}

bool Hwc2TestClientTargetSupport::advance()
{
    for (auto property : properties) {
        if (property->advance())
            return true;
    }
    return false;
}

Area Hwc2TestClientTargetSupport::getBufferArea() const
{
    return mBufferArea.get();
}

android::ui::Dataspace Hwc2TestClientTargetSupport::getDataspace() const
{
    return mDataspace.get();
}

const hwc_region_t Hwc2TestClientTargetSupport::getSurfaceDamage() const
{
    return mSurfaceDamage.get();
}
Loading