1 /* 2 * Copyright (C) 2018 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 #pragma once 18 19 #include <memory> 20 #include <vector> 21 22 #include <android/hardware/graphics/composer/2.3/IComposer.h> 23 #include <android/hardware/graphics/composer/2.3/IComposerClient.h> 24 #include <composer-vts/2.2/ComposerVts.h> 25 #include <utils/StrongPointer.h> 26 27 namespace android { 28 namespace hardware { 29 namespace graphics { 30 namespace composer { 31 namespace V2_3 { 32 namespace vts { 33 34 using common::V1_1::RenderIntent; 35 using common::V1_2::ColorMode; 36 using common::V1_2::Dataspace; 37 using common::V1_2::Hdr; 38 using common::V1_2::PixelFormat; 39 using V2_1::Display; 40 using V2_1::Error; 41 using V2_3::IComposer; 42 using V2_3::IComposerClient; 43 44 class ComposerClient; 45 46 // A wrapper to IComposer. 47 class Composer : public V2_2::vts::Composer { 48 public: 49 Composer(); 50 explicit Composer(const std::string& name); 51 explicit Composer(const sp<IComposer>& composer); 52 53 std::unique_ptr<ComposerClient> createClient(); 54 55 private: 56 const sp<IComposer> mComposer; 57 }; 58 59 // A wrapper to IComposerClient. 60 class ComposerClient : public V2_2::vts::ComposerClient { 61 public: ComposerClient(const sp<IComposerClient> & client)62 explicit ComposerClient(const sp<IComposerClient>& client) 63 : V2_2::vts::ComposerClient(client), mClient(client) {} 64 65 sp<IComposerClient> getRaw() const; 66 67 bool getDisplayIdentificationData(Display display, uint8_t* outPort, 68 std::vector<uint8_t>* outData); 69 Error getDisplayedContentSamplingAttributes( 70 uint64_t display, PixelFormat& format, Dataspace& dataspace, 71 hidl_bitfield<IComposerClient::FormatColorComponent>& componentMask); 72 Error setDisplayedContentSamplingEnabled( 73 uint64_t display, IComposerClient::DisplayedContentSampling enable, 74 hidl_bitfield<IComposerClient::FormatColorComponent> componentMask, uint64_t maxFrames); 75 Error getDisplayedContentSample(uint64_t display, uint64_t maxFrames, uint64_t timestamp, 76 uint64_t& frameCount, hidl_vec<uint64_t>& sampleComponent0, 77 hidl_vec<uint64_t>& sampleComponent1, 78 hidl_vec<uint64_t>& sampleComponent2, 79 hidl_vec<uint64_t>& sampleComponent3); 80 81 std::vector<ColorMode> getColorModes_2_3(Display display); 82 83 void setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent); 84 85 std::vector<RenderIntent> getRenderIntents_2_3(Display display, ColorMode mode); 86 87 void getReadbackBufferAttributes_2_3(Display display, PixelFormat* outPixelFormat, 88 Dataspace* outDataspace); 89 90 std::vector<Hdr> getHdrCapabilities_2_3(Display display, float* outMaxLuminance, 91 float* outMaxAverageLuminance, float* outMinLuminance); 92 93 bool getClientTargetSupport_2_3(Display display, uint32_t width, uint32_t height, 94 PixelFormat format, Dataspace dataspace); 95 Error getDisplayCapabilities( 96 Display display, 97 std::vector<IComposerClient::DisplayCapability>* outDisplayCapabilities); 98 99 std::vector<IComposerClient::PerFrameMetadataKey> getPerFrameMetadataKeys_2_3(Display display); 100 101 bool getDisplayBrightnessSupport(Display display); 102 103 Error setDisplayBrightness(Display display, float brightness); 104 105 private: 106 const sp<IComposerClient> mClient; 107 }; 108 109 } // namespace vts 110 } // namespace V2_3 111 } // namespace composer 112 } // namespace graphics 113 } // namespace hardware 114 } // namespace android 115