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