/* * 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 #include #include #include #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 mGraphicBuffer; std::unique_ptr 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* clientLayers, const std::set* clearLayers); protected: android::sp mGraphicBuffer; std::unique_ptr 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& graphicBuffer() { return mGraphicBuffer; } protected: android::sp 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* allLayers, const std::set* clearLayers); }; class Hwc2TestOutputBuffer : public Hwc2TestVirtualBuffer { public: int getOutputBuffer(buffer_handle_t* outHandle, int32_t* outFence); }; #endif /* ifndef _HWC2_TEST_BUFFER_H */