1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _HWC2_TEST_CLIENT_TARGET_H 18 #define _HWC2_TEST_CLIENT_TARGET_H 19 20 #include <set> 21 22 #define HWC2_INCLUDE_STRINGIFICATION 23 #define HWC2_USE_CPP11 24 #include <hardware/hwcomposer2.h> 25 #undef HWC2_INCLUDE_STRINGIFICATION 26 #undef HWC2_USE_CPP11 27 28 #include "Hwc2TestProperties.h" 29 #include "Hwc2TestLayers.h" 30 31 /* Generates client target buffers from client composition layers */ 32 class Hwc2TestClientTarget { 33 public: 34 int getBuffer(const Hwc2TestLayers& layers, 35 const std::set<hwc2_layer_t>& clientLayers, 36 const std::set<hwc2_layer_t>& clearLayers, 37 bool clearClientTarget, const Area& displayArea, 38 buffer_handle_t* outHandle, int32_t* outAcquireFence); 39 40 private: 41 Hwc2TestClientTargetBuffer mBuffer; 42 }; 43 44 /* Generates valid client targets to test which ones the device will support */ 45 class Hwc2TestClientTargetSupport { 46 public: 47 Hwc2TestClientTargetSupport(Hwc2TestCoverage coverage, 48 const Area& displayArea); 49 50 std::string dump() const; 51 52 void reset(); 53 bool advance(); 54 55 Area getBufferArea() const; 56 android::ui::Dataspace getDataspace() const; 57 const hwc_region_t getSurfaceDamage() const; 58 59 private: 60 std::array<Hwc2TestContainer*, 3> properties = {{ 61 &mDataspace, &mSurfaceDamage, &mBufferArea 62 }}; 63 64 Hwc2TestBufferArea mBufferArea; 65 Hwc2TestDataspace mDataspace; 66 Hwc2TestSurfaceDamage mSurfaceDamage; 67 }; 68 69 #endif /* ifndef _HWC2_TEST_CLIENT_TARGET_H */ 70